LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call Library Function Node : Two Simple (?) Questions

The limit to which I have used the Call Library Function Node in my programs has been by examples I paste in. I have very limited knowledge of these things, but I'm on the fast-track this month and I'm about to release a program where I've used code that I don't fully understand. Smiley Mad
I have two questions regarding the use of this Node.
1) When making an EXE, does the dll (user32.dll in this case) file have to reside in the exact same path as it did on the computer were the EXE was built? I have noticed in the configuration window that my path is disappearing, replaced by just the file name.
2) I understand how to configure the Node, but I'm stumped on the inputs and what they mean. Is there a table somewhere that tells you what number wired to where does what? In the example of a mouse_event I've been using lately, there's 5 numbers wired to the input - see attached BMP. I've read through Chapter 2 of the Using External Code In LabVIEW, but I'm still not unclear where the numbers come from.

Thanks for any help.


Richard






Message 1 of 7
(3,929 Views)
Hi Richard
 
I used the call library node very rarely up to now, but...
 
1. I can't answer your first question, as I also already had some problems caused by the path of the dll. (Ok - it runs now, but don't ask me why Smiley Very Happy )
 
2. This numbers must be set in accordance to the definition of the dll you are using. You can't just set a value. So you really have to have some kind of documentation of the functions you are using. In case of user32.dll, searching the MS-sites should help you.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 2 of 7
(3,910 Views)
Here is the answer
 
Q1) When making an EXE, does the dll (user32.dll in this case) file have to reside in the exact same path as it did on the computer were the EXE was built? I have noticed in the configuration window that my path is disappearing, replaced by just the file name.
A1) No. AFAIK the user32.dll is OS dependend so you dont need to bind the dll to your exe and LabVIEW will automaicaly search for the dll in the WINDOWS\SYSTEM32 folder or in your installation folder.
 
Q2) I understand how to configure the Node, but I'm stumped on the inputs and what they mean. Is there a table somewhere that tells you what number wired to where does what? In the example of a mouse_event I've been using lately, there's 5 numbers wired to the input - see attached BMP. I've read through Chapter 2 of the Using External Code In LabVIEW, but I'm still not unclear where the numbers come from.
 
A2) The call of a function is very much C like. A Function in C is only cabable to return just one value or can be void. If you need mor informations from the function than you have to tell the funcion where to read or store the information. This can be values, pointers, array pointers, stings and so on. This totaly dependends on the function it self.
One think you cann be sure of is that you have to feed the function with exactly the data that will be the output of the function. Otherwise you will get a blue screen.
 
Kind regards
 
      Martin Kunze
With kind regards

Martin Kunze

KDI Digital Instrumentation.com
e-mail: martin.kunze@digital-instrumentation.com
Tel: +49 (0)441 9490852
Message 3 of 7
(3,909 Views)
hi
 
Probably the answer for Ur first question is 'YES'. Bcos I encountered the same kind of problem during my project.
 
I create the EXE in a folder whose name is related to the project name. Then I generate the EXE with all the VIs alongewith the Top-level VI & other DLLs etc.
 
But we should create the installer in a default path. For eg, \\C:\Program Files\Project.
 
Then our DLLs will lie inside the folder with the EXE in a folder called data.
 
When we install in another PC it'll take the custom path we mentioned while creating the EXE.
 
But I also want to escape like Becktho saying, "Dont ask why? & how?", bcos sometimes it does not work.
 
Regards,
Partha.
- Partha ( CLD until Oct 2027 🙂 )
Message 4 of 7
(3,898 Views)

Hi Richard,

For a pretty great explanation of where The OS will look for a DLL, see here:

http://forums.ni.com/ni/board/message?board.id=170&message.id=61568&requireLogin=False

In the case of calls into the Windows API (including user32.dll) the best resource is Microsoft

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/us...

This link relates to the mouse_event function (in User32.dll) which has 5 parameters - like your CLF.  A 2 in the first parameter of "mouse_event" specifies "MOUSEEVENTF_LEFTDOWN" - but these parameters should be U32s!

Posting the actual VI would provide more info!

luck/cheers

When they give imbeciles handicap-parking, I won't have so far to walk!
Message 5 of 7
(3,877 Views)
THANKS to all that have replied. I suspected those numbers were DLL specific. From what I can tell from the msdn information (thanks for the site, Dynamik!) In the case of mouse_event, the First number is the specfic mouse action. Assuming Zero indexing, "2" would be _LEFTDOWN, exactly what my attached BMP has written to it. The other three parameters can be set to zero.
I'd love to see a nice big table of all the "numbers" that you can plug into each specific input node for a each of the popular DLL calls to user32.dll. I bet it exists somewhere.

Smiley Very Happy Happy Holidays

Richard






0 Kudos
Message 6 of 7
(3,860 Views)

Hi Richard,


Broken Arrow wrote:
... I suspected those numbers were DLL specific.

...


Actually, the number and data-type of parameters is function specific.  User32.DLL contains many different functions.  Try double-clicking on the CLF terminal.  In the dialog-box, one selects (browses/navigates-to) a specific DLL, then selects a specific Function [in that DLL] from a list-box.  After that, it's up to the LabVIEW programmer to KNOW what to pass to the function.  Since User32.dll was written by Microsoft, you go to them for details about the specific function requirements!

BTW, it wasn't always so easy!  It used to be that one had to KNOW what functions were available in a DLL, now it appears LabVIEW mines the DLL for the names of available functions - making life a bit easier. Smiley Happy

cheers!
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 7 of 7
(3,835 Views)