Getting your program's filename

Discussion in 'Game Development (Technical)' started by Raptisoft, Nov 13, 2004.

  1. Raptisoft

    Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    804
    Likes Received:
    0
    Hi all,

    Sort of a dumb question, but I can't seem to type in the right combination of keywords to bring up an answer on Google. :)

    I want to know what my program's filename is. I.E. you run THEGAME.EXE, I know that somewhere, there's a function call that will tell me "THEGAME.EXE"

    Anyone know what it is?

    Thanks!
     
  2. Jason Chong

    Original Member

    Joined:
    Jul 30, 2004
    Messages:
    264
    Likes Received:
    0
    In ansi C/C++ it would be argv[0]


    For win32, look up

    DWORD GetModuleFileName(

    HMODULE hModule, // handle to module to find filename for
    LPTSTR lpFilename, // pointer to buffer for module path
    DWORD nSize // size of buffer, in characters
    );
     
    #2 Jason Chong, Nov 13, 2004
    Last edited: Nov 13, 2004
  3. Raptisoft

    Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    804
    Likes Received:
    0
    Ah, thank you, GetModuleFilename was it.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer