LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

where are located api fonctions?

Unfortunately, I can't save back to 7.1 since that requires me to have 8.0 and I only have 7.1 and 8.2. All that I had done was use the Code Interface node to call the "RegisterWindowMessage" and "PostMessage".

The "RegisterWindowMessage" function simply tells Windows that you plan to use a specific message in your application, and you're asking Windows for a unique ID so you can identify the message when it gets sent around.

The "PostMessage" function is used to send a message to a specific window or to send it to everybody by setting the hWnd parameter to "HWND_BROADCAST", a constant that's -1. This is used by the example application to send the "start" and "stop" commands to ushape, for example.

Based on what I could see, I believe the reception of the messages from ushape works like this: uShape sends out a broadcast message. That means everybody gets it. In the example code the dialog box's "PreTranslateMessage" is used to trap these broadcast messages and determine if it's a ushape message based on the message ID (those lines that are "if(pMsg->message == OMMSG_SEND_STATUS)". The "PreTranslateMessage" function is a dialog box specific function. It is used to pre-process Windows messages that are received by the dialog box. You won't find that function in user32.dll since it's not a generic API function. It's specific to MFC, which is the framework used to create that example given to you. In MFC a dialog is a class, and "PreTranslateMessage" is one of the members of the dialog class.

Do other methods exist for LabVIEW? You can probably use the "WaitMessage" or "GetMessage" functions in user32.dll in an equivalent matter. This would require you to call these functions in a loop until the message you get is one of the ones you initially registered. A little clumsier than using a callback method, but it should work.

Attached is a simple example in 7.1. Note that all the code interface nodes are set to use the "stdcall" calling convention. I suspect that's why the example you tried to create didn't work. Whether or not this works for you I have no idea since I don't have the uShape component. You should follow-up with the company that sold you the component to see if you can get more help.

Message 11 of 16
(1,457 Views)

smercurio,

I ran the VI you had attached for 7.1... I cant stop it even if I press the Abort button of LV... Smiley Sad

Is this the correct behaviour of that VI ?

Can you kindly clarify me ?

- Partha ( CLD until Oct 2027 🙂 )
Message 12 of 16
(1,443 Views)
smercurio,
 
what a wonderful day! you are my superman, smercurio!
i finaly managed to understand how it works. Even if it doesn't work at all, i progress....
 
indeed mshape answers me when i ask him if it is connected or not. using Getmessage(). it's a good new. But I don't manage to order him to start measurements because i think i didn't understand the Wparam and Lparam's transmitions...
 
well thank you very much for your help.
 
l'asticot
0 Kudos
Message 13 of 16
(1,418 Views)
Partha: Given that I wrote that VI in just a few minutes and didn't debug it, I'm not surprised there's problems with it. It was only meant for demonstration. It looks like the problem is with the call to GetMessage. What the problem is, I'm not really sure. It's probably due to some LabVIEW<->Windows interaction.

To poster: I'm glad that you're starting to understand what's going on. It seems like a bit of a clumsy interface that this company cooked up, but then they probably didn't consider this module being used outside of a Windows-API only application, hence the problems you're having trying to interface to it. The wParam and lParam parameters are command-specific. Way back the wParam was a 16-bit value and lParam was a 32-bit value. When Windows switched to 32-bit, they both became 32-bit values. As for what the values are, you need to look at the documentation that came with the library you bought. In the sample program that you were given the lParam value was typically set to the thread id of the dialog and the wParam was set to a value specific to the command.
0 Kudos
Message 14 of 16
(1,414 Views)
You and the constructor spoke about Process ID (PID).this is the Lparam. i don't understand why is it necessary for the dialogue....
 
It's really strange. when i use the same program (as request mshape status) to start measurement, it doesn't work. however it composes of  the same steps: send a message and wait the answer no?   
0 Kudos
Message 15 of 16
(1,399 Views)
Unfortunately, I can't answer these questions, as it's delving into the particulars as to how this library works, and you have the documentation for it. If you can't find the answer in the documentation you will need to follow up by talking to the vendor.
0 Kudos
Message 16 of 16
(1,386 Views)