Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Shared Function GetClassName(ByVal hWnd As System.IntPtr, _
ByVal lpClassName As System.Text.StringBuilder, ByVal nMaxCount As Integer)
' Leave function empty
End Function
VB Signature
Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
(ByVal hWnd As Long, _
ByVal lpClassName As String, _
ByVal nMaxCount As Long) As Long
Notes:
In .NET Framework 4.0, only CharSet.Ansi seems to produce the result.
Tips & Tricks:
Please add some!
Sample Code:
C# Sample Code
private static bool isIEServerWindow(IntPtr hWnd)
{
int nRet;
StringBuilder ClassName = new StringBuilder(100);
//Get the window class name
nRet = GetClassName(hWnd, ClassName, ClassName.Capacity);
if(nRet != 0)
{
return (string.Compare(ClassName.ToString(), "Internet Explorer_Server",true,CultureInfo.InvariantCulture) == 0);
}
else
{
return false;
}
}
VB.NET Sample Code
Create a new VB .NET form and add a button Button1 to it.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim sClassName As New StringBuilder("", 256)
'pass in the handle of the object for which to get
'the class name; for example, the form's handle
Call GetClassName(Me.Handle, sClassName, 256)
MessageBox.Show(sClassName.ToString)
End Sub
class ManagedWinapi.SystemWindow that has a ClassName property.
Click to read this page
4/6/2008 7:23:14 AM - anonymous
http://mwinapi.sourceforge.net/
3/31/2008 6:53:29 AM - -217.54.254.83
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).