C # Call WinAPI to send SendMessage

Source: Internet
Author: User

Call methods in DLL

First, the external method should be declared in the C # language source program. The basic form is:
[DLLImport ("DLL file")]

Modifier extern return variable type method name (parameter list)
[DllImport ("user32.dll", EntryPoint = "SendMessage")]
Public static extern int SendMessage (
IntPtr hWnd, // handle to destination window
Int Msg, // message
Int wParam, // first message parameter
Int lParam // second message parameter
); Www.2cto.com


For DllImport, it must be before the method (For details, refer to MSDN). EntryPoint = "SendMessage" indicates the name of the function in the DLL (if it is wrong, the portal cannot be found ).

You can directly call the SendMessage (parameter 1, parameter 2, parameter 3, parameter 4) method when needed.

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.