第一个问题:用CreateWindow来建窗体,具体用法:<br>HWND hwnd; <br>WNDCLASS wc; <br>memset(&wc,0,sizeof(WNDCLASS));<br>wc.style = CS_HREDRAW|CS_VREDRAW |CS_DBLCLKS ;<br>wc.lpfnWndProc = (WNDPROC)MainWndProc; <br>wc.hInstance = hInst; <br>wc.hbrBackground = (HBRUSH)(COLOR_WINDOW); <br>wc.lpszClassName = "keyWndClass";<br>wc.lpszMenuName = NULL; <br>wc.hCursor = LoadCursor(NULL,IDC_ARROW);<br>wc.hIcon = LoadIcon(NULL,IDI_APPLICATION); <br>RegisterClass(&wc));<br>hwnd=CreateWindow("keyWndClass","key",WS_VISIBLE|WS_CAPTION|WS_SYSMENU,<br>297,119,282,324,NULL,NULL,hInst,NULL);//hInst是程序的HINSTANCE<br>于是,hwnd就是窗体的句柄<br>第二个问题:<br>用SendMessage;<br>#define WM_MYMSG WM_USER+101<br><br>在发送进程:<br>char szBuffer[];//假设这是要发送的缓冲区<br>SendMessage(GoalhWnd,WM_MYMSG,NULL,(LPARAM)szBuffer);<br><br>在接收进程:<br>#define WM_MYMSG WM_USER+101<br>响应WM_MYMSG:<br>char szBuffer=(char*)lParam;<br>