+ Reply to Thread
Results 1 to 2 of 2

Thread: How to get the window class name of windows control using WIN32?

  1. #1

    How to get the window class name of windows control using WIN32?

    Currently, I am using GetClassName API to get the window class name of windows control but sometime it fails to report the exact class name.

    Am I missing something?

    What API should I use which can tell the correct class name all the time?

    Please help.

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    38
    You should use "RealGetWindowClass" API to get the "type" of a window.

    Code:
    void WindowClassName(HWND hWnd)
    {
    	if(NULL != hWnd)
    	{
    		TCHAR szWindowName[1024] = "" ;
    		::GetWindowText(hWnd, szWindowName, 1024) ;
    		TCHAR szClassName[1024] = "" ;
    		GetClassName(hWnd, szClassName, 1024) ;
    		RealGetWindowClass(hWnd, szClassName, 1024) ;
    	}
    }
    Hope this helps.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts