就是用VBS操作Word.Application对象发送信息就像SendMessage一样好用。或许,还有局限性,但是我没有对它深入研究。说明:在Word.Application中有个Task对象,这个Task对象有个SendMessage方法,和API的基本类似。所以,就:
'BY Coo_boi
Function SendMessage(lpWinTitle,wMsg,wParam,lParam)
Dim WordApp
Dim ShApp,colTask,oTask
Set WordApp=CreateObject("Word.Application")
Set colTask=wordapp.Tasks
SendMessage=False
For Each oTask In colTask
If oTask.Visible And InStr(oTask.Name,lpWinTitle) Then
oTask.SendWindowMessage wMsg,wParam,lParam
SendMessage=True
Exit For
End If
Next
WordApp.Quit
Set WordApp=Nothing
End Function
Const WM_SYSCOMMAND=&H112
Const SC_MAXIMIZE=&HF030&
Const lpWinTitle="API 阅览器 - D:\程序目录\Tools\Winapi\WIN32API.TXT"
SendMessage lpWinTitle,WM_SYSCOMMAND,SC_MAXIMIZE,0
'BY Coo_boi
Function SendMessage(lpWinTitle,wMsg,wParam,lParam)
Dim WordApp
Dim ShApp,colTask,oTask
Set WordApp=CreateObject("Word.Application")
Set colTask=wordapp.Tasks
SendMessage=False
For Each oTask In colTask
If oTask.Visible And InStr(oTask.Name,lpWinTitle) Then
oTask.SendWindowMessage wMsg,wParam,lParam
SendMessage=True
Exit For
End If
Next
WordApp.Quit
Set WordApp=Nothing
End Function
Const WM_SYSCOMMAND=&H112
Const SC_MAXIMIZE=&HF030&
Const lpWinTitle="API 阅览器 - D:\程序目录\Tools\Winapi\WIN32API.TXT"
SendMessage lpWinTitle,WM_SYSCOMMAND,SC_MAXIMIZE,0