LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

probs unsign WinAPI call

Hello,

I am using LabVIEW 5.1 and I tried to convert a long file name to its
short form utilizing the GetShortPathNameA function of the kernel32.dll

My function prototype (in CallLibrary function) looks like

int8 GetShortPathNameA(CStr lpszLongPath, CStr lpszShortPath, uInt32
cchBuffer);

And the function return the correct number of characters but not the
actual short filename.

Does anybody out there some experiance with this function?
How I have to initial the parameter?

Thanks in advaced

Roland


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
0 Kudos
Message 1 of 2
(4,146 Views)
> I am using LabVIEW 5.1 and I tried to convert a long file name to its
> short form utilizing the GetShortPathNameA function of the kernel32.dll
>
> My function prototype (in CallLibrary function) looks like
>
> int8 GetShortPathNameA(CStr lpszLongPath, CStr lpszShortPath, uInt32
> cchBuffer);
>
> And the function return the correct number of characters but not the
> actual short filename.
>
> Does anybody out there some experiance with this function?
> How I have to initial the parameter?
>

I'm not sitting in front of my PC; so I don't have access to MS
documentation. The first two parameters should be wired a string. I'd
take the filename, branch the wire and wire to each of the first two
parameters. I'm assuming that this function is copying the short string

into the CStr lpszShortPath and you have to have preallocated it. If
its possible for the short name to be larger than the long name, then
you might want to make the short name twice as long or some fixed max
size by using a constant. Off the top of my head I don't know what the
last parameter is. I suspect that the intended usage of this function
is to call the function once using NULL for the lpszShortPath and then
use the returned int8 to size a buffer, then call the function again
using the correctly sized buffer. This is done, of course, because of
the lack of conveniently resizable string data types in C. My guess,
and its just a guess, is that the last parameter is a country code or locale.

I'd suggest that you not use my guess or anyone elses and look up the
function in the MSDN or other reference location.

Greg McKaskle
0 Kudos
Message 2 of 2
(4,146 Views)