1. Tracy Lamb
  2. PowerBuilder
  3. Wednesday, 7 June 2023 15:18 PM UTC

Hi all,

I have a custom user object I designed 20+ years ago to communicate with a serial port, uo_comport.   The object has several local external functions defined.  All of the functions are from the Windows user.exe library.  Here's an example of one of the function declarations:

FUNCTION int OpenComm(string IpcomName,int wInQue, int wOutQue) LIBRARY "user.exe" alias for "OpenComm;Ansi"

I'm trying to just import the object from PB2019 into my PB2021 app. It regenerates fine, and I can open it and look at the code.  But keep getting the following error when I'm running the application from the IDE:

uf_open, Line 14 is:

ii_ComID = OpenComm(as_com_port,ai_InBuffer_Size,ai_OutBuffer_Size)

I'm wondering if I should be using a different library? Maybe "user32.dll" ?  I really don't want to re-write all the code if I can avoid it.

I'm using PB2021, Build 1509 and Windows 10.

TIA,

~~~Tracy

Accepted Answer
Tracy Lamb Accepted Answer Pending Moderation
  1. Friday, 9 June 2023 11:37 AM UTC
  2. PowerBuilder
  3. # Permalink

Thank you Roland, Chris and John,

Chris, I found the 2 examples provided in the link especially helpful.  It turns out, my customer hasn't used the built-in worksheets in many years!  It's been a very long time since I've upgraded this customer's software, and when I asked the customer which "worksheets" they were using, she told me the Pin Gages and the Gage Blocks, so I was trying to update both of those worksheets.  Turns out they're using the ACPs I wrote in LabView almost 20 years ago, Pin Gage ACP and Gage Block ACP, not the worksheets. Tragically funny miscommunication!!!  In the meantime, I will save the examples I got in the unlikely event I need to try to resurrect something that uses the Serial portin the future.

~~~Tracy

 

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 7 June 2023 17:49 PM UTC
  2. PowerBuilder
  3. # 1

User.exe is 16bit so Windows 98 timeframe.

Take a look at this:

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-opencommport

It is also possible to communicate with COMM ports with the built-in file functions.

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 8 June 2023 02:18 AM UTC
Hi Tracy;



You can read the datum directly from a Com Port via PowerScript.



https://community.appeon.com/index.php/qna/q-a/accessing-com-port-from-datawindow



HTH

Regards ... Chris
  1. Helpful 1
  1. Roland Smith
  2. Thursday, 8 June 2023 12:40 PM UTC
What device is on the port? There is a good chance the data will be Ansi so you may need to read it into a blob and then convert it to a string using EncodingANSI! as the second argument.
  1. Helpful 1
  1. Tracy Lamb
  2. Thursday, 8 June 2023 16:20 PM UTC
Roland,

There are several different devices that use the Serial Port. The devices are measurement machines for measuring gage blocks, pin gages, coordinate measurment machine, etc.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 7 June 2023 16:30 PM UTC
  2. PowerBuilder
  3. # 2

Hi, Tracy - 

I can find nothing in any Win32 API documentation for an API function named "OpenComm".

"user.exe" was, I believe, the pre-cursor to user32.dll in Windows 3.11 and earlier. This leads me to believe that OpenComm is a Win16 API function, and Win16 documentation is very hard to find nearly 30 years after the fact.

I suspect you will have to recode this functionality from scratch using Win32 interfaces/techniques.

Best regards, John

Comment
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.