when defining main() use this notation
int main(int argc, char *argv[])
{
..
..
.
.
}
Any time in ur program whenever u'll say argv[0] it will return u a string containing name of the program. And if u r diehard to get .exe extension along with that. use strcat() to concatenate prog name with .exe like this
strcat(name,argv[0]);
strcat(name,".exe"
in name now u'll have "program.exe".
C C is that simple.
Regards,
SwapSawe.
The two posts offered are correct. Unfortunately, I didn't specify that I'm using MFC with MDI. Can anyone tell me how to identify my .exe name from inside the program in this situation?
Also if you need to read the command line parameters you can do this in the InitInstance method of you CWinApp derived class by reading the from a CCommmandLine class
(the wizard automatically puts this code there, check it out)
Hope this helps,
s-)
Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.