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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetPrivateProfileString

Status
Not open for further replies.

jamescpp

IS-IT--Management
Aug 29, 2001
70
US
I have a program that when run from a command line it works as intended. I now have the program setup as a service. From another forum post it was suggested I use GetPrivateProfileString() to read parameters from an INI file. That works great except that when I run it as a service it doesn't find the ini file unless I hardcode the whole path in.

I have an AppDirectory registry entry and the program finds other files that it uses. I've also tried putting the program in the path.

Does GetPrivateProfileString() have to have a full path? Is there something I should do differently?

Thanks,
James
 
the best method is to put the full path to directory without slashes at the end. Be very attentive on using slashes. Set the current directory (SetCurrentDirectory) your value from the registry and use the file. Ion Filipski
1c.bmp


filipski@excite.com
 
How do you use SetCurrentDirectory?

thanks,
James
 
#include<windows.h>
.....
SetCurrentDirectory(&quot;drive:\\full\\directory\\name&quot;); Ion Filipski
1c.bmp


filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top