|
|
Hi Sohail,
Thanks for the reply.. I will check them now.
|
|
|
|
|
Code Project is the best option for u ...select com as a beginner and u will fine some codes and basic knowledge of com ...andu may also search softlookup.com ....
|
|
|
|
|
Did you see Com on CodeProject
|
|
|
|
|
Open MSDN
Goto 'Search' Tab
Search for 'COM'.
Read 'From CPP to COM' first.
|
|
|
|
|
Hi all,
I am writing a COM server program. In that I created a interface "MyIDL". Here is the source.,
import "Unknwn.idl";
//My Interface
[
object,
uuid(E0985393-CD6E-4a1f-8737-C250238FC8FC),
helpstring("My Interface"),
pointer_default(unique)
]
interface IX : IUnknown
{
HRESULT Function([out]char *str)=0;
};
When I compile I am getting these errors.
1] error MIDL2311 : statements outside library block are illegal in mktyplib compatability mode : [ Interface 'IX' ]
2] error MIDL2096 : duplicated attribute : [helpstring] [ Interface 'IX' ]
3] error MIDL2096 : duplicated attribute : [uuid] [ Interface 'IX' ]
How can resolve this? I know these questions might be silly. But please anybody help me. So that I could learn COM Components.
|
|
|
|
|
Doesn't this[^] reply satisfy your answer?
|
|
|
|
|
No.,
You told you have to try on COM forum. Thats why I came here.
I tried as you said. That is working . Fine
Thanks.
|
|
|
|
|
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
|
|
|
|