;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;Sender.asm;从一个程序向另一个窗口程序发送消息之发送程序;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.386.modelflat,stdcalloptioncasemap:none;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;Include文件定义;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>includewindows.incincludeuser32.incincludelibuser32.libincludekernel32.incincludelibkernel32.lib;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;数据段;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.datahWnddd?szBufferdb256dup(?).constszCaptiondb'SendMessage',0szStartdb'PressOKtostartSendMessage,param:%08x!',0szReturndb'SendMessagereturned!',0szDestClassdb'MyClass',0;目标窗口的窗口类szTextdb'Textsendtootherwindows',0szNotFounddb'ReceiveMessageWindownotfound!',0;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;代码段;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.codestart:invokeFindWindow,addrszDestClass,NULL.ifeaxmovhWnd,eax;找到目标窗口则发送消息invokewsprintf,addrszBuffer,addrszStart,addrszTextinvokeMessageBox,NULL,offsetszBuffer,offsetszCaption,MB_OKinvokeSendMessage,hWnd,WM_SETTEXT,0,addrszTextinvokeMessageBox,NULL,offsetszReturn,offsetszCaption,MB_OK.elseinvokeMessageBox,NULL,offsetszNotFound,offsetszCaption,MB_OK.endifinvokeExitProcess,NULL;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>endstart;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 消息发送者代码: ;Receiver.asm;从一个程序向另一个窗口程序发送消息之消息接收程序;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.386.modelflat,stdcalloptioncasemap:none;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;Include文件定义;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>includewindows.incincludegdi32.incincludelibgdi32.libincludeuser32.incincludelibuser32.libincludekernel32.incincludelibkernel32.lib;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;数据段;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.data?hInstancedd?hWinMaindd?szBufferdb512dup(?).constszClassNamedb'MyClass',0szCaptionMaindb'ReceiveMessage',0szReceivedb'ReceiveWM_SETTEXTmessage',0dh,0ahdb'param:%08x',0dh,0ahdb'text:"%s"',0dh,0ah,0;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;代码段;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.code;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>;窗口过程;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_ProcWinMainprocusesebxediesi,hWnd,uMsg,wParam,lParammoveax,uMsg;****************************************************************.ifeax==WM_CLOSEinvokeDestroyWindow,hWinMaininvokePostQuitMessage,NULL;****************************************************************;收到WM_SETTEXT消息则将消息字符串和字符串地址显示出来;****************************************************************.elseifeax==WM_SETTEXTinvokewsprintf,addrszBuffer,addrszReceive,/lParam,lParaminvokeMessageBox,hWnd,offsetszBuffer,addrszCaptionMain,MB_OK;****************************************************************.elseinvokeDefWindowProc,hWnd,uMsg,wParam,lParamret.endif;****************************************************************xoreax,eaxret_ProcWinMainendp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>_WinMainproclocal@stWndClass:WNDCLASSEXlocal@stMsg:MSGinvokeGetModuleHandle,NULLmovhInstance,eaxinvokeRtlZeroMemory,addr@stWndClass,sizeof@stWndClass;****************************************************************;注册窗口类;****************************************************************invokeLoadCursor,0,IDC_ARROWmov@stWndClass.hCursor,eaxpushhInstancepop@stWndClass.hInstancemov@stWndClass.cbSize,sizeofWNDCLASSEXmov@stWndClass.style,CS_HREDRAWorCS_VREDRAWmov@stWndClass.lpfnWndProc,offset_ProcWinMainmov@stWndClass.hbrBackground,COLOR_WINDOW+1mov@stWndClass.lpszClassName,offsetszClassNameinvokeRegisterClassEx,addr@stWndClass;****************************************************************;建立并显示窗口;****************************************************************invokeCreateWindowEx,WS_EX_CLIENTEDGE,offsetszClassName,offsetszCaptionMain,/WS_OVERLAPPEDWINDOW,/50,50,200,150,/NULL,NULL,hInstance,NULLmovhWinMain,eaxinvokeShowWindow,hWinMain,SW_SHOWNORMALinvokeUpdateWindow,hWinMain;****************************************************************;消息循环;****************************************************************.whileTRUEinvokeGetMessage,addr@stMsg,NULL,0,0.break.ifeax==0invokeTranslateMessage,addr@stMsginvokeDispatchMessage,addr@stMsg.endwret_WinMainendp;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>start:call_WinMaininvokeExitProcess,NULL;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>endstart <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> MakeFile文件: LINK_FLAG=/subsystem:windowsML_FLAG=/c/coffall:Sender.exeReceiver.exeSender.exe:Sender.objLink$(LINK_FLAG)Sender.objReceiver.exe:Receiver.objLink$(LINK_FLAG)Receiver.obj.asm.obj:ml$(ML_FLAG)$<clean:del*.obj