Hi, I want to print in the console the name of the exe that is executed (It prints his name). There is something I can do for read it?
thanx
Printable View
Hi, I want to print in the console the name of the exe that is executed (It prints his name). There is something I can do for read it?
thanx
You can use command line arguments.
Code:int main(int argc, char **argv)
{
printf("Program Executed = %s\n", argv[0]);
return 0;
}
too bad I cant use int main, but I have to use WINAPI WinMain and the command line argument is only one lpCmdLine and no exe name in it... :(
Must be a windows question then
This question has been answered before on the windows board, try a search
thanx, I will search it (again and better) :)
Code:#include <windows.h>
#include <iostream>
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
{
MessageBox(HWND_DESKTOP,GetCommandLine(),0,MB_OK);
return 0;
}
really thanx ;)