最初由 hxsoft 发布
抢沙发座,支持一个。要是开源,一定很有价值。
帮楼主开源吧
.text:00401BE4 push eax
.text:00401BE5 call ds:GetCursorPos
.text:00401BEB mov ecx, [esp+24h]
.text:00401BEF mov edx, [esp+20h]
.text:00401BF3 push ecx
.text:00401BF4 push edx
.text:00401BF5 call ds:WindowFromPoint ; Get handle of the window that
.text:00401BF5 ; contains the specified poin
.text:00401BFB push eax
.text:00401BFC call sub_419B29
.text:00401C01 test eax, eax
.text:00401C03 jz loc_401DA3
.text:00401C09 mov edi, [eax+1Ch]
.text:00401C0C test edi, edi
.text:00401C0E jz loc_401DA3
.text:00401C14 mov eax, off_42E31C
.text:00401C19 mov dword ptr [esp+10h], 0
.text:00401C21 mov [esp+18h], eax
.text:00401C25 lea ecx, [esp+10h]
.text:00401C29 mov dword ptr [esp+1F4h], 0
.text:00401C34 push ecx
.text:00401C35 push edi
.text:00401C36 call ds:GetWindowThreadProcessId
.text:00401C3C mov edx, [esp+10h]
.text:00401C40 lea eax, [esp+18h]
.text:00401C44 push edx
.text:00401C45 push offset aD ; "%d"
.text:00401C4A push eax
.text:00401C4B call sub_4173CA
.text:00401C50 mov ecx, [esp+24h]
.text:00401C54 add esp, 0Ch
.text:00401C57 push ecx
.text:00401C58 lea ecx, [esi+98h]
.text:00401C5E call sub_41C1E3
.text:00401C63 mov edx, [esp+10h]
.text:00401C67 push edx
.text:00401C68 push 0
.text:00401C6A push 1F0FFFh
.text:00401C6F call ds:OpenProcess
.text:00401C75 push offset aPsapi ; "PSAPI"
.text:00401C7A mov ebx, eax
.text:00401C7C call ds:LoadLibraryA
.text:00401C82 push offset aGetmodulefilen ; "GetModuleFileNameExA"
.text:00401C87 push eax
.text:00401C88 call ds:GetProcAddress
.text:00401C8E lea ecx, [esp+6Ch]
.text:00401C92 push 80h
.text:00401C97 push ecx
.text:00401C98 push 0
.text:00401C9A push ebx
.text:00401C9B call eax ; unk_42E330
.text:00401C9D lea edx, [esp+30h]
.text:00401CA1 push 37h
.text:00401CA3 push edx
.text:00401CA4 push edi
.text:00401CA5 call ds:GetClassNameA
.text:00401CAB lea eax, [esp+30h]
.text:00401CAF lea ecx, [esp+1Ch]
.text:00401CB3 push eax
.text:00401CB4 call sub_417EBF
.text:00401CB9 mov ecx, [esp+1Ch]
.text:00401CBD push offset aEdit_0 ; "Edit"
.text:00401CC2 push ecx
.text:00401CC3 mov byte ptr [esp+1FCh], 1
.text:00401CCB call __mbscmp
.text:00401CD0 add esp, 8
.text:00401CD3 test eax, eax
.text:00401CD5 jnz short loc_401CF4
.text:00401CD7 push 0FFFFFFF0h
.text:00401CD9 push edi
.text:00401CDA call ds:GetWindowLongA
.text:00401CE0 test al, 20h
.text:00401CE2 jz short loc_401CF4
.text:00401CE4 lea edx, [esp+30h]
.text:00401CE8 push edx
.text:00401CE9 push 37h
.text:00401CEB push 0Dh
.text:00401CED push edi
.text:00401CEE call ds:SendMessageA
.text:00401CF4
.text:00401DB6 call ds:GetCursorPos
.text:00401DBC push 0
.text:00401DBE call ds:GetDC
.text:00401DC4 mov edx, [esp+2Ch]
.text:00401DC8 mov edi, eax
.text:00401DCA mov eax, [esp+28h]
.text:00401DCE push edx
.text:00401DCF push eax
.text:00401DD0 push edi
.text:00401DD1 call ds:GetPixel
.text:00401DD7 mov ecx, off_42E31C
.text:00401DDD mov ebx, eax
.text:00401DDF mov [esp+0Ch], ecx
.text:00401DE3 mov edx, ebx
所以:
COLORREF PeekColor()
{
HDC hScreenDC;
POINT CurrentPos;
GetCursorPos(&CurrentPos);
hScreenDC=GetDC(NULL);
rgb=GetPixel(hScreenDC,CurrentPos.x,CurrentPos.y);
ReleaseDC(NULL,hScreenDC);
return rgb
}
获得文件信息
HANDLE hProcess;
POINT CurrentPos;
HWND hWindow;
GetCursorPos(&CurrentPos);
hWindow=WindowFromPoint(CurrentPos)
hProcess= OpenProcess(PROCESS_ALL_ACCESS,
0,
GetWindowThreadProcessId(hWindow));
GetModuleFileNameEx(hProcess,NULL,ExeFileNameBuf,BufferSize)
GetClassName(hWindow,WinClassNameBuf,BufferSize);
SendMessage(hWindow,WM_GETTEXT,BufferSize,CaptionBuf);