|
Currently, I have a COM event which I've created a sink for and all of that jazz. It receives events at the Invoke method of course. Then i use dispIdMember to figure out which event was called. The only problem is that the event is fired from a different thread as the rest of my program, which poses a huge problem. Is there a way that I can call a function on threadA from threadB?
|
|
|
|
|
Has anyone tried to intercept Windows Explorer (drive/directory) tree view events capture?
I want my extension dll to know when the user expands a folder in the tree view of explorer.
Is there any way of doing that?
Thanks in advance.
|
|
|
|
|
I found the solution.
Create an atl com project. Insert "Internet Explorer Object".
Do the usual stuff for a BHO.
Implement two methods:
Invoke() and SetSite().
Then in Invoke, capture the DISPID_NAVIGATECOMPLETE2 event.
This runs when user has just changed from one location to another. Find the new location. If it is a local drive etc, then we have it. It does not catch the folder expand, but does catch the event when a folder is opened even in the tree view of explorer.
Thanks for reading.
|
|
|
|
|
I am currently writing a program in C++ which uses the iTunes COM interfaces from the iTunes COM SDK (http://developer.apple.com/sdk/itunescomsdk.html). I have found it easy to use IiTunes (CoInitialize(NULL); CoCreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER, IID_IiTunes, (PVOID *)&iITunes);), but using _IiTunesEvents poses some adversity. I would like the OnAboutToPromptUserToQuitEvent to call a function where I can run some cleanup code. How can I implement _IiTunesEvents? I am used to C# where I can use += easily, but it is my understanding that COM requires sinks and things of that sort.
I want to have something like this:
IiTunes *iITunes = NULL;
//make object bla bla bla
??????????(OnAboutToPromptUserToQuitEvent);
.....
HRESULT OnAboutToPromptUserToQuitEvent()
{
.....
}
Thanks,
Jason A. Donenfeld
ZX2C4 Software
|
|
|
|
|
|
thanks so much. ill read through that.
any sample code?
|
|
|
|
|
This is what I have currently:
HRESULT hres;
DWORD d;
IConnectionPoint * icp;
IConnectionPointContainer * icpc;
hres = iITunes->QueryInterface(IID_IConnectionPointContainer,(PVOID *)&icpc);
hres = icpc->FindConnectionPoint(DIID__IiTunesEvents,&icp);
eventSink = new ITunesEventSink();
hres = icp->Advise((IUnknown*)&eventSink,&d);
and then
class ITunesEventSink:public _IiTunesEvents
{
public:
HRESULT OnAboutToPromptUserToQuitEvent();
};
The only problem is that "error C2259: 'ITunesEventSink' : cannot instantiate abstract class" Well duh, I need to impliment all of the virtual functions, but does that mean looking at the header files containing IDispatch and IUnknown and then copying in all of those function names and then giving functionality to them? If so, what is the best way to go about implimenting the functions?
|
|
|
|
|
alright. i implimented the ITunesEventSink and now i have OnAboutToPromptUserToQuitEvent being called; however, it calls it on the wrong thread. Is there way that i can call a function from a different thread?
|
|
|
|
|
Hello,
I have created one ActiveX Dll using VB and I am using Data Access Components 2.5.
After deploying this COM components I could access it through ASP Pages.
Everything goes well in development environment but in Production Environment we are installing MDAC 2.7.
And components are not working.
So I would like to confirm whether MDAC 2.7 installtion program includes MDAC 2.5. And my ActiveX dll having reference to the "Activex Data Access component 2.5" is suppose to work or not.
Thanks
Mitesh
|
|
|
|
|
MDAC 2.7 is definitly not new, I have been using it for at least a year, probably 2 or 3. I have not noticed any kind of problem with backward compatibility.
[EDIT]
MDAC 2.8 is the latest version. It was first introduced in 8/4/2003 so I guess I have an old version...
[/EDIT]
John
|
|
|
|
|
How to fix (custom ActiveX)control size in design time.
I am using MFC ActiveX ControlWizard.
Please help me.
Thanks
David Park
|
|
|
|
|
hi
I am writing an IDispatch client. i want to call this method
void SomeMethod(
[in, out] BSTR* strFile,
[in, out] BSTR* strMiscFile,
[in, out, optional, defaultvalue("Some Default value")] BSTR* strValue
);
using IDispatch::Invoke. I have got DISPID of this method using GetIDsOfNames, the problem is in making DISPPARAMS for this method that can be passed to Invoke.
does any one know how do we prepare DISPPARAMS for such type of methods as mentioned above.
Thanks in anticipation
Azam
|
|
|
|
|
CComBSTR strFile, strMiscFile, strValue;
VARIANTARG* rgvarg = new VARIANTARG[3];
V_VT(&rgvarg[2]) = VT_BSTR | VT_BYREF;
V_BSTRREF(&rgvarg[2]) = &strFile;
V_VT(&rgvarg[1]) = VT_BSTR | VT_BYREF;
V_BSTRREF(&rgvarg[1]) = &strMiscFile;
V_VT(&rgvarg[0]) = VT_BSTR | VT_BYREF;
V_BSTRREF(&rgvarg[0]) = &strValue;
DISPPARAMS dispparams = { rgvarg, NULL, 3, 0 };
With best wishes,
Vita
|
|
|
|
|
hi Vita
Thank you very much for solving my problem. One thing i would also like to ask if you donot mind, how do we pass named parametrs to a function. lets say if the function is same as mentioned in my previous question i.e
void SomeMethod(
[in, out] BSTR* strFile,
[in, out] BSTR* strMiscFile,
[in, out, optional, defaultvalue("Some Default value")] BSTR* strValue
);
then how do v prepare DISPPARAMS for this function using named arguments?
thanks in anticipation
Azam
|
|
|
|
|
|
Thanks once again. i will read this article. may i distrub u if i need some help in between
regards
Azam
|
|
|
|
|
Hello, I`ve got a problem with opening excel woorbook using this code.
I`ve got office xp 2002 with sp3.
On one computer i dont have this problem, but on the other one appears exception.
object mis = System.Reflection.Missing.Value;
Excel.Application excel = new Excel.ApplicationClass();
Excel._Workbook wkb = excel.Workbooks.Add(mis);
Excel._Worksheet sht = (Excel._Worksheet)wkb.Sheets[1];
I did add reference to excel 10. TypeLib version 1.4
This is the exception i`ve receive.
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in SqlToExcel.exe
Additional information: Old libary or incorect form.
(Biblioteka w starym formacie lub nieprawidłowy typ biblioteki).
I dont now what to change in the code.
Please, help meeee.
|
|
|
|
|
i remember reading an article but i can't remeber where now, how can i use a COM dll in C (not create a COM object in C, just be able to call some functions)
thanks
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
A COM DLL is a regular DLL with some restrictions on it: It must export the 5 functions DllMain , DllCanUnloadNow , DllGetClassObject , DllRegisterServer and DllUnregisterServer . Technically, the last function isn't really needed to run COM stuff, but if you want to uninstall the COM DLL, it's nice to be able to remove references to it in the registry.
To load a DLL:
HMODULE hDLL = LoadLibrary(_T("the.dll"));
if(!hDLL) exit(-1); To acquire a function pointer to a function inside the DLL:
void (*function)();
function = (void (*)())GetProcAddress(hDLL, "TheNameOfFunction");
if(!function) exit(-1);
function(); And finally, if you are done with the DLL, and you wish to unload it, call
FreeLibrary(hDLL); There's also LoadLibraryEx which might be interesting to have a look at.
Did I answer your question? The MSDN Library has all the information you need to manuall load and use DLLs.
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
My name in Mandarin/Kanji is 乔尔根 西格瓦德森.
My name in Korean is 요르겐.
I blog too now[^]
|
|
|
|
|
yes by using the above stuff i can create an object
how will i call the interface methods and all the vtbl stuff
thanks for such a neat reply very well explained thanks
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Ah, you meant COM object methods, and not functions exported by the DLL. I see. In that case: what Mike said.
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
My name in Mandarin/Kanji is 乔尔根 西格瓦德森.
My name in Korean is 요르겐.
I blog too now[^]
|
|
|
|
|
You use CoCreateInstance as before. To call an instance method, you need the header file generated from the source IDL by midl . Instead of writing, for example
p->GoForward() you would write
IWebBrowser_GoForward(p) That is, you prefix the call with the name of the interface and pass the object as the first parameter of the call. IWebBrowser_GoForward is actually a macro that masks the explicit dereference:
p->lpVtbl->GoForward(p) I'd seriously query why you're using it from C, though - it's perfectly possible to make a hybrid C/C++ app where some modules are compiled as C and others as C++.
[EDIT:] On re-reading the ExDisp.h header file (just an example, it contains the IWebBrowser interface I referred to earlier) it looks like you only get the interface_method macros if you define COBJMACROS . [/EDIT]
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
thanks that's a good insight
i agree the c/c++ hybrid application is the best way to go about it, i just want to have enough info on the subject before i start convincing them
that it is a bad and time consuming idea
thanks for reply
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Hi!
I have observed that when a COM object is created its QI method is called for the following interfaces:
1. IUnknown
2. IMarshal x2
3. {0000001B-0000-0000-C000-000000000046} (IdentityUnmarshal ??)
4. IUnknown
5. ISdtMarshalInfo
6. IExternalConnection
7. {4C1E39E1-E3E3-4296-AA86-3C938D896E92}
8. IManagedObject
9. IConnectionPointContainer x2
10.{1C73A30-2A1C-11CE-ADE5-00AA0044773D}
11. IFeed (this is my interface)
12. {1C73A30-2A1C-11CE-ADE5-00AA0044773D}
13. IFeed
Could any of you explain where these calls come from?
Could be SCM doing his things? Proxy/Stub related?
Thanks in advance
Gizzo
|
|
|
|
|
Simple OOPS concept of Construction and Destruction
Ifeed Derived From IConnectionPointContainer which from IManagedObject from IExternalConnection from iSdtMarshalInfo with Super One IUnknown
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|