I am using function GetClassName for a given HWND. The function is giving error:
"Invalid access to memory location".
I guess the problem is in the out parameter. As per msdn, GetClassName takes:
1- hWnd [in]
Type: HWND
A handle to the window and, indirectly, the class to which the window belongs.
2- lpClassName [out]
Type: LPTSTR
The class name string.
3- nMaxCount [in]
Type: int
LPTSTR clsName_v means a pointer to a buffer provided by you - Windows will place the class name into this buffer if the call succeeds int numChr is the length of the buffer in characters ;
(Note that GetClassName function is available as ANSI and Wide Char versions
so beware when calculating the size of the buffer;)
Example:
1 2 3 4
HWND hWnd_v; // to be set to some actual window handle value
char clsName_v[256]; //a buffer of chars
GetClassNameA (hWnd_v, clsName_v, 256); //Specifically using ANSI version of the function