WM_COPYDATA inter-process communication scheme, wm_copydata Communication

Source: Internet
Author: User

WM_COPYDATA inter-process communication scheme, wm_copydata Communication

WM_COPYDATA is used in two companies to implement inter-process communication.

Procedure:

1. process A starts process B through ShellExecute and passes the hWndA (strongly converted to int value) of the window handle used for communication to process B through the command line parameter, and B saves hWndA.

2. process B assembles the message COPYDATASTRUCT copyData, contains the window handle hWndB 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 also uses this mode to store hWndB. process A needs to send A message to process B:

SendMessage (hWndB, WM_COPYDATA, 0, (LPARAM) & copyData );

The 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.

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.