(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
06-28-24 06:16 PM
0 users currently in Programming.
Acmlm's Board - I3 Archive - Programming - GetWindowModuleFileName just doesn't work New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6340 days
Last view: 6340 days
Posted on 01-08-06 03:10 AM Link | Quote
I can't seem to figure out why but for some reason, GetWindowModuleFileName() just doesn't seem to work. I pass it one window's handle, and it returns the module of another or nothing at all. The desktop window returns shell32.dll which is correct, but the taskbar, created by the same process, returns nothing. Notepad and Calculator return nothing, and Winamp and Console (command prompt frontend) return the name of the program calling it!
Vertex
Newcomer


 





Since: 01-08-06
From: Philippines

Last post: 6745 days
Last view: 6745 days
Posted on 01-08-06 10:10 PM Link | Quote
Are you absolutely sure that you are providing a valid hWnd? And if you're using the unicode version of GWMFN() then are you sure it's not returning a unicode string and your program is trying to interpret it as ANSI?
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6340 days
Last view: 6340 days
Posted on 01-08-06 11:49 PM Link | Quote
It has to be valid, because passing the same hWnd to other functions gives correct results, and it's not the Unicode version. The function actually returns 0, as in 0 characters copied, or returns the name of the program that called it.
Vertex
Newcomer


 





Since: 01-08-06
From: Philippines

Last post: 6745 days
Last view: 6745 days
Posted on 01-08-06 11:58 PM Link | Quote
Could you post the code you are using to get the hWnd and process module filename?
HyperHacker

Star Mario
Finally being paid to code in VB! If only I still enjoyed that. <_<
Wii #7182 6487 4198 1828


 





Since: 11-18-05
From: Canada, w00t!
My computer's specs, if anyone gives a damn.
STOP TRUNCATING THIS >8^(

Last post: 6340 days
Last view: 6340 days
Posted on 01-09-06 12:29 AM Link | Quote
Don't see why not.

CurrentWindow.hWnd = GetForegroundWindow();
CurrentWindow.Parent = (HWND)GetParent(CurrentWindow.hWnd);
GetWindowRect(CurrentWindow.hWnd,&CurrentWindow.Pos);
GetClientRect(CurrentWindow.hWnd,&CurrentWindow.ClientArea);
GetText(CurrentWindow.hWnd,CurrentWindow.Title,sizeof(CurrentWindow.Title));
if(!strlen(CurrentWindow.Title))
strcpy(CurrentWindow.Title,"<No Title>");

RealGetWindowClass(CurrentWindow.hWnd,CurrentWindow.Class,sizeof(CurrentWindow.Class));
CurrentWindow.Style = GetWindowLong(CurrentWindow.hWnd,GWL_STYLE);
CurrentWindow.ExStyle = GetWindowLong(CurrentWindow.hWnd,GWL_EXSTYLE);
CurrentWindow.MessageProc = GetWindowLong(CurrentWindow.hWnd,DWL_DLGPROC);
if(!CurrentWindow.MessageProc)
CurrentWindow.MessageProc = GetWindowLong(CurrentWindow.hWnd,GWL_WNDPROC);

CurrentWindow.hInst = GetWindowLong(CurrentWindow.hWnd,GWL_HINSTANCE);
CurrentWindow.ID = GetWindowLong(CurrentWindow.hWnd,GWL_ID);
CurrentWindow.ThreadID = GetWindowThreadProcessId(CurrentWindow.hWnd,&CurrentWindow.ProcID);

CurrentWindow.ModuleName = CurrentWindow.Module;
strcpy(CurrentWindow.Module,"???");
GetWindowModuleFileName(CurrentWindow.hWnd,CurrentWindow.Module,sizeof(CurrentWindow.Module));
for(i=strlen(CurrentWindow.Module);i>=0;i--)
{
if(CurrentWindow.Module[i] == '\\')
{
CurrentWindow.Module[i] = 0;
CurrentWindow.ModuleName = CurrentWindow.Module + i + 1;
break;
}
}
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - Programming - GetWindowModuleFileName just doesn't work |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.011 seconds; used 368.91 kB (max 443.72 kB)