I
ivyzeng
Unregistered / Unconfirmed
GUEST, unregistred user!
以下代码是控制 Acrobat Reader 全屏,<br> 在 Acrobat reader 中按 CTRL+L 会全屏,<br> 我用Spy++ 跟踪出消息为 4条 , 发到 caption 为 'AVPageView' 的窗口上,<br> 我在程序中发送同样的消息,为什么达不到全屏的效果。 (用Spy++ 发送的消息 与 按“CTRL+L”是一致的)<br><br>procedure TForm1.SpeedButton5Click(Sender: TObject);<br>var<br> wK,wK2 :WORD;<br> bC :Byte;<br> dwK : DWORD;<br> dwK2 : DWORD;<br><br> hWnd,hWnd1 : ULONG;<br> <br> function GetWnd(name : string) : ULONG;<br> var<br> alist : TList;<br> strCap : pchar;<br> b : boolean;<br> s : string;<br> begin<br> result := 0;<br> alist := TList.Create;<br> hWnd := GetDeskTopWindow();<br> GetMem(strCap,255);<br> alist.Clear;<br> alist.Add(Pointer(hWnd));<br> while (alist.Count &gt; 0) do<br> begin<br> hWnd := ULONG(alist.Items[0]);<br> alist.Delete(0);<br><br> GetWindowText(hWnd,strCap,255);<br><br> s := strpas(strCap);<br><br> if s = name then<br> begin<br> result := hWnd;<br> exit;<br> end;<br> hWnd1 := GetWindow(hWnd,GW_Child);<br> if (hWnd1 &gt; 0) then<br> begin<br> alist.Add(Pointer(hWnd1));<br> end;<br><br> hWnd1 := GetWindow(hWnd,GW_HWNDNEXT);<br> if (hWnd1 &gt; 0) then<br> begin<br> alist.Add(Pointer(hWnd1));<br> end;<br><br> end;<br> FreeMem(strCap,255);<br> alist.Free;<br> end;<br><br>begin<br> hWnd := GetWnd('AVPageView');<br> if (hWnd &gt; 0) then<br> begin<br> //SendMessage(hWnd,WM_KEYDOWN,13 ,1);<br> bC := 29;<br><br> wK := MAKEWORD(29,0);<br> wK2 := MAKEWORD(38,0);<br> dwK := MAKELONG(1,wK);<br> dwK2 := MAKELONG(1,wK2);<br><br> PostMessage(hWnd,WM_KEYDOWN,VK_CONTROL ,dwK);<br> PostMessage(hWnd,WM_KEYDOWN,Ord('L') ,dwK2);<br> PostMessage(hWnd,WM_KEYUP,Ord('L') ,dwK2);<br> PostMessage(hWnd,WM_KEYUP,VK_CONTROL ,dwK);<br> end;<br>end;<br>