1. Olan Knight
  2. PowerBuilder
  3. Monday, 7 June 2021 20:31 PM UTC

PB2019R3
Pbc12.1

The PBv12.1 code is a separate EXE called from the PB2019 app using the RUN command.
The PBv12.1 code starts and gets the Windows Handle of the calling window.

What I want to do is to cast the Handle into a datatype so I can directly reference the calling window and its contents.

Is that possible? If so, how?


Thank You,

Olan

Roland Smith Accepted Answer Pending Moderation
  1. Monday, 7 June 2021 20:50 PM UTC
  2. PowerBuilder
  3. # 1

You can't access PB objects between two programs. You can only send short string messages and numbers using the method in my other answer.

If you want to pass larger data including blobs, you will have to use Winsock.

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

 

Comment
  1. Olan Knight
  2. Monday, 7 June 2021 21:01 PM UTC
Shucky darn and phooey.

Is there a way to use WM_NOTIFY to communicate?



Thanks,

Olan
  1. Helpful
  1. mike S
  2. Monday, 7 June 2021 23:52 PM UTC
you can also store /pass data in: registry, data files, database, ...
  1. Helpful
  1. Roland Smith
  2. Tuesday, 8 June 2021 12:18 PM UTC
Building on Mike's comment, you could write everything to a file and pass the file name or you could store the info in a table created just for this purpose and pass the primary key of the row.
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 7 June 2021 20:46 PM UTC
  2. PowerBuilder
  3. # 2

Add this external function to the background program:

Function long SendStringMessage ( long hWnd, uint Msg, Ref string wParam, ulong lParam ) Library "user32.dll" Alias For "SendMessageW"

 

Arg1 - The handle of the window that will receive the message

Arg2 - The event on the window that will receive the message

Arg3 - The string message

Arg4 - A number to pass or zero if not needed

 

 

On the foreground program's main window, you will have to add a pbm_custom## event. The message number passed to SendStringMessage will be 1023 + the pbm_custom number. For example, pbm_custom01 will be 1024, pbm_custom02 will be 1025, and so on.

In the custom event, add this:

String ls_msg

ls_msg = String(wparam, "address")

 

The message sent from the background program should be in ls_msg.

 

Comment
  1. Olan Knight
  2. Monday, 7 June 2021 21:04 PM UTC
Fabulous! Thank you, Roland!
  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.