How to retrieve WM_COPYDATA message

I’m using Start process activity to launch an .exe file with some arguments but I’ve one argument called “-hwnd=YOUR SOFT’S WINDOW HANDLE”. I can’t figure out what is my Soft’s window handle?!!
It also supposed to send “WM_COPYDATA message” which will have information that i need to used it in my robot, But i can’t figure out how to retrieve this message ?!!

Any help is really appreciated.

Hello @Akio_Uchida

Can you please explain what application you are trying to open and what are the parameters you are trying to pass? Is that some kind of files?

Its locale .exe program and other arguments are working really good, I just want to know if there is an activity or something in UIPath to receive what is called “WM_COPYDATA message” from running exe programs !!

Hello @Akio_Uchida

Does that mean you are calling tha exe and it ill output some message? Can you try it with powershell once and you can use invoke powershell to achieve this.

First try it with cmd or powershell IDE and if its working move that to uipath.

But I’ve to pass my robot window handle to “-hwnd” argument !! How could i get window handle for my robot?!

Hello @Akio_Uchida,

to get the handle of your window you can use the activities Use Application and Get Attribute of UI Automation > Application. Open with the Use Application activity your window, get the Output Element property, in this example OutUIElement, and set this as Input Element in the Get Attribute activity, with which you can query the handle of the window.

As far as I know it is necessary, to catch a Window Message (WM), to add a hook to the target window main procedure. Hooking works on Windows API base, so I assume that an implementation in dotNET has to be done via the namespace System.Runtime.InteropServices and to call WinAPI functions. I do not know a UiPath standard activity for this.

Best regards

1 Like

Thnx for the detailed answer, can you help me to call API functions to handle WM message, please.
All i need is to pass my UIPath hwnd as an argument for .exe file, Then retrieve WM message to my robot to use it.

Hello @Akio_Uchida,
what is your business process which you want to automate? Can you give us more details.
You want to pass your UiPath hwnd. What UiPath window, from the Studio?
Best regards

I have an exe file which accept arguments one of these arguments is -hwnd. So i need to pass hwnd attribute of my UIPath window to this argument, then receive WM message to my UIPath workflow.

I have to ask again: What is your business process?
Right now it sounds to me more like a technical gimmick.