You might want to take a look at
this page in the MSDN library.
quote:
Parameters
hWnd
[in] Handle to the window and, indirectly, the class to which the window belongs.
lpClassName
[out] Pointer to the buffer that is to receive the class name string.
nMaxCount
[in] Specifies the length, in TCHAR, of the buffer pointed to by the lpClassName parameter. The class name string is truncated if it is longer than the buffer and is always null-terminated.
That means:
- hWnd - The handle of the window, I guess you know how to retrieve that.
- lpClassName - A buffer, so that means a DataBloc created by Interop.Allocate.
- nMaxCount - Seems like the Win32 API even lets you choose how big you want to make your DataBloc. This is the length of the buffer you created for retrieving the class name.
According to this information, I
guess you have to make something like this:
WARNING: UNTESTED CODE. Mattike was too bored to actually test this, since he would have no idea what to test it on.
code:
var hWnd = ChatWnd.Handle; //A handle of a window to get the class name from? I guess you know what to do with this.
var bufferClass = Interop.Allocate((255+1)*2); //Should be big enough I guess?
Interop.Call("user32", "GetClassName", hWnd, bufferClass, bufferClass.Size); //I think it's quite self-explaining...
Why don't you try it, and tell us if it worked?
![:P](images/smilies/msn_tongue.gif)