|
I have a problem that I'm trying to solve in the best possible way (arent we all;).
I am trying to make a browser extension in the form of a DLL that will automatically load with IE. Currently I have a solution in the form of an exe that, when run, loads IE instead of vice versa. Doing it this way I have complete control over IE, which is what my goal is.
However, I am wondering if it is possible (so far from what I've found it doesnt appear to be), to make a library that IE will load when IE itself is loaded. This library will then capture that instance of IE's process/handles/etc and capture the browsers events so the library can control the behaviour of the browser, and just "do stuff" in general on IE events. Using IWebBrowser2, DWebBrowserEvents, and all those good COM interfaces/objects, I already have it all working but only as a seperate exe process that I have to manually start-up.
Is this doable?
Are there registry keys you can enter in to make certain libraries load with IE? I know google toolbar loads up from a single DLL file. However I'm not sure if the DLL is actually loaded at IE startup or if its the standard "click a button on the toolbar to trigger a function in the DLL" (which, is easy to do). The toolbar itself is just a visual manipulation, making that visual representation of the toolbar is just a few registry keys really, which dont really do anything, they just point to a place (the DLL) that does. Like shortcuts to programs on the desktop.
Thanks in advance for any feedback or thoughts on this.
|
|
|
|
|
Take a look at Browser Helper Objects. These are loaded into IE when it starts up. There are many examples of customizing IE here on Code Project.
Andy
Deus caritas est
|
|
|
|
|
effeAF wrote: The toolbar itself is just a visual manipulation, making that visual representation of the toolbar is just a few registry keys really, which dont really do anything, they just point to a place (the DLL) that does. Like shortcuts to programs on the desktop.
here :-effeAF wrote: The toolbar itself is just a visual manipulation, making that visual representation of the toolbar is just a few registry keys really, which dont really do anything, they just point to a place (the DLL) that does. Like shortcuts to programs on the desktop.
http://msdn.microsoft.com/library/en-us/dnwebgen/html/bho.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
thanks for the replies, funny enough about 10 minutes after I made this post i ran across a BHO tutorial and a bunch of bells started ringing (and no, it wasnt the fire alarm).
i like that quote in your sig too alok. i sortof collect quotes, that one's worthy of my collection for sure
cheers again,
E
|
|
|
|
|
effeAF wrote: i like that quote in your sig too alok. i sortof collect quotes, that one's worthy of my collection for sure
feel Free to use that
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
We are encountering the following problem on the usage of the COM API CoMarshalInterThreadInterfaceInStream:
When this API is used with IConsole2 interface, the return value is "The interface is not registered". Is it possible to register the corresponding type library, which is implemented by MMC and not by us?
Thanx in advance.
URagav
Everything can be sacrificed for truth, but truth cannot be sacrificed for anything .
|
|
|
|
|
Hi !
I build 3 COM Servers(as a service, exe, and dll). we tested all the three for their performance. when we fire number of requests from remote machins(approximatly 100 requests, 10 requests per process, like such there are 10 process makin requests), every type of server behaved differently. Exe type COM server took almost 1 min 40 sec. Service type COM Server took almost 1 min 42 sec(appro same as exe server). But DLL type COM server took only 16 Sec. How this has happend. Can you explain the working of all these remote servers....
Is the object shared by the number of requesting clients?
|
|
|
|
|
hi All,
I want to integrate crystal reports into my MFC app. I have already done this using an Access db as a data source. But what I really want to do is to use an XML file as a data source. How do i do this?
I tried to modify the connection string:
// Connection String
_bstr_t bstrAccessConnect ( L"DRIVER={Microsoft Access Driver (*.mdb)};"
L"DBQ=Database.MDB;"
L"DefaultDir=;"
L"UID = admin ; PWD=;"
L"Mode=Read;");
but it didnt work. I have configured the ODBC dsn according to the CR XML v3.6 driver. It is correct because I can access the XML file as an ODBC dsn from the Crystal reports manually...So how do i do this in code???
PS: I hav Crystal Reports 8.5
|
|
|
|
|
Hi,
Generally In-Process Component(DLL) will be loaded in to client Process(EXE),so that marshaling is not requied between your client call and DLL.
I Have reffered many books, the DLL loads one place and it is shared by number of process this is how memory will be saved with DLL concept.
But in COM, each client process it should load.
how this situation will be handled ( means how the COM DLL will be called by number of Clients)??
could any body clarify me???
Thanks & Regards,
Siva Sankar
|
|
|
|
|
Actually the dll will be loaded once by the first client. Subsequent client will check if that dll is present in memory or not. If that is present then they will use the same dll rather then loading it again. All this is taken care by the O.S. The kernel32.dll will keep track of whether the dll is loaded or not. If it is loaded then it will set some flag so that when a request to load that dll comes it will check that flag and load it accordingly.
|
|
|
|
|
Hi Biswa,
Thanks for your reply,
Suppose if Client1.exe calls DLL it will load in to Client1.exe process, same will happen if Client2.exe calls the same DLL.
As per your reply DLL will be loaded in some common place,
Which process DLL actually loads, if this is different than Client1.exe,Client2.exe process then marshalling is requied to call those DLL methods...
As conclusion DLL should be loaded "Client1.exe" and "Client2.exe" processes,if not, could you please clarify me how this will be handled??
Thanks,
Siva
|
|
|
|
|
This is handled by memory paging. There will be only one copy of the dll in the physical memory. But both applications will be mapped to the same address space by paging. It does not mean that application A can write into the memory location of Application B and corrupt Application B. This vulnerability is prevented by a method called "Copy on Write ". Thus if application A needs to write into the data memory of the dll, then it will take a copy of it and modify that copy so that it wont affect Application B. Look for memory paging for more info.
rgds...mil10.
|
|
|
|
|
Hi,
I am a new COM learner, Can anyone Tell me the method of using an ActiveX component in a WIN32 project ? it says "MFC Class can only be added to MFC projects". I am using VS.net 2003.
Thanks in advance
kss
|
|
|
|
|
If its a vb6 COM dll then COleDispatchDriver is the best way to do it. Here it is how to do:
Right click on project in the class view
select Add from the context menu.
Click class
select MFC in the categories tree view,
select MFC class from type lib in the 'templates' listview
browse the type library of your vb component.
this will generate a COleDispatchDriver derived class for your vb com class.
look for COleDispatchDriver class to see how u can use the wrapper class generated by the wizard.
If it is an ATL vc++ COM dll then do #import typelib and use the smart pointers generatred.
rgds..mil10
-- modified at 17:27 Monday 13th February, 2006
|
|
|
|
|
I tried using the Follwing Method which u said but it returns me the same error "MFC classes can only be used with in a MFC projects".
Right click on project in the class view
select Add from the context menu.
Click class
select MFC in the categories tree view,
select MFC class from type lib in the 'templates' listview
browse the type library of your vb component.
this will generate a COleDispatchDriver derived class for your vb com class.
look for COleDispatchDriver class to see how u can use the wrapper class generated by the wizard.
I guess i have no Option left, i will do the #import typelib thing.
any ways thanks for the suggestion
kss
|
|
|
|
|
Better way is to use '#import "typelibraryfile" no_namespace' method, and then use smart pointers generated. Just compile your project with this #import statement. It will create two files(in debug directory). You can use those two files to get details about the interfaces and class ids.
- Malli... !
|
|
|
|
|
hi Malli...
Thanks i will try this out .
kss
|
|
|
|
|
Can some one help... I'm trying to acces a remote COM from local machine. I've a in-proc COM server (DLL), and want to acces it remotely. I was getting an error, when I tried with CoCreateInstanceEx(), i.e. "Class Not Registerd" from remote machine. so, I've exported (Registerd) it using 'Component Manager Snapp-in'. Right now I'm able to get the class access(because Class constructor gets called on remote machine), but it fails to get Interface pointer from class. And Interfaces implemented by class is also not shown in the snapp-in under 'Interfaces' Tag. Am I laggin somewhere? Is there any other way to do so? Please reply for the same.
Thanks for anykind of help...... !!
-Malli......!
|
|
|
|
|
Could you please try by registring the Proxy/Stub stuff on both machines...
Thanks & Regars,
Siva
|
|
|
|
|
Hi !
Thanks for answering, we did the same. we created proxy/stub dll and regeistered on both the machines. I would like to add one more query.
I build 3 COM Servers(as a service, exe, and dll). we tested all the three for their performance. when we fire number of requests from remote machins(approximatly 100 requests, 10 requests per process, like such there are 10 process makin requests), every type of server behaved differently. Exe type COM server took almost 1 min 40 sec. Service type COM Server took almost 1 min 42 sec(appro same as exe server). But DLL type COM server took only 16 Sec. How this has happend. Can you explain the working of all these remote servers....
Is the object shared by the clients?
- Malli... !
|
|
|
|
|
Need bit clarification..
How did you access the DLL from Remote machine,
Did you run as a Surrogate process in Remote server ?? or you registered(copied) the source DLL to client machine..
Thanks,
Siva Sankar
|
|
|
|
|
Hello Siva !
Actully I've registerd the proxy/stub dll. And using MMC-Component Services, I put that COM dll into COM Applications. this would make your COM dll to be used from remote machin. (this inturn make use of DLLHOST.exe as a surrogate). This is what the scenario....
-Malli...!
|
|
|
|
|
while (pEnumerator)
{
HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
&pclsObj, &uReturn);
if(0 == uReturn)
{
break;
}
VARIANT vtProp;
VariantInit(&vtProp);
hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0);
if(vtProp.bstrVal = "Alerter")
{
MessageBox(NULL,"AlerterService ",NULL,NULL);
}
wcout << vtProp.bstrVal << endl;
hr = pclsObj->Get(L"state", 0, &vtProp, 0, 0);
wcout << vtProp.bstrVal << endl;
}
iam using this code in an application using WMI .but when i compiling iam getting error
error C2446: '==' : no conversion from 'char *' to 'unsigned short *'
can u please suggest me how to overcome this problem
abhi
|
|
|
|
|
Hello Abhi !
One thing I noticed is that you put '=' instead of '==' in if condition. And if you wanna to convert a unsigned shor * to char *, there is a simple way using CComBSTR class:
CComBSTR tmp;
tmp.Append("SomeTextHereToAppend");
YourBSTRObject = SysAllocString(tmp.operator BSTR());
You can use YourBSTRObject to compare with another BSTR object. that will help to avoid this conversion while comparision.
-Malli......
|
|
|
|
|
thanks malli
i have one more doubt
when i execute thhis query
hres = pSvc->ExecNotificationQuery(
bstr_t("WQL"),
bstr_t("SELECT * FROM __InstanceCreationEvent WITHIN 5 WHERE TargetInstance ISA 'Win32_Process' And (TargetInstance.Name = 'notepad.exe' OR TargetInstance.Name = 'calc.exe' ) "),
WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
NULL,
&pEnumerator);
i get the output stored in pEnumerator.
now how to extract data from pEnumerator . whether itis
hr = pclsObj->Get("Name", 0, &vtProp, 0, 0);
or
hr = pclsObj->Get("TargetInstance.Name", 0, &vtProp, 0, 0);
where Name is the property of Win32)process class
Thanks In advance
Regards
Abhi
abhi
|
|
|
|