1. C K
  2. PowerBuilder
  3. Monday, 23 October 2023 17:19 PM UTC

Hello,

I run .NET application from powerbuilder application, and send window's hadle as parameter from window's function, so:

via RUN("NETAPP.EXE "  + String(Hanlde(this)))

in .netr application, I send message by SendMessageA function, the handle who that was got as parameter.

the message number = 1024, and pbm_custom event isn't triggered, only pbm_other.

Thanks,

Chava.

Arnd Schmidt Accepted Answer Pending Moderation
  1. Wednesday, 25 October 2023 23:42 PM UTC
  2. PowerBuilder
  3. # 1
Comment
  1. Roland Smith
  2. Thursday, 26 October 2023 12:36 PM UTC
The WM_NOTIFY message I mentioned in that post cannot be used between two processes.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 25 October 2023 14:34 PM UTC
  2. PowerBuilder
  3. # 2

Even if you were able to get the event to trigger correctly, you can't send a string from one EXE to another. The string is sent as an address within the EXE memory space which isn't readable by another EXE.

Use my Winsock object. The PB app can wait on a port for the message sent by the external EXE. The C# app can use Winsock functionality built into the .Net Framework.

https://www.topwizprogramming.com/freecode_winsock.html

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 25 October 2023 10:09 AM UTC
  2. PowerBuilder
  3. # 3

Where is your custom event defined? I vaguely remember I had a similar problem when using a drag and drop DLL from Arnd Smith. I wouldn't work on a user object, only on a window, or vice versa. Sorry I don't fully recall. In any case, it would be a bug in my opinion.

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Monday, 23 October 2023 17:49 PM UTC
  2. PowerBuilder
  3. # 4

What is the PB app doing immediately after the Run() function to start the .Net app is called? I ask because Run() does not wait for the app that is being started to finish.

Just as an experiment, try issuing the PostMessageA WinAPI function from the .Net app instead of SendMessageA.

If the PB application is an MDI app, then you might try send/post the message to the MDI window, just to see if you can get the one-way notification working.

Comment
  1. C K
  2. Tuesday, 24 October 2023 18:31 PM UTC
Hello,

After run commamd, application print DW, and open WPF window to print it too. ( I want the .Net app doesn't wait, Run fuction it is my way to run two proccess at the same time, do you have another solution to do it?)

I tried PostMessage and still pbm_custom event isnwt trigger. only pbm_other trigger.

thanks,

Chava
  1. Helpful
  1. John Fauss
  2. Wednesday, 25 October 2023 02:38 AM UTC
Have you called the GetLastError API to see if the SendMessageA or PostMessageA function calls raised an error? I believe the PB Run() function calls the CreateProcess or CreateProcessEx WinAPI functions under the covers, so it is possible that there is some security feature in Windows that is blocking the message from being sent. The remarks section in the documentation for SendMessageA states that a message (event) can be blocked by UIPI (User Interface Privilege Isolation) and if this occurs, GetLastError will return an error code of 5 (access denied).

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessagea

The following link describes UIPI:

https://en.wikipedia.org/wiki/User_Interface_Privilege_Isolation

To summarize, it may not be possible to do what you are attempting. I suggest you seriously consider Roland's suggestion to use Windows Sockets.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.