FindWindow()????

So for some reason, my program cant find a application even though I have the correct name entered in the FindWindow function (I even use winspy++ to confirm), so I'm thinking about just do a drop down option (or something to display all the active running apps like in CheatEgine), but I don't know how to do it and I don't know what to type in google to look it up. Any ideas?

also here is the code I was talking about
HWND hWnd = FindWindow(NULL, "Keygen");
You can pretty easily grab a list of all windows, here's a link from this site:

http://www.cplusplus.com/forum/windows/25280/
So I ran a test code of that just to see if the program shows up, but it doesn't. How is that possible? also how can I make it so that the program is detected by my program?
Is it running as a privileged user? I've noticed that you can't really interact much between permission levels. Try running the enumeration program as an administrator if you're not sure.
So I found out that apparently the program doesnt have a name some how by doing a process ID check on all the program and this game up [img]https://gyazo.com/9760f776b54f92320523c1760cd0a771.png[/img]

so how would I get the HWND from a program that doesnt have a real name?
Hmm, you can always use something like GetForegroundWindow() to find the frontmost window on a delay- or if you need to find it programmatically you could maaaaybe use GetWindowLong() to find some value- or you could use GetClassName() and try to find the class name (especially if it's a custom window, this could be unique)
Ok, FIXED (holy shit): found a Enum code online to scan product by PID but altered it to display the correct name and class
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
BOOL CALLBACK FindItemByPID(HWND hwnd,LPARAM lParam)
{
    DWORD lpdwProcessId;
    GetWindowThreadProcessId(hwnd,&lpdwProcessId);
    if(lpdwProcessId==lParam)
    {
        g_HWND=hwnd;
        char class_name[80];
        char title[80];
        GetClassName(hwnd,class_name, sizeof(class_name));
        GetWindowText(hwnd,title,sizeof(title));
        cout <<"Window title: "<<title<<endl;
        cout <<"Class name: "<<class_name<<endl<<endl;
        return FALSE;
    }
    return TRUE;
}

from there, I scan for the program PID, but the name came up empty EXCEPT for the class https://gyazo.com/9760f776b54f92320523c1760cd0a771.png from there I been trying to find out how to change the program name, but I should have been looking for how to change TITLE name, which then found this
https://www.murgee.com/window-title-changer/
and then I locate the program by the class name found in the code and change the title. Then did a FindWindow() for the program and BAM, it catches it!bobobobo[/I][/SIZE][/COLOR][/FONT]

edit: this is permanent change tho :(
Last edited on
Topic archived. No new replies allowed.