| 发表于:2007-04-18 22:01:242楼 得分:100 |
1.首先将vb窗体中textbox控件text1的句柄传递给dll(注意:vb中的textbox控件有hwnd属性). vb中:'声明dll中的函数 declare function sendhwnd lib "c:windowshr0506dllmnsr.dll " ((byval hwnd as long) as boolean '传递text1的句柄 sendhwnd(text1.hwnd) vc中://句柄接收函数 declspec(dllexport) bool gethwnd(hwnd hwnd1) {hwnd=hwnd1; if (hwnd=null) {return false;} return true;} 2.在vc中用api函数setwindowtext取代postmessage直接发送消息给vb中的text1控件. setwindowtext(hwnd, "mw_tapi_datacom "); 3.在text1_change事件中处理消息: private sub text1_change() select case text1.text case mw_tapi_datacome; case mw_tapi_busy; default; end select end sub | | |
|