1. Tracy Lamb
  2. PowerBuilder
  3. Tuesday, 31 May 2022 16:01 PM UTC

Hi all,

I'm still re-working a lot of my old code.  My application supports DDE for communication with 3rd party Instrumentation software mostly written in LabView (ACPs).  All of the commands are at the window level in the original code. I'm moving to PFC tab objects with u_dw controls.  I appears that I can turn the DDE server on and off from the u_dw control (StartServerDDE and StopServerDDE).  But I can't seem to get the other DDE commands to work... remotesend, remoterequest and remoteexec.)  

Only the Window object has events for remotesend, remoterequest and remoteexec.  I tried sending events to the u_dw from the window.  The ACP just hangs and I have to use Task Manager to close it.

Any thoughts?

~~~Tracy

John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 1 June 2022 02:55 AM UTC
  2. PowerBuilder
  3. # 1

Hi, Tracy - 

The DDE-related events (HotLinkAlarm [pbm_ddedata], RemoteExec [pbm_ddeexecute], RemoteHotLinkStart [pbm_ddeadvise], RemoteHotLinkStop [pbm_ddeunadvise], RemoteRequest [pbm_dderequest], RemoteSend [pbm_ddepoke], along with pbm_ddeack, pbm_ddeinitiate, & pbm_ddeterminate) are PB's reflections of DDE events issued by the Windows O/S (Message ID's WM_DDE_ACK, WM_DDE_ADVISE, WM_DDE_DATA, WM_DDE_EXECUTE, WM_DDE_INITIATE, WM_DDE_POKE, WM_DDE_REQUEST, WM_DDE_TERMINATE, & WM_DDE_UNADVISE).

These Windows O/S event messages are issued to/from client windows, not controls residing within windows. There likely isn't anything you can do to change this behavior, but I think you can extend the behavior to do what you're wanting.

If you want a tab control, a DataWindow control or other control to respond to DDE messages, I suggest you consider creating a DDE window service NVO, in which you register a reference to a DragObject (control) that will ultimately receive the DDE messages. In the NVO, you create user events mapped to each of the pbm_ddexxxxxx events, and in each one, trigger a similar event that has been added to the customized control (u_dw, u_tab, etc.). In the window (w_master, or w_sheet, for example) add a function to create/destroy the DDE service NVO object and code in the window's DDE events that checks if the service NVO exists and if so, triggers the event in the registered DragObject.

This may sound overwhelming, but it's pretty easy. Since you're using the PFC, this is the technique the PFC uses to instantiate and manage service objects... so you can look at existing PFC service objects as a guide to see how they're coded.

None of the pbm_ddexxxxxxx events has argument values, which simplifies things. If you trigger the custom DDE user event added to u_dw, for example, you can do with the PowerScript TriggerEvent function, such as: dw_1.TriggerEvent("ue_ddeexecute"). An advantage of this technique is that if the object does not contain the ue_ddeexecute event, the TriggerEvent function fails silently with a return code of -1. You can't pass event arguments using the TriggerEvent PowerScript function, which makes it ideal for this particular scenario.

Regards, John

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 31 May 2022 16:15 PM UTC
  2. PowerBuilder
  3. # 2

Hi Tracy;

    Absolutely!   :-)

I just released this DDE example recently ... Check this out:

http://chrispollach.blogspot.com/2022/04/dde.html

HTH

Regards ... Chris

Comment
  1. Tracy Lamb
  2. Tuesday, 31 May 2022 23:54 PM UTC
Thank you Chris.... I downloaded the example you sent and ran it, works fine. But, I'm not seeing a tab folder or a dw control, just sle controls. All of the DDE commands in the example are window-level events, just like my old software.

~~~Tracy
  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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.