PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

GetModuleFileName returns empty string?

Hi everyone,

I have a question about getting the application path. When I call the function GetModuleFileName as follows:

GetModuleFileName( NULL, strPath, 100);

strPath is empty after the call. I have declared strPath as follows:

TCHAR strPath[100];

The function call is in my InitMusic() which is in my CGapiApplication derived class.

Am I doing something stupid again? :lol:

Thanks in advance for your answers!
Try GetLastError, then you'll know.

Also how are you using this function in WinCE? Last time I wanted to do what you are doing I couldn't find a supported API to do it.
I do it like this:

Code:

class CMens : public CGapiApplication
{
private:

virtual HRESULT InitMusic()
{
int retrycount=0;
TCHAR strFilename[255];

GetModuleFileName( NULL, strFilename, 100);

return S_OK;
};
};
What I am trying, is to get FmodCE to load a musicfile. It doesn't accept just the plain filename, because it needs the full path.

I post my question it here because I call it from my CGapiApplication.

Hope someone can help me... :lol:
Hmmm... Weird. It suddenly works.
I installed the PocketPC2002 SDK and it now works...

:oops:
As a guess what I think just happened is that you can only support ppc2002 now. That function is not present in 2000, at least in my docs it says unsupported. So that may be why it wasn't working. But at any rate you aren't even checking the return value, which is generally unwise.
Pejo Software - Per · 20 Feb 2003, 21:08 UTC
Strange that you says that it isn't supported for Pocket PC 2000. My docs says it is!!
I am using it and it works fine on PPC 2000 devices!
Guess I have some old docs or something. I used my local help stuff from VC++ install. So maybe vce docs aren't even included and I am just reading what ever was part of MSDN when I last installed VC++.

At any rate, tis good to know I'll have need for that in the future I'm sure. But it was just as easy for me to grab the install path from the registry.