Programming Tips - Win32: How to get the name of the current program?

Date: 2008jun10 Update: 2025oct23 Language: C/C++ OS: Windows Platform: win32 Q. Win32: How to get the name of the current program? A. Use GetModuleFileName with NULL as the first parameter. For example:
void ExampleUse() { char szMe[MAX_PATH]; GetModuleFileName(NULL, szMe, sizeof(szMe)); }