int GetAppPath(LPTSTR pstr,int length){
int ret,i;
// this gets the name of the running app
ret=GetModuleHandle(NULL,pstr,length);
if(!ret)return 0;
i=lstrlen(pstr)-1;
for(;i>=0;i--){
// replace backslash with a terminating null
if(pstr[i]==TEXT('\\')){
pstr[i]=TEXT('\0');
break;
}
}
return lstrlen(pstr); //return the length of the final string
}
Tuesday, March 24, 2009
Retrieving the Path of the Running Application
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment