Winapi:getclassname-Gets the class name of the specified window

Source: Internet
Author: User

Winapi:getclassname-Gets the class name//declaration of the specified window: GetClassName (Hwnd:hwnd; {Specify window handle} Lpclassname:pchar;           {buffer} nmaxcount:integer {buffer size}): Integer; {Returns the class name size; failure returns 0}--------------------------------------------------------------------------------//Test 1: Create a new project,  The class name of the main window is TForm1 by default, using the program to get a look at Var ps:array[0..254] of Char;    Begin GetClassName (Handle, PS, 255); ShowMessage (PS);  {TForm1} end;    --------------------------------------------------------------------------------//Test 2: Look at the class name of the Calculator window (start calculator first) var    H:hwnd;  PS:ARRAY[0..254] of Char; Begin H: = FindWindow (nil, ' calculator ');    {This is the handle to get the calculator window}    GetClassName (H, PS, 255); ShowMessage (PS);  {Scicalc} end;    --------------------------------------------------------------------------------//Test 3: Look at the class name of the Notepad window (restart Notepad first): Var    H:hwnd;  PS:ARRAY[0..254] of Char; Begin H: = FindWindow (Nil, ' Untitled-Notepad ');    {This is the handle to get the Notepad window}    GetClassName (H, PS, 255); ShowMessage (PS);   {Notepad} end;

  

Winapi:getclassname-Gets the class name of the specified window

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.