LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use comdlg.dll in labview

Solved!
Go to solution

@naveen_k wrote:

How to calculate IstructSize. It seems 7C (124 bytes). but it accepts 88 (136 bytes).


I get 124 too...

0 Kudos
Message 11 of 13
(665 Views)

You have to calculate it by observing alignment!

And it’s not a fixed value. Depending if it is for 32-bit or 64-bit it totally changes since the embedded pointers get suddenly 8 byte instead of 4 and the alignment rules can make that extra filler bytes are added.

Also this value is not meant to be a fixed magic value but rather a safe guard. The caller fills in the size it allocated and the callee checks this value before trying to access certain values.

This is for version compatibility. A new Windows release can extend this structure with extra parameters. Applications using the old API version use a smaller structurd and fill in the according smaller value here. Applications compiled with the new API headers will use the longer structure and fill in the according value. The function then can check if it is safe to attempt to access the newer values at the end of the structure.

The values in my attached VI are according to the used structure in my VI which is for the Windows 5 or 6 version of the Windows API, not the extended version currently documented in MSDN. Since these extended values do not contain any elements that would be used by this code it did not make sense to update the structure definition to match the latest Windows API definition..

Rolf Kalbermatter
My Blog
Message 12 of 13
(665 Views)

Thanks, still getting used to 64 bit...

0 Kudos
Message 13 of 13
(656 Views)