WM_COPYDATA inter-process communication scheme

Source: Internet
Author: User

WM_COPYDATA inter-process communication scheme
In two consecutive companies, WM_COPYDATA is used to implement inter-process communication. The specific steps are as follows: 1. process A starts process B through ShellExecute, and transmits the window handle hWndA (which has been converted into an int value) for communication to process B through command line parameters, and B saves hWndA. II. process B assembles the message COPYDATASTRUCT copyData, contains the hWndB handle used for communication, and sends the WM_COPYDATA message to hWndA: SendMessage (hWndA, WM_COPYDATA, 0, (LPARAM) & copyData ); when process A receives the WM_COPYDATA message, it stores hWndB. this mode is also used when process A needs to send A message to process B: SendMessage (hWndB, WM_COPYDATA, 0, (LPARAM) & copyData); Process Communication path is complete. the dwData in COPYDATASTRUCT is used to store the message type. note: When WM_COPYDATA is received, Post a custom message number to yourself, immediately return the message, and perform other operations based on the custom message number.

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.