Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetModuleFileName() with console app?

Status
Not open for further replies.

dc2000

Programmer
Jun 7, 2005
48
US
Hi everyone:


It seems to be very easy but somehow I'm stuck in the middle of it. The GetModuleFileName(hModule, pFileName, nSz) returns NULL if hModule refers to console app (and probably 16bit app too). There's absolutely no way around it as I need to get file path from the window handle.

Any suggestions?
 
Try some of the Console WINAPI functions. I am not quite familliar with them, so it might be up to you to determine what you need. Search for functions like AttachConsole, GetConsoleAlias, etc.

When you do it, do it right.
 
Hah, thanks dEVooXiAm. But still there are questions :( AttachConsole() just attaches a new console to GUI app and to use GetConsoleAlias() one needs to know console alias which I don't have. All I have available is hModule handle to the module and any other derivatives (window handle, class name, etc).

Any more ideas, guys?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top