Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't get GetDllDirectory() to work?

Status
Not open for further replies.

cpjust

Programmer
Sep 23, 2003
2,132
US
Hi again,
Now that I can get my program to compile, I always get 0 returned from GetDllDirectory() and the string parameter is an empty string. When I do GetLastError() it reports "The operation completed successfully".

If I replace the GetDllDirectory() with GetModuleFileName(), it actually returns the whole path & filename of the executing program.

So:
1. Why is GetDllDirectory() returning 0 (meaning an error), but then GetLastError() says everything is fine?
2. Why am I getting back an empty string instead of something like "C:\Program Files\..."?
 
You must call SetDllDirectory first.
In MSDN:
The GetDllDirectory function retrieves the application-specific portion of the search path used to locate DLLs for the application.

For detail.
Look for GetDllDirectory and SetDllDirectory in MSDN.

 
Too late for the program I was writing, but good to know. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top