Jump to content

Help Setting up GetLongPathName dll call


Recommended Posts

Hello there,

I am trying and failing to set up a call to the kernall32 function GetFullPathName, I keep getting stuck on these things. Would anybody be able to help me please? I've attached what I have so far but the call just crashes LabVIEW straight away.

Thank you very much as ever,

Martin

post-13935-0-63180000-1319493637_thumb.p

post-13935-0-30347600-1319493942.png

Link to comment

Need type definitions for DWORD, LPTRSTR, LPCTSTR.

your return type is definitely not double.

but convention would say that your function prototype should look like:

int32_t GetLongPathName(const char* lpszshortpath, const char* lpszlongpath, int32_t ccBuffer)

Check this out:

http://www.codeproject.com/Tips/76252/What-are-TCHAR-WCHAR-LPSTR-LPWSTR-LPCTSTR-etc

I think that lpszshortpath is expecting a Unicode string, so you may have to convert the actual string you put in from ANSI to Unicode.

~Jon

Link to comment

If you're worried about a tidy block diagram, you don't need either allocations - just wire in 260 to the buffer length terminals and configure the CLN to use that input as the Minimum Length for the output buffer. You'll over-allocate in most cases, but what's a few bytes among friends?

Also, you don't need to run most of these utility APIs in the UI thread.

post-13461-0-70569300-1319516722.png

Link to comment

As you tidy up the BD keep in mind that nobody would use these functions back to back since that is simply path to string. Basically I wanted a short path to verify the long path worked. As to the length, most of these functions will return the necessary length if you call with a null buffer (Length=0).

Link to comment

As you tidy up the BD keep in mind that nobody would use these functions back to back since that is simply path to string. Basically I wanted a short path to verify the long path worked. As to the length, most of these functions will return the necessary length if you call with a null buffer (Length=0).

Not sure if this was directed at me, but I'm aware ;)

One things to keep in mind if you're going to act on the return value is that if the buffer is too small, the function returns the *size of the buffer* you need for the string; if the buffer is big enough, it returns the *length of the string* (no null terminator).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.