使用了操作系统的消息队列,所以可以做到进程32位,64位通用!但是同样受限于此,只能做到四个字节(或者八个字节)的数字数据通讯!
//server.cpp
#include <windows.h>
#include "resource.h"
INT_PTR CALLBACK DialogProcedure(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL OnInitDialog(HWND DlgHwnd);
#define UM_IPC WM_USER+1
HWND __DlgHwnd = NULL;
HWND __EditHwnd = NULL;
char __BufferData[4] = { 0 };
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{//入口函数
DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOG_MAIN),NULL,DialogProcedure);
return 0;
}
INT_PTR CALLBACK DialogProcedure(HWND hwndDlg,UINT uMsg,WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_COMMAND:
{
switch (LOWORD(wParam))
{
case IDOK:
{
GetWindowTextA(__Edi