|
hi
I am not sure but have look at RegisterShellFileTypes()
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
The most common format for the explorer is the combination of RegisterClipboardFormat(CFSTR_FILECONTENTS) and RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR). These formats tells the explorer what filename to use and to render data from a storage (IStream). The IStream can render any data-format you want. For small data you can also use a HGLOBAL memory block to render your data-format.
To realize this - you have to implement your own IDataObject at least.
|
|
|
|
|
|
hy everybody,
i really have a strange problem, and i hope that this very nice forum can help me out another time.
So what i have is a very simple com dll, if followed this article to build it: COM-DLL
my prroblem is, when e have a function like this:
[id(5), helpstring("method test2")] HRESULT test2([out,retval] BSTR* str);
i want to return more Parameters with the [out,retval], not only a BSTR* maybe a sequence or an array would be nice! In my Project i have to return 20 Strings to the Client who is using this dll, how does this work?
maybe something like this:
[id(5), helpstring("method test2")] HRESULT test2([out,retval] BSTR* str[20]);
I dont know or passing a sequence or an struct as a return Parameter?
Or what about this VARIANT* Types how does this work?
[id(5), helpstring("method test2")] HRESULT test2([out,retval] VARIANT* );
Please could someone explain it to me, i really need this asap...
Really, thank you in advance,
greetz
Balu
|
|
|
|
|
You could describe a structure in IDL and use that as an out parameter.
Steve
|
|
|
|
|
Yeah that was my idea too, but how could i do this, i try it that way:
interface Idatamng : IDispatch{<br />
struct PM<br />
{<br />
BSTR var1;<br />
BSTR var2;<br />
}<br />
[id(1), helpstring("method get_orderids")] HRESULT get_orderids([out,retval] PM* pm_inst1); <br />
};
But this is not working! Also with an Typedef it is not working:
interface Idatamng : IDispatch{<br />
struct PM<br />
{<br />
BSTR var1;<br />
BSTR var2;<br />
}<br />
typedef PM pm_def<br />
[id(1), helpstring("method get_orderids")] HRESULT get_orderids([out,retval] pm_def* pm_inst1); <br />
};
So i dont know how to build a structure in IDL, could you help me please!
greetz
Balu
|
|
|
|
|
Ok something has changed and a new error occured ok the following is working, it is compiling, that should be the right description:
<br />
interface Idatamng : IDispatch{<br />
<br />
typedef struct _MYPM<br />
{<br />
BSTR id1;<br />
BSTR id2;<br />
}MYPM;<br />
<br />
[id(6), helpstring("method test3")] HRESULT test3([out,retval] MYPM* peter);<br />
};<br />
This is the code from the idl file, and he compile it!
But now i try to access the struct from the cpp file of the class:
<br />
STDMETHODIMP Cdatamng::test3(MYPM* peter)<br />
{<br />
<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState());<br />
<br />
<br />
peter->id1 = CComBSTR("Test");<br />
return S_OK;<br />
}<br />
if peter->id1 = CComBSTR("Test"); a constant string everything is fine, test it with a small vb app it gave me the string back to the client, but if i try to hold this parameter flexible by an variable of the class, for example orderid which is an array it fails:
<br />
STDMETHODIMP Cdatamng::test3(MYPM* peter)<br />
{<br />
<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState());<br />
<br />
<br />
peter->id1 = orderid[0];<br />
return S_OK;<br />
}<br />
So the vb test app, returns a System.NullReference!
I dont know why he is not able to get the string back from the DLL.
I hope someone can help me on this topic!
Thanks for everything
greetz
Balu
|
|
|
|
|
id1 is a raw BSTR, you can't just copy it using = . Try Something like this:
peter->id1 = SysAllocString(orderid[0]);
Steve
|
|
|
|
|
I have to play a movie using DirectX from a URL. But the IGraphBuilder interface accept only file name. Can I use a file name as URL ( i.e play movie from a webserver)
|
|
|
|
|
There's no DCOM related services in my Win2k Server, and I added all the components it in 'add/remove' but DCOM services still no where to be seeing. Is anybody konws how to add it?
|
|
|
|
|
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
|
|
|
|