How to pass/access Window Handle from Client app to COM Server (DCOM exe)

I am having one C++ Client application and created a DCOM service.

Inside a Client application - created a window. Inside a DCOM server exe, I wanted to use this client created window and use it for purpose.

I tried to pass the HWND from Client to COM server -- for this since HWND param is not allowed at Server end, I used LONG insted. I able to receive same pointer reference, what is sent at client app.

But If I check IsWindow(hwnd) --- I got FAILURE here.

If, I try to use FindWindow("myWindow") inside COM Server code -- still I am not able to get appropriate Window handle.

Can someone pl. tell me, what is the way to access / pass Window handle from client app to COM Server exe ?

Thanks in advance.
Who is Participating?
jkrConnect With a Mentor Commented:
That whole idea won't work - services run on an invisible (hidden) desktop, (see - "INFO: Services, Desktops, and Window Stations"), and a window handle from the logged on user's desktop is meaningless in that context.
you could do p2p between the client and the server (service). normally the client would send a request to the service (for example via sockets or via shared memory) or would connect to service. then the service could respond or send data to thread of the client which then could be displayed by the client's main ui thread asynchronously.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.