Search Results

Search found 120 results on 5 pages for 'atl'.

Page 2/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • CString error, 'CString': is not a member of 'ATL::CStringT<BaseType, StringTraits>'

    - by flavour404
    Hi, I am trying to do this: #include <atlstr.h> CHAR Filename; // [sp+26Ch] [bp-110h]@1 char v31; // [sp+36Ch] [bp-10h]@1 int v32; // [sp+378h] [bp-4h]@1 GetModuleFileNameA(0, &Filename, 0x100u); CString::CString(&v31, &Filename); But I am getting the compiler error C2039:'CString': is not a member of 'ATL::CStringT' This is a non MFC based dll, but according to the docs you should be able to use CString functionality with the include #include atlstr.h how do I make it work? Thanks

    Read the article

  • WebBrowser Control in ATL window. How to free up memory on window unload? I'm stuck.

    - by Martin
    Hello there. I have a Win32 C++ Application. There is the _tWinMain(...) Method with GetMessage(...) in a while loop at the end. Before GetMessage(...) I create the main window with HWND m_MainHwnd = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_LAYERED, CAxWindow::GetWndClassName(), _TEXT("http://www.-website-.com"), WS_POPUP, 0, 0, 1024, 768, NULL, NULL, m_Instance, NULL); ShowWindow(m_MainHwnd) If I do not create the main window, my application needs about 150K in memory. But with creating the main window with the WebBrowser Control inside, the memory usage increases to 8500K. But, I want to dynamically unload the main window. My _tWinMain(...) keeps running! Im unloading with DestroyWindow(m_MainHwnd) But the WebBrowser control won't unload and free up it's memory used! Application memory used is still 8500K! I can also get the WebBrowser Instance or with some additional code the WebBrowser HWND IWebBrowser2* m_pWebBrowser2; CAxWindow wnd = (CAxWindow)m_MainHwnd; HRESULT hRet = wnd.QueryControl(IID_IWebBrowser2, (void**)&m_pWebBrowser2); So I tried to free up the memory used by main window and WebBrowser control with (let's say it's experimental): if(m_pWebBrowser2) m_pWebBrowser2->Release(); DestroyWindow(m_hwndWebBrowser); //<-- just analogous OleUninitialize(); No success at all. I also created a wrapper class which creates the main window. I created a pointer and freed it up with delete: Wrapper* wrapper = new Wrapper(); //wrapper creates main window inside and shows it //...do some stuff delete(wrapper); No success. Still 8500K. So please, how can I get rid of the main window and it's WebBrowser control and free up the memory, returning to about 150K. Later I will recreate the window. It's a dynamically load and unload of the main window, depending on other commands. Thanks! Regards Martin

    Read the article

  • How do I create interface methods using .tlb types in VS C++?

    - by Steven
    Background: The .TLB file contains interfaces written in language 'X'. I don't have .h, .idl, .tlh, or any other header files - just the .TLB file. Language 'X' does not export compatible .h, .idl, etc. I use the VS wizard to add an ATL simple object to my ATL project. I want to add a method to the interface of my simple ATL object that uses one of the .TLB defined types for a parameter. // Something like the following in the .idl file: interface ISomeInterface : IUnknown { HRESULT SomeMethod([in] ITypeFromTLB* aVal); // ITypeFromTLB declared in .TLB file. }; How can I do this? I'm hoping for a wizard, or a line in the .idl interface declaration that would bring in the .tlb information. midl's include (no .tlb), import (no tlb), and importlib (library only) don't seem to provide a solution (I need proxy/stub to be working, so I cannot put this inside the library declaration with the importlib command). Thanks.

    Read the article

  • Mixed Solaris 10 and 11 versions in logical domains on the same server

    - by jsavit
    One question that comes up frequently is whether you can mix Solaris 10 and Solaris 11 in different logical domains under Oracle VM Server for SPARC. The answer is yes depending only on the system software requirements for the underlying hardware platform. Different versions of Solaris 10 and 11 can exist side-by-side on the same server and can act as control, service, I/O or guest domains subject only to the minimum software levels documented in the System Requirements section of the Oracle VM Server for SPARC Release Notes. Here's an example just taken from a running system. First, here's the control domain, which is running Solaris 10. I've highlighted a guest running Solaris 11. # uname -a SunOS atl-sewr-24 5.10 Generic_147440-01 sun4v sparc SUNW,SPARC-Enterprise-T5220 # ldm -V Logical Domains Manager (v 2.1) Hypervisor control protocol v 1.7 Using Hypervisor MD v 1.3 System PROM: Hypervisor v. 1.10.0 @(#)Hypervisor 1.10.0 2011/04/27 16:19\015 # ldm list NAME STATE FLAGS CONS VCPU MEMORY UTIL UPTIME primary active -n-cv- SP 16 4G 1.6% 120d 17h atl-sewr-pool-148 active -n---- 5001 8 2G 0.1% 119d 21h atl-sewr-pool-152 active -n---- 5000 8 4G 0.2% 112d 19h atl-sewr-pool-154 active -n---- 5002 8 2G 0.1% 120d 15h atl-sewr-pool-155 active -n---- 5003 16 2G 0.0% 26d 14h 30m This system is running Oracle VM Server 2.1 with a Solaris 10 control domain. Hmm, I should update this machine to 2.2 when I get a few free moments. Upgrading is very straightforward. Here's a display logging into the highlighted guest: Last login: Mon May 21 10:18:16 2012 from dhcp-adc-twvpn- Oracle Corporation SunOS 5.11 11.0 November 2011 sewr@atl-sewr-pool-152:~$ uname -a SunOS atl-sewr-pool-152 5.11 11.0 sun4v sparc SUNW,SPARC-Enterprise-T5220 sewr@atl-sewr-pool-152:~$ cat /etc/release Oracle Solaris 11 11/11 SPARC Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved. Assembled 18 October 2011 sewr@atl-sewr-pool-152:~$ sudo virtinfo -ct Password: Domain role: LDoms guest Control domain: atl-sewr-24 sewr@atl-sewr-pool-152:~$ That's running the GA version of Solaris 11, so I probably should update that some time too. Note the use of the virtinfo -ct command that lets the guest get information about the hosting environment. Summary You can mix and match versions of Solaris in logical domains. All the different combinations work: Solaris 10 and/or Solaris 11 control and service domains with Solaris 10 and/or Solaris 11 guests. Mixing different guest OS levels on the same server is one of the traditional reasons for using virtual machines in the first place since virtual machines were invented some 40 years ago, used to run production and test systems in parallel while upgrading OS levels. This can easily be done with Oracle VM Server for SPARC (Logical Domains).

    Read the article

  • Convert IDispatch* to a string?

    - by Rob
    I am converting an old VB COM object (which I didn't write) to C++ using ATL. One of the methods, according to the IDL, takes an IDispatch* as a parameter and the documentation and samples for this method claim that you can pass either a string (which is the progid of an object that will be created and used by the control) or an IDispatch* to an object that has already been created. How on earth do I implement this in ATL? For example, the IDL: [id(1)] HRESULT Test(IDispatch* obj); The samples (which are all JScript): obj.Test("foo.bar"); or var someObject = new ActiveXObject("foo.bar"); obj.Test(someObject); To make matters even more bizarre the actual VB code that implements this method actually declares the 'obj' parameter as a string! However, it all seems to work. Can you even pass a string to a COM method that takes an IDispatch*? If so, can I determine that the IDispatch* is actually a string in my C++ ATL code? Even better, if it's an IDispatch that implements a specific interface I will want to call methods on it, or instantiate an object if it's a string. Any ideas welcome!

    Read the article

  • Problem catching OnClick event using HTMLDocumentEvents2 in a BHO

    - by Yonatan
    I am running a BHO and i am trying to catch OnClick events using HTMLDocumentEvents2 however, the events never seem to reach the handler this is what i am doing: class ATL_NO_VTABLE CBlastBhoBHO : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CBlastBhoBHO, &CLSID_BlastBhoBHO>, public IObjectWithSiteImpl<CBlastBhoBHO>, public IDispatchImpl<IBlastBhoBHO, &IID_IBlastBhoBHO, &LIBID_BlastBhoLib, /*wMajor =*/ 1, /*wMinor =*/ 0>, public IDispEventImpl<0, CBlastBhoBHO, &DIID_HTMLDocumentEvents2, &LIBID_MSHTML, 1, 0>, public IDispEventImpl<1, CBlastBhoBHO, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 1> BEGIN_SINK_MAP(CBlastBhoBHO) SINK_ENTRY_EX(0, DIID_HTMLDocumentEvents2, DISPID_HTMLDOCUMENTEVENTS2_ONCLICK, OnClickTrigger) SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_DOCUMENTCOMPLETE, OnDocumentComplete) END_SINK_MAP() // Handlers void STDMETHODCALLTYPE CBlastBhoBHO::OnDocumentComplete( IDispatch *pDisp, VARIANT *url) { // works fine } void STDMETHODCALLTYPE CBlastBhoBHO::OnClickTrigger(IHTMLEventObj *pEvtObj) { // Never called } // From SetSite() ATL::IDispEventSimpleImpl<1,CBlastBhoBHO,&DIID_DWebBrowserEvents2>::DispEventAdvise(m_spWebBrowser); // From OnDocumentComplete CComQIPtr<IHTMLDocument3> doc_; m_spWebBrowser->get_Document((IDispatch**) &doc_); ATL::IDispEventSimpleImpl<0,CBlastBhoBHO,&DIID_HTMLDocumentEvents2>::DispEventAdvise(doc_); I have tried several variations(using HTMLElementEvents2 etc) or Advising on different objects or Advising on the document from SetSite. my handler is never called. Any help would be much appreciated. all i need is the onClick event.

    Read the article

  • Question about making Asynchronous call in C# (WPF) to COM object

    - by Andrew
    Hi, Sorry to ask such a basic question but I seem to have a brain freeze on this one! I'm calling a COM (ATL) object from my WPF project. The COM method might take a long time to complete. I thought I'd try and call it asychronously. I have a few demo lines that show the problem. private void checkBox1_Checked(object sender, RoutedEventArgs e) { //DoSomeWork(); AsyncDoWork caller = new AsyncDoWork(DoSomeWork); IAsyncResult result = caller.BeginInvoke(null, null); } private delegate void AsyncDoWork(); private void DoSomeWork() { _Server.DoWork(); } The ATL method DoWork is very exciting. It is: STDMETHODIMP CSimpleObject::DoWork(void) { Sleep(5000); return S_OK; } I had expectations that running this way would result in the checkbox being checked right away (instead of in 5 seconds) and me being able to move the WPF gui around the screen. I can't - for 5 seconds. What am I doing wrong? I'm sure it's something pretty simple. Delegate signature wrong? Thanks.

    Read the article

  • Crash generated during destruction of hash_map

    - by Alien01
    I am using hash_map in application as typedef hash_map<DWORD,CComPtr<IInterfaceXX>> MapDword2Interface; In main application I am using static instance of this map static MapDword2Interface m_mapDword2Interface; I have got one crash dump from one of the client machines which point to the crash in clearing this map I opened that crash dump and here is assembly during debugging > call std::list<std::pair<unsigned long const ,ATL::CComPtr<IInterfaceXX> >,std::allocator<std::pair<unsigned long const ,ATL::CComPtr<IInterfaceXX> > > >::clear > mov eax,dword ptr [CMainApp::m_mapDword2Interface+8 (49XXXXX)] Here is code where crash dump is pointing. Below code is from stl:list file void clear() { // erase all #if _HAS_ITERATOR_DEBUGGING this->_Orphan_ptr(*this, 0); #endif /* _HAS_ITERATOR_DEBUGGING */ _Nodeptr _Pnext; _Nodeptr _Pnode = _Nextnode(_Myhead); _Nextnode(_Myhead) = _Myhead; _Prevnode(_Myhead) = _Myhead; _Mysize = 0; for (; _Pnode != _Myhead; _Pnode = _Pnext) { // delete an element _Pnext = _Nextnode(_Pnode); this->_Alnod.destroy(_Pnode); this->_Alnod.deallocate(_Pnode, 1); } } Crash is pointing to the this->_Alnod.destroy(_Pnode); statement in above code. I am not able to guess it, what could be reason. Any ideas??? How can I make sure, even is there is something wrong with the map , it should not crash?

    Read the article

  • Is it possible to simultaneously debug VB6 and a C++ COM dll?

    - by Steve
    I have a VB6 dll that is loaded by a VB6 frontend. This VB6 dll calls a C++ ATL dll via its COM interface. So, I can run from code in VB6 and I can debug in C++ also, however I can't seem to step through the VB6 code and then get into the C++ code. I feel that this should be possible. Currently I am doing the following steps Start VB6 debugging Start C++ debugging. This involves starting the VB6 front end and setting the working directory to the VB6 front end directory using the VS2008 Debugging Properties in the Options. Execute the code and step through the VB6 code to the point where I should be entering the C++ code. I see the loaded symbols window changing in the VS2008 IDE. Now, it looks like it should work, but I never hit any breakpoints in my C++ code. I hit the breakpoints if I don't start the VB6 debugging first.

    Read the article

  • How to Set ActiveX Control name on the install window of Internet Explorer

    - by Gohan
    I created a ActiveX control using ATL, already package it with signature. I want to use it on the webpage, but at the install window the name is MyActiveX.cab with no link. the MyActiveX.cab name can be changed by modifying the html page's tag codebase attribute. but the name is still format like "XXX.cab" with no hyperlink. I find a activex control from chinese website has its own name and link: and its object tags are nothing different: <object ID="CMBPB_OCX" CODEBASE="http://szdl.cmbchina.com/download/PB/pb50.cab#version=5,3,1,1" classid="clsid:F2EB8999-766E-4BF6-AAAD-188D398C0D0B" width="0" height="0"> </object> the pic was taken from MSDN Pages, it has link. Really want to know how to Set the activex control name? I try to get help from How to Set ActiveX Control Name, but still get stuck.

    Read the article

  • error C2065: 'AfxBeginThread' : undeclared identifier

    - by bdhar
    I have a simple ATL Service in which I have included the following statement. AfxBeginThread(WorkerThread, this, THREAD_PRIORITY_NORMAL, 0, 0); But the compiler complains that error C2065: 'AfxBeginThread' : undeclared identifier But in MSDN i found that AfxBeginThread is found in AFXWIN.H If I include AFXWIN.H, the compiler complains that fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> What am I missing here? Thanks. PS: I am using Visual Studio 6.0 Enterprise Edition in Windows XP SP2.

    Read the article

  • Trouble in ActiveX multi-thread invoke javascript callback routine

    - by code0tt
    everyone. I'm get some trouble in ActiveX programming with ATL. I try to make a activex which can async-download files from http server to local folder and after download it will invoke javascript callback function. My solution: run a thread M to monitor download thread D, when D is finish the job, M is going to terminal themself and invoke IDispatch inferface to call javascript function. **************** THERE IS MY CODE: **************** /* javascript code */ funciton download() { var xfm = new ActiveXObject("XFileMngr.FileManager.1"); xfm.download( 'http://somedomain/somefile','localdev:\\folder\localfile',function(msg){alert(msg);}); } /* C++ code */ // main routine STDMETHODIMP CFileManager::download(BSTR url, BSTR local, VARIANT scriptCallback) { CString csURL(url); CString csLocal(local); CAsyncDownload download; download.Download(this, csURL, csLocal, scriptCallback); return S_OK; } // parts of CAsyncDownload.h typedef struct tagThreadData { CAsyncDownload* pThis; } THREAD_DATA, *LPTHREAD_DATA; class CAsyncDownload : public IBindStatusCallback { private: LPUNKNOWN pcaller; CString csRemoteFile; CString csLocalFile; CComPtr<IDispatch> spCallback; public: void onDone(HRESULT hr); HRESULT Download(LPUNKNOWN caller, CString& csRemote, CString& csLocal, VARIANT callback); static DWORD __stdcall ThreadProc(void* param); }; // parts of CAsyncDownload.cpp void CAsyncDownload::onDone(HRESULT hr) { if(spCallback) { TRACE(TEXT("invoke callback function\n")); CComVariant vParams[1]; vParams[0] = "callback is working!"; DISPPARAMS params = { vParams, NULL, 1, 0 }; HRESULT hr = spCallback->Invoke(0, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, NULL, NULL, NULL); if(FAILED(hr)) { CString csBuffer; csBuffer.Format(TEXT("invoke failed, result value: %d \n"),hr); TRACE(csBuffer); }else { TRACE(TEXT("invoke was successful\n")); } } } HRESULT CAsyncDownload::Download(LPUNKNOWN caller, CString& csRemote, CString& csLocal, VARIANT callback) { CoInitializeEx(NULL, COINIT_MULTITHREADED); csRemoteFile = csRemote; csLocalFile = csLocal; pcaller = caller; switch(callback.vt){ case VT_DISPATCH: case VT_VARIANT:{ spCallback = callback.pdispVal; } break; default:{ spCallback = NULL; } } LPTHREAD_DATA pData = new THREAD_DATA; pData->pThis = this; // create monitor thread M HANDLE hThread = CreateThread(NULL, 0, ThreadProc, (void*)(pData), 0, NULL); if(!hThread) { delete pData; return HRESULT_FROM_WIN32(GetLastError()); } WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); CoUninitialize(); return S_OK; } DWORD __stdcall CAsyncDownload::ThreadProc(void* param) { LPTHREAD_DATA pData = (LPTHREAD_DATA)param; // here, we will create http download thread D // when download job is finish, call onDone method; pData->pThis->onDone(S_OK); delete pData; return 0; } **************** CODE FINISH **************** OK, above is parts of my source code, if I call onDone method in sub-thread, I will get OLE ERROR(-2147418113 (8000FFFF) Catastrophic failure.). Did I miss something? please help me to figure it out.

    Read the article

  • Mouse Event BHO

    - by shaimagz
    I want my BHO to listen to onmousedown event of some element in a certain webpage. I have all the code that find the specific element, and in msdn its says that I need to use the get_onmousedown event. I came up with this code. CComQIPtr<IHTMLElement> someElement; VARIANT mouse_eve; someElement->get_onmousedown(&mouse_eve); The question is, how do I tell it to run some function when this event occurs?

    Read the article

  • CComPtr pass by reference

    - by Mahesh
    I have a situation where I need to pass a CComPtr<IXmlReader> to a function by reference. Does the called parameter takes the ownership from the callee parameter (or) the reference count is increased? void foo( CComPtr<IXmlReader> & pReader ) { // There is no reassignment of the CComPtr. // Just call the IXmlReader methods. } CComPtr<IXmlReader> pReader; foo( pReader ); // Is pReader still valid after the function return ? Thanks.

    Read the article

  • Outlook Addin: DispEventAdvise exception.

    - by framara
    I want to creating an addin that captures when a {contact, calendar, task, note} is {created, edited, removed}. I have the following code, to make it shorter I removed all the code but the related to contact, since all types will be the same I guess. AutoSync.h class ATL_NO_VTABLE AutoSync : public wxPanel, public IDispEventSimpleImpl<1, AutoSync, &__uuidof(Outlook::ItemsEvents)>, public IDispEventSimpleImpl<2, AutoSync, &__uuidof(Outlook::ItemsEvents)>, public IDispEventSimpleImpl<3, AutoSync, &__uuidof(Outlook::ItemsEvents)> { public: AutoSync(); ~AutoSync(); void __stdcall OnItemAdd(IDispatch* Item); /* 0xf001 */ void __stdcall OnItemChange(IDispatch* Item); /* 0xf002 */ void __stdcall OnItemRemove(); /* 0xf003 */ BEGIN_SINK_MAP(AutoSync) SINK_ENTRY_INFO(1, __uuidof(Outlook::ItemsEvents), 0xf001, OnItemAdd, &OnItemsAddInfo) SINK_ENTRY_INFO(2, __uuidof(Outlook::ItemsEvents), 0xf002, OnItemChange, &OnItemsChangeInfo) SINK_ENTRY_INFO(3, __uuidof(Outlook::ItemsEvents), 0xf003, OnItemRemove, &OnItemsRemoveInfo) END_SINK_MAP() typedef IDispEventSimpleImpl<1, AutoSync, &__uuidof(Outlook::ItemsEvents)> ItemAddEvents; typedef IDispEventSimpleImpl<2, AutoSync, &__uuidof(Outlook::ItemsEvents)> ItemChangeEvents; typedef IDispEventSimpleImpl<3, AutoSync, &__uuidof(Outlook::ItemsEvents)> ItemRemoveEvents; private: CComPtr<Outlook::_Items> m_contacts; }; AutoSync.cpp _NameSpacePtr pMAPI = OutlookWorker::GetInstance()->GetNameSpacePtr(); MAPIFolderPtr pContactsFolder = NULL; HRESULT hr = NULL; //get folders if(pMAPI != NULL) { pMAPI-GetDefaultFolder(olFolderContacts, &pContactsFolder); } //get items if(pContactsFolder != NULL) pContactsFolder-get_Items(&m_contacts); //dispatch events if(m_contacts != NULL) { //HERE COMES THE EXCEPTION hr = ItemAddEvents::DispEventAdvise((IDispatch*)m_contacts,&__uuidof(Outlook::ItemsEvents)); hr = ItemChangeEvents::DispEventAdvise((IDispatch*)m_contacts,&__uuidof(Outlook::ItemsEvents)); hr = ItemRemoveEvents::DispEventAdvise((IDispatch*)m_contacts,&__uuidof(Outlook::ItemsEvents)); } somewhere else defined: extern _ATL_FUNC_INFO OnItemsAddInfo; extern _ATL_FUNC_INFO OnItemsChangeInfo; extern _ATL_FUNC_INFO OnItemsRemoveInfo; _ATL_FUNC_INFO OnItemsAddInfo = {CC_STDCALL,VT_EMPTY,1,{VT_DISPATCH}}; _ATL_FUNC_INFO OnItemsChangeInfo = {CC_STDCALL,VT_EMPTY,1,{VT_DISPATCH}}; _ATL_FUNC_INFO OnItemsRemoveInfo = {CC_STDCALL,VT_EMPTY,0}; The problems comes in the hr = ItemAddEvents::DispEventAdvise((IDispatch*)m_contacts,&__uuidof(Outlook::ItemsEvents)); hr = ItemChangeEvents::DispEventAdvise((IDispatch*)m_contacts,&__uuidof(Outlook::ItemsEvents)); hr = ItemRemoveEvents::DispEventAdvise((IDispatch*)m_contacts,&__uuidof(Outlook::ItemsEvents)); It gives exception in 'atlbase.inl' when executes method 'Advise': ATLINLINE ATLAPI AtlAdvise(IUnknown* pUnkCP, IUnknown* pUnk, const IID& iid, LPDWORD pdw) { if(pUnkCP == NULL) return E_INVALIDARG; CComPtr<IConnectionPointContainer> pCPC; CComPtr<IConnectionPoint> pCP; HRESULT hRes = pUnkCP->QueryInterface(__uuidof(IConnectionPointContainer), (void**)&pCPC); if (SUCCEEDED(hRes)) hRes = pCPC->FindConnectionPoint(iid, &pCP); if (SUCCEEDED(hRes)) //HERE GIVES EXCEPTION //Unhandled exception at 0x2fe913e3 in OUTLOOK.EXE: 0xC0000005: //Access violation reading location 0xcdcdcdcd. hRes = pCP->Advise(pUnk, pdw); return hRes; } I can't manage to understand why. Any sugestion here? Everything seems to be fine, but obviously is not. I've been stucked here for quite a long time. Need your help, thanks.

    Read the article

  • How to call interface API from within COM server

    - by Alien01
    I have one com server with some interfaces exposing some API's COM class looks like below class ATL_NO_VTABLE CTask : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CTask, &CLSID_Task>, public ITask { public: STDMETHOD (Task)(); STDMETHOD (ABC)(); ... } Now this com server also contains one more class XYZ ABC API needs to call XYZ functionality STDMETHODIMP ABC() { XYZ xyz; xyz.dosomething(); } dosomething function need to call com server Task function, like below class XYZ { public: void dosomething() { // need to call Task function } }; How can this be done? Do I need to CoCreateInstance ITask in dosomething? I tried creating CTask taskl; in dosomething but it gave some errors.

    Read the article

  • CComPtr CoCreateInstance returns 0x80070582 (Class already exists.)

    - by Trevor Balcom
    I have a StartComObjects function called when the user presses the Login button and a StopComObjects function called when the user presses the Cancel button. The StartComObjects function uses CComPtr.CoCreateInstance to create the COM object and sets up some connection points using AfxConnectionAdvise. When the user presses the Cancel button the connection points are disconnected using AfxConnectionUnadvise and the COM object is stopped before calling Release on the CComPtr. When I press the login button a second time the CComPtr.CoCreateInstance returns 0x80070582 (Class already exists). This prevents the COM object from being created on the second call to StartComObjects. I am not sure why this isn't working. Shouldn't CComPtr::Release free the COM object and allow me to create a new one after the old one was stopped? Is there any way to get around this?

    Read the article

  • How to free member (i.e BSTR, SAFEARRAY, VARIANT) of an IDL User Defined Structure which is encapsul

    - by Picaro De Vosio
    Hi, I have a structure defined in IDL. This structure has following members: { BSTR m_sFirst; BSTR m_sSecond; VARIANT m_vChildStruct; //This member encapsulate a sub structure SAFEARRAY __RPC_FAR * m_saArray; }CustomINFO; I am allocating the memory for the structs using CoTaskMemAlloc and encapsulating it in Variant as follows: vV-vt = VT_RECORD; vV-pvRecord = pStruct; //Pointer of sturct vV-pRecInfo = pRI; //RecordInfo Interface Is it enough to call VariantClear to deallocate the memory of struct and its members? Will it also release the IRecordInfo interface? Or i have to manually get the encapsulated struct and deallocate each member myself and then use CoTaskMemFree to deallocate sturct. Thanks Picaro De Vosio

    Read the article

  • Convert void* representation of a dword to wstring

    - by graham.reeds
    I am having dumb monday so my apologies for posting such a newbie-like question. I am using CRegKey.QueryValue to return a dword value from the registry. QueryValue writes the value into void* pData and the length into ULONG* pnBytes. Now there is a way of getting it from pData into a wstring probably via stringstream. The closest I came was getting the result as a hex string. I was about to work on converting the hex representation to a dword and then from there to a wstring when I decided that was just dumb and ask on here instead of wasting another hour of my life on the problem.

    Read the article

  • What language/compiler for native running of application in any windows platform?

    - by Xinxua
    Hi, I want to develop an application that runs on any windows platform (XP, Vista, 7) but does not require a dependency like .NET Framework or JVM. I have given the other requirements below: Runs in any windows platform Must have GUI libraries to create windows/primitive controls I also want the output file size of the application to be minimal (So cannot include .net frameword etc in the exe file) Any suggestions for this requirement?

    Read the article

  • What language/compiler for native running of application in any windows(XP/Vista/7) platform?

    - by Xinxua
    Hi, I want to develop an application that runs on any windows platform (XP, Vista, 7) but does not require a dependency like .NET Framework or JVM. I have given the other requirements below: Runs in any windows platform Must have GUI libraries to create windows/primitive controls I also want the output file size of the application to be minimal (So cannot include .net frameword etc in the exe file) Any suggestions for this requirement?

    Read the article

  • Problem using a COM interface as parameter

    - by Cesar
    I have the following problem: I have to projects Project1 and Project2. In Project1 I have an interface IMyInterface. In Project2 I have an interface IMyInterface2 with a method that receives a pointer to IMyInterface1. When I use import "Project1.idl"; in my Project2.idl, a #include "Project1.h" appears in Project2___i.h. But this file does not even exist!. What is the proper way to import an interface defined into other library into a idl file? I tried to replace the #include "Project1.h" by *#include "Project1_i.h"* or *#include "Project1_i.c"*, but it gave me a lot of errors. I also tried to use importlib("Project1.tlb") and define my interface IMyInterface2 within the library definition. But when I compile Project2PS project, an error is raised (something like dlldata.c is not generated if no interface is defined). I tried to create a dummy Project1.h. But when Project2___i.h is compiled, compiler cannot find MyInterface1. And if I include Project1___i.h I get a lot of errors again! Apparently, it is a simple issue, but I don't know how to solve it. I'm stuck with that!. By the way, I'm using VS2008 SP1. Thanks in advance.

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >