我已经找到句柄,程序如下:
hWnd:=FindWindow(nil,pchar('RealPlayer Plus'));
setforegroundwindow(hWnd);
SendMessage(hWnd,WM_LBUTTONDBLCLK,0,0);////这个不行,如何处理阿??
hWnd:=FindWindow(nil,pchar('RealPlayer Plus'));
setforegroundwindow(hWnd);
SendMessage(hWnd,WM_LBUTTONDBLCLK,0,0);////这个不行,如何处理阿??
受到该消息后你是怎样处理的???
1.用GetWindow(Handle,GW_HWNDNEXT);获得当前运行中的窗体句柄,
2.然后用GetWindowText(Handle,@WindowName,WindowNameSize)
获取窗体名称,检测是不是需要查找的应用程序。
3.如果找到,GetWindowRect(Handle,rect)
4.POSX := (RECT.LEFT + RECT.RIGHT ) DIV 2;
POSY := (RECT.TOP + RECT.BOTTOM) DIV 2;
LPARAM := POSX AND ( POSY SHL 8);
5.
Sendmessage(Handle,WM_LBUTTONDOWN,MK_LBUTTON,LPARAM)
Sendmessage(Handle,WM_LBUTTONUP,MK_LBUTTON,LPARAM)
一般托盘程序都是判断鼠标消息,我试过好像可以。
但是delphi调用SDK函数getwindowtext好像容易出错,运行不稳定。
getlasterror有时报120(ERROR_CALL_NOT_IMPLEMENTED)有时又不报。
你有好的方式,共同讨论讨论
The mouse_event function synthesizes mouse motion and button clicks. VOID mouse_event( DWORD dwFlags, // flags specifying various motion/click variants
DWORD dx, // horizontal mouse position or position change
DWORD dy, // vertical mouse position or position change
DWORD dwData, // amount of wheel movement
DWORD dwExtraInfo // 32 bits of application-defined information
);
http://www.csdn.net/cnshare/soft/12/12349.shtm
hWnd:=FindWindow(nil,pchar('RealPlayer Plus'));SHOWWINDOW(hWnd,SW_RESTORE);