Marko29
Marko29

Reputation: 1005

How can i check for specific window name while enumerating EnumChildProc in WinApi?

So far i have been using GetClassName() to get a window handle with the class name that interested me while enumerating with EnumChildProc() but right now i am in situation where plenty of HWND's use the same classname so only way to identify my window i assume would be with its name which is unique.

So while i am enumerating i was thinking to use something like...

If getwindowname() == what i need... but i have no idea what function can i use for this, is there a function like getwindowname() that i can use in this enumeration?

Upvotes: 0

Views: 528

Answers (2)

Marko29
Marko29

Reputation: 1005

this.. worked

TCHAR winname[MAX_PATH];
long lenght;
HWND hwndineed;

BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam) {

lenght = SendMessage(hwnd, WM_GETTEXT, 99, (LPARAM)winname); 

        if(wcscmp(winname, _T("caption i needed")) == 0)
        {
            hwndineed= hwnd;
            return FALSE; // end enumeration
        }
}

Upvotes: 1

Kirill V. Lyadvinsky
Kirill V. Lyadvinsky

Reputation: 99685

GetWindowText ?

Upvotes: 2

Related Questions