LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

call of a WINAPI DLL with a struct

Solved!
Go to solution

Hi,

 

I want to use the WINAPI SetCommTimeouts() function (winbase.h).

One parameter is a pointer to the COMMTIMEOUTS Struct.

I have defined a TypeDef a cluster with 5 U32 numbers, to correspond to the 5 DWORD of the CommTimeouts prototype. There should be no alignment issues as all members are DWORD, i.e. U32 in Labview, 4 bytes.

I have a program consisting of a simple CreateFileA(), SetCommTimeouts(), CloseHandle, all using kernell32.dll.

I have a 64 bit computer, with 32bit labview.

 

However, the SetCommTimeouts returns a modified structure with results different from what I set. Did I made anything wrong with the structure?

Download All
0 Kudos
Message 1 of 3
(1,895 Views)
Solution
Accepted by topic author fb35

It seems to work when I tried it. I did notice that the indicator had the radix set to hex whereas the input was decimal.

Note: It's best to try and post the full example that someone can try, so they don't have to waste time creating the setup (attached)

0 Kudos
Message 2 of 3
(1,853 Views)

Yes, this works. Actually I have mistaken GetCommTimeouts instead of SetCommTimeouts!

0 Kudos
Message 3 of 3
(1,833 Views)