It depends on the type of your driver... Yours sincerely, Alex Bash
Bash
Posts
-
user-mode, kernel-mode and firewalls -
Getting SID of computerHi, Could anyone provide an example to get SID (Security Identificator) of local computer ? Yours sincerely, Alex Bash
-
what does "rhs" mean?Hi, I recently started learning pure C++ and want to know what does "rhs" mean? For example: class MyClass { public: MyClass& operator=(const MyClass& rhs); }; I've investigated that "rhs" is frequently-used in operator overloaders in C++ classes. What is "rhs"? May I use another word (for example, "dog") instead "rhs"? Sorry for stupid question. Yours sincerely, Alex Bash
-
MSXML: troubles with "insertBefore" in Microsoft Visual C++Hi Gurus! I have the simplest xml document (d:\\book.xml): <?xml version="1.0"?> <Report> ... </Report> I've written the small program (inserting XSL reference in the prolog): Dim xmlDoc,pi,ref set xmlDoc = CreateObject ("Msxml.DOMDocument") xmlDoc.async = false xmlDoc.resolveExternals = false xmlDoc.load ("d:\\book.xml") ref="type=""text/xsl"" href=""mysheet.xsl""" set pi = xmlDoc.createProcessingInstruction("xml-stylesheet",ref) xmlDoc.insertBefore pi,xmlDoc.childNodes.item(1) WScript.Echo(xmlDoc.xml) It works fine! Next, I tried to do the same using Microsoft Visual C++: IXMLDOMDocumentPtr XmlDocPtr; _bstr_t bstrXMLReport(_T("d:\\book.xml"); VARIANT_BOOL vtResult; HRESULT hr = XmlDocPtr.CreateInstance(MSXML::CLSID_DOMDocument); if (FAILED(hr)) { AfxMessageBox("Failed to CreateInstance(CLSID_DOMDocument)"); return; }; XmlDocPtr->async=FALSE; XmlDocPtr->resolveExternals=FALSE; vtResult=XmlDocPtr->load(bstrXMLReport); if (vtResult == VARIANT_FALSE) { AfxMessageBox("Failed to load XML document"); return; }; IXMLDOMProcessingInstructionPtr pi; _bstr_t bstrTarget(_T("xml-stylesheet")); _bstr_t bstrData(_T("type=\"text/xsl\" href=\"mysheet.xsl\"")); pi=XmlDocPtr->createProcessingInstruction(bstrTarget,bstrData); BSTR qqq; pi->get_xml(&qqq); CComVariant varRef; IXMLDOMNodePtr pFirst,pXMLNodeCur; XmlDocPtr->childNodes->get_item(1,&pFirst); varRef=pFirst; try { XmlDocPtr->insertBefore(pi,t); AfxMessageBox(XmlDocPtr->xml); } catch(_com_error &er) { TCHAR szErr[MAX_PATH]; memset(szErr,0,sizeof(szErr)); _tcscpy(szErr,(LPCTSTR)er.Description()); AfxMessageBox(szErr); }; After that, I've got the exception "The parameter is incorrect." Why? I suspect the incorrect usage of insertBefore method. What should I do? Yours sincerely, Alex Bash
-
Changing the prolog of XML documentSorry, my question is: Hi Gurus! How to programmaly update the prolog of existing XML document? (using MSXML) I have the follows in the prolog: <?xml-stylesheet href="/style.css" type="text/css"> I want to change from "style.css" to "style2.css". What should I do? Yours sincerely, Alex Bash
-
Changing the prolog of XML documentHi Gurus! How to programmaly update the prolog of existing XML document? (using MSXML) I have the follows in the prolog: I want to change from "style.css" to "style2.css". What should I do? Yours sincerely, Alex Bash
-
Getting information about remote COM clientHi Gurus! I've written COM-server (executable, out-of-process) and COM-client. Both works successfully through DCOM on separate PCs. Is it possible to obtain information about calling client in COM-server (I want to know computer’s name and its IP address, username who launch the COM-client) ? How? Yours sincerely, Alex Bash
-
Stupid question about AutomationHello guys, I'm novice in VB 6.0 but have some skill in VC++. I'm developing COM-server using Visual C++ and "thin client" in VB 6.0 ("late binding"). One of function is present in COM-server as follows: [id(5), helpstring("method Encoder")] HRESULT Encoder([out] long * Result, [out] long * LastError); As you see, method "Encoder" receives two pointers to long data type. I can invoke that method from client written on Visual C++, but I can't do that on VB. Is it possible to call method "Encoder" from VB Client? How? Or I need to rewrite my COM-server and include two separate methods: - get_EncoderResult - get_EncoderLastError ? Yours sincerely, Alex Bash
-
DCOM: running COM-server on another PCHi Guys! I'm novice in DCOM and my question will be very easy. I'm created COM-server and its COM-client. I can successfully run both on the same machine and successufully run on the separate machine (with modification in dcomcnfg). The code is not changed when remote running. I used the follows (it works fine): IEncoder * pEncoder; HRESULT hr=CoCreateInstance(CLSID_Encoder, NULL, CLSCTX_SERVER, IID_IEncoder, (void **)&pEncoder); I'm trying to specify exactrly on which machine COM-server should be run using the follows: WCHAR *wszMachineName=L"STAR\0"; COSERVERINFO srv; ZeroMemory(&srv,sizeof(srv)); srv.pwszName=wszMachineName; MULTI_QI qi; HRESULT hr=CoCreateInstanceEx(CLSID_Encoder, NULL, CLSCTX_SERVER, &srv, 1, &qi); This returns E_INVALIDARG. :( What should I do to remotely invoke my COM-server from another machine using CoCreateInstanceEx() ? Yours sincerely, Alex Bash
-
COM: precompiled header in *_i.c filesHelp, guys! I'm novice in COM and my question is very easy. I've created my first COM-server (say, Encoder that have produced files Encode_i.c and Encode.h). Now, I'm writting COM-client for my COM-server. I've created new project (Simple Win32 application), copied Encode_i.c and Encode.h into project with my COM-client. When I try to compile COM-client, I got the follows: c:\home\encodeclt\encode_i.c(50) : fatal error C1010: unexpected end of file while looking for precompiled header directive Error executing cl.exe. EncodeClt.exe - 1 error(s), 0 warning(s) What should I do? Yours sincerely, Alex Bash
-
Problems with ShellExecuteSorry, #define WEBSITE "http://www.microsoft.com" The problem is still not resolved. I'm in shock. Any ideas? Yours sincerely, Alex Bash
-
Problems with ShellExecuteDear MFC Gurus! My brains don't want to work. I have no ideas. I'm writting simple MFC-based application. ShellExecute doesn't work in my application (in other words, when clicking the static control, MSIE doesn't start): UINT err=(UINT)::ShellExecute(NULL,_T("open"),_T(WEBSITE),_T(""),_T("c:\\"), SW_SHOWNORMAL); This returns "SE_ERR_ACCESSDENIED". Why? By the way, I have another project in the _same_ workspace where it works fine. Moreover, I used this scheme always but today it doesn't work! Help! Urgent! Yours sincerely, Alex Bash
-
to track changing the selection of comboboxWhat is "trap"? I'm not sure about terminology... Yours sincerely, Alex Bash
-
to track changing the selection of comboboxDear MFC Gurus! I'm writting SDI-based application that has DialogBar with combobox control. This DialogBar is initialized as the follows: int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ... if (!m_Bar.Create(this,IDD_BARDLG,CBRS_TOP,ID_MYBARDLG)) { AfxMessageBox(_T("Failed to create dialog bar!"),MB_ICONSTOP); return -1; }; }; where m_Bar is CDialogBar. IDD_BARDLG doesn't have its class derived from CDialog! How to capture ON_CBN_SELCHANGE message in CMainFrame class from combobox control belonging m_Bar? In other words, I need to track changing the selection of combobox. What should I do? Yours sincerely, Alex Bash
-
STL deque problemHi, I'm novice in STL C++ librari, so my question will be very easy. I have a structure, for example: typedef struct _mystruct { char name[256]; bool sex; int age; } mystruct, *pmystruct; I can define a class based on queue STL template: typedef queue > MEMBERS_QUEUE; // This works perfectly But I want also define a class based on deque: typedef deque > MEMBERS_DEQUE; // This doesn't work. I suspect that I must define allocator for mystruct... What should I do to construct own class based on deque and mystruct? Yours sincerely, Alex Bash
-
How to use ResXResourceReader ?Hi, My next question is about using resources in Web-forms application. I don't want to use binary resources files compiled by resgen.exe since my russian text seems to be broken inside binary file. So, as a solution, I want to use XML-based resource file. But I've been amazed that class ResourceManager doesn't work with .resx files. Is it true? The class ResXResourceReader doesn't contain GetString(string s) method. So, I have to use the same code to get string from ResXResourceCode: public string GetString(string rr) { foreach(DictionaryEntry entry in myResxRR) { if( entry.Key.ToString() == rr ) return entry.Value.ToString(); }; return ""; } Why is it so complex ? Will it reflect to a performance (enumeration of all string is not best solution) ? How to get string from ResXResourceReader? Yours sincerely, Alex Bash
-
Strategy of usage SqlConnection in Web-forms applicationThank you very much for your advise. Yours sincerely, Alex Bash
-
Strategy of usage SqlConnection in Web-forms applicationHi, I would like to ask a general question about ASP.NET and SQL Server. I'm creating an Web-forms application used Microsoft SQL Server and included several ASP.NET-pages. I assume that there are two strategies when I should open a database connection. 1. "Open once during session start" strategy. This means that class System.Web.HttpApplication.Global contains SqlConnection object and the method "Session_Start" contains an invoking of SqlConnection.Open(). If I need to get a pointer to the existed SqlConnection, I will get a pointer to the current instance of class System.Web.HttpApplication.Global. So this method doesn't requires to re-open the database connection on the every page. When current session is finished, the database connection will be closed automatically since object System.Web.HttpApplication.Global will be deleted. 2. "Open and close on the every page" strategy. This means that I don't keep the existed SqlConnection opened. If I need a data from SqlServer (say, to fill DataGrid), I will create a new instance of SqlConnection object each times when it will need. What do you think? What method do you use? Yours sincerely, Alex Bash
-
problems witn MSXML in multi-threading applicationsHi, I've got a strange problem. I have a multithreading Win32 MFC application used MSXML. All XML-related procedures (loading, parsing and etc) are worked in a separated thread started with _begingthread(). This thread looks like as shown below. When this thread calls IXMLDOMDocument::load() to load an existed XML document from a file, this will stop an opening all Microsoft Office 2000 documents (Word,Excel and etc). This problem appears only under Windows 9x/ME. What's wrong? Help me! void XMLTrafReportThreadFunction(void *) { ::CoInitializeEx(NULL,COINIT_MULTITHREADED); IXMLDOMDocumentPtr XmlDocPtr; _bstr_t bstrXMLReport(lpszFilename); VARIANT_BOOL vtResult; HRESULT hr = XmlDocPtr.CreateInstance(MSXML::CLSID_DOMDocument); if (FAILED(hr)) return 0; vtResult=XmlDocPtr->load(bstrXMLReport); ... ... } Yours sincerely, Alex Bash
-
Can't catch OnClose() in CSocketHi! Please, help me to resolve a simple problem. I can't catch OnClose() notification in the CSocket-derived class. What's wrong? However, OnSend() and OnReceive() work fine. Maybe, Does anybody know useful trick? ///////////////////////////////////////////////////////////////////////////// // CNetClientSock command target class CNetClientSock : public CSocket { // Attributes public: // Operations public: CNetClientSock(); virtual ~CNetClientSock(); // Overrides public: CWinThread* m_pThread; // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CNetClientSock) public: virtual void OnClose(int nErrorCode); virtual void OnSend(int nErrorCode); virtual void OnReceive(int nErrorCode); //}}AFX_VIRTUAL // Generated message map functions //{{AFX_MSG(CNetClientSock) // NOTE - the ClassWizard will add and remove member functions here. //}}AFX_MSG // Implementation protected: }; void CNetClientSock::OnClose(int nErrorCode) { // TODO: Add your specialized code here and/or call the base class m_pThread->PostThreadMessage(WM_QUIT,0,0); CSocket::OnClose(nErrorCode); } Yours sincerely, Alex Bash