|
Sakthiu wrote: No.,
Why ? Why you want go with the option that is obsolete ?
Sakthiu wrote: You told you have to try on COM forum. Thats why I came here.
Its always better to post in respective forums. That stops people annoying, you get quick and expert's input.
Sakthiu wrote: I tried as you said. That is working . Fine
|
|
|
|
|
My problem describes as follows:
A server module fires events through its COM interfaces.
For that the pointer to the interface is retrieved by GetInterfaceFromGlobal().
m_CPMTCritSec.Lock();
LPUNKNOWN pUnk = NULL;
DWORD dwGITCookie = (DWORD)(m_vec.GetAt(nConnectionIndex));
if (dwGITCookie != NULL)
{
IID iid;
GetConnectionInterface(&iid);
HRESULT hr = m_pGIT->GetInterfaceFromGlobal(
dwGITCookie, iid, reinterpret_cast<void **="">(&pUnk));
ATLASSERT(hr == S_OK);
}
m_CPMTCritSec.Unlock();
The client implements event dispinterfaces (IDispEventImpl) and establishs with DispAdvise() connections with the event sources.
When software starts up client and server are created, the server starts to fire events
and the client establishs connections and receives the events.
That works in most cases fine. But some times (10%) the software hangs.
The problem occurs always at the same situation:
the server is firing events and trys to get the interface pointer with GetInterfaceFromGlobal()
while the client trys to connect with DispAdvise().
|
|
|
|
|
I assume your client sits in an STA, so both client and server try to get to the same apartment and are locked out. You should not use a critical section in an STA!
|
|
|
|
|
Thank you for your reply! Unfortunately I forgot to mention that client and server are two different processes. So this couldn't be my problem.
|
|
|
|
|
I'm afraid this is still probably your problem. GetInterfaceFromGlobal must access the source apartment to create the required proxy.
|
|
|
|
|
Can you please explain my this a little more in detail ? I have a clue what you are meaning but I don't understand it exactly. The server access the client STA to create the proxy but what is the client doing exactly ? And where I shouldn't lock ?
|
|
|
|
|
I'm not sure exactly why you do things the way you do.
If the client calls DispAdvise, then why does the server go to the GIT? The server in this case receives a proxy for the client automatically, and should simply fire its events.
Can you please clarify?
|
|
|
|
|
Yes, you are right. During Advise we receive a valid pointer to the proxy object. But we fire events from other threads so we store all pointers in GIT.
|
|
|
|
|
I've read a few articles here on how to create shell extentions.
There is one question that I still havent found a answer for, so I hope someone here can help me out.
Is there any way at all to intercept file deletions? When using normal file-dialogs or the explorer gui and you click "delete" on a file (either by the delete-button or by using the icon in the toolbar). The usual "Do you want to move abc.txt to the recycle bin" appears. Now, is there any way to intercept the delete command and display a custom delete dialog? So far I've only come across examples that capture the event _after_ the file has been deleted, which in my case is waaay to late.
Now why do I want to do this? I'm writing a application that syncs selected files to a network drive. But if a user changes a file and happen to delete the file (by misstake) before the file has been synced. I want to show a custom dialog warning the user that the file havent been synced yet...
|
|
|
|
|
I think you need Copy Hook Handlers[^]
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Copy Hook Handlers seem to be the trick.. Until you notice that they only work for folders and not for files
|
|
|
|
|
How about SHChangeNotifyRegister, FindFirstChangeNotification/FindNextChangeNotification or ReadDirectoryChangesW
I had actually done this hooking but it's been more than three years now so I don't really recollect how I did it. all I remember is using some of the above API's
Let me know if this helps
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Dear All,
I need to develop COM Component. I know the basics of COM functionality.
But I dont know how to develop an interface for my program.
Can anybody help to develop that interfaces ?
bye
|
|
|
|
|
I would argue that if you don't know how to make a COM interface you don't know the basics of COM. Interfaces are the cornerstone all of COM is build from.
That said, the normal starting point (in C++) is to create an .IDL file that describes your interface. This file is then compiled by MIDL which creates the type library and header files which you consume using C++. Your IDE will be able to do some of this work for you.
Steve
|
|
|
|
|
plz search the link
http://codeproject.com/com/
and in this site u got various projects and when u study it than u know how to make com interface ...it is really very easy to make com interface ...just go to this site
|
|
|
|
|
If you see Com on codeproject you can find your answer.
|
|
|
|
|
Please help me.
My problem is that I developed a COM component. I can use
REGSVR32 c:\COMDLL\AuthEngineCOM.dll
to register the COM in a computer which has Microsoft Visual Studio .NET 2003. But when I use
REGSVR32 c:\COMDLL\AuthEngineCOM.dll
in a computer without Microsoft Visual Studio .NET
a error appear:
LoadLibrary ("c:\COMDLL\AuthEngineCOM.dll") failed - The specified can not be found.
Could somebody tell me which dependence that I missing?
Thanks,
William
William
|
|
|
|
|
Hi
You just copy your dll file "AuthEngineCOM.dll" and paste it into C:\\WINDOWS\System32\
After that try Run->regsvr32 AuthEngineCOM.dll
bye
|
|
|
|
|
Hi,
I have Visual Studio 2005 and my regsvr32 also fails with the message "testdll.dll was loaded, but the DllRegisterServer was not found".
I have copied it to the Windows/System32 folder as well.
Kindly help me out here.
Thanks
|
|
|
|
|
Hi
Every Dll file should contain DllRegisterServer Function.
Here your Dll file test.dll might not have that DllRegisterServer Function inside.
If so you can not register that file through RegSvr32.exe .
|
|
|
|
|
DllRegisterServer is one of the key function that needs to be implemented in a COM server (.DLL). This function needs to be exported from this DLL.
Please check if you have exported this function from your DLL. Also, you can use Dependency Walker[^] to see the dependencies of your DLL as well the functions that are exported.
I hope this helps. Let me know if you need more information.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
At a guess you've built using the dll runtime and it's not present on the machine. Use a dependency viewer on the target machine and make sure all the DLLs you're component depends on are present. One can found here[^].
Steve
|
|
|
|
|
You can use Dependency Walker [^] to see the dependencies of your DLL. You can find the missing dependencies using this.
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hi William,
try to use depend.exe with your dll in order to find the missing dependecy.
Cheers Carlo
|
|
|
|
|
Hi
I think the problem is the COM (dll) dependencies, maybe your COM has references to another dll that doesn't not exist in target pc.
You can see referencias with Dependency Walker (Visual Studio Tools)
David Leyva
|
|
|
|