I'm wondering if there is a simple win32 API to retrieve
the current module filename (xxxx.exe)

I know about GetModuleFilename which gets the full path.
And I have read that argv[0] holds the exe name, but that also give me the full path.

What I'm after is an API to give me just the name, with or without an extension.

Any simple solutions?

Simply strip away the path from the names you get from GetModuleFilename or args[0]. As in:

#include <iostream>
#include <string>
#include <algorithm>

int main(int argc, char** argv) {

  std::string full_name = argv[0];

  std::cout << "Full name: " << full_name << std::endl;

  std::string exec_name(std::find(full_name.rbegin(),

  std::cout << "Exec name: " << exec_name << std::endl;

  return 0;