|
回复 25# 的帖子
给你段代码 能实现点击 但很不完善,如果要用需要自己好好改改。
void TB_Click(HWND hTB, int iIndex)
{
RECT rt;
unsigned long pid;
long res;
HANDLE process;
POINT *lP;
GetWindowThreadProcessId(hTB, &pid);
process=OpenProcess(PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE, FALSE, pid);
lP=(POINT*)VirtualAllocEx(process, NULL,1000,MEM_COMMIT, PAGE_READWRITE);
SendMessage(hTB, TB_GETITEMRECT, iIndex,&lP);
ReadProcessMemory(process, lP, &rt, sizeof(rt), NULL);
VirtualFreeEx(process, lP, 0, MEM_RELEASE);
CloseHandle(hTB);
SetCursorPos(rt.left,rt.top);
SendMessage(hTB, WM_LBUTTONDOWN, MK_LBUTTON,MAKELONG(rt.left,rt.top));
SendMessage(hTB, WM_LBUTTONUP, MK_LBUTTON,MAKELONG(rt.left,rt.top)) ;
}
不过没啥必要自己开发 太复杂了 也有点小难度 特别对代码不敏感的朋友 还是用最简单的好
[ 本帖最后由 lantianwei 于 2010-2-3 15:47 编辑 ] |
|