[問題] 取 VMware 下的 StatusBar 文字

看板Programming作者 (zha0)時間17年前 (2008/03/05 14:54), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
http://img410.imageshack.us/img410/6057/nonamees3.gif
可以取檔案總管的,也可以取 Notepad 等, 但取的文字都是那種凹進去的,像 VMware 那種是平的就平不到,請問要怎麼取啊, 如果用 SB_SETTEXT 可以設,但是設了也是凹的,沒法設平的 Orz 自己畫上去的那種要怎麼取 @@ // VMProj.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "windows.h" #include "commctrl.h" HANDLE hFile; HWND wndStatus; BOOL CALLBACK EnumProc(HWND hwnd, LPARAM lParam) { TCHAR szBuf[2083]; //GetWindowText(hwnd, szBuf, 1024); GetClassName(hwnd, szBuf, 1024); /* strcat(szBuf, "\x0D\x0A"); WriteFile(hFile, szBuf, strlen(szBuf), &NumOf, NULL); */ if (GetClassName(hwnd, szBuf, 1024) && strstr(szBuf, "msctls_statusbar32")) { wndStatus = hwnd; } return !0; } BOOL GetStatusText(HWND hSB) { int iTotal, i, sbSize; DWORD dwPID, junk; HANDLE hProc; PBYTE bAddr; char szText[0x1000] = {0}; iTotal = SendMessage(hSB, SB_GETPARTS, 0, 0); if (iTotal <= 0) return FALSE; GetWindowThreadProcessId(hSB, &dwPID); hProc = OpenProcess(PROCESS_ALL_ACCESS, 0, dwPID); bAddr = (PBYTE) VirtualAllocEx(hProc, NULL, 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); for (i = 0; i < 1; i++)//iTotal { // sbSize = SendMessage(hSB, SB_GETTEXTLENGTH, i, 0); /* SendMessage(hSB, SB_GETTEXT, 0, (LPARAM) bAddr); ReadProcessMemory(hProc, bAddr, szText, 512, NULL); */ SendMessage(hSB, SB_GETTIPTEXT, i, (LPARAM) bAddr); ReadProcessMemory(hProc, bAddr, szText, 512, NULL); /* strcpy(szText, "aaaaaaaaaaaaaaaaaaaa"); WriteProcessMemory(hProc, bAddr, szText, sizeof("aaaaaaaaaaaaaaaaaaaa"), NULL); SendMessage(hSB, SB_SETTEXT, i, (LPARAM) bAddr); */ //ZeroMemory(szText, sizeof(szText)); MessageBox(NULL, szText, szText, NULL); } VirtualFreeEx(hProc, bAddr, NULL, MEM_RELEASE); CloseHandle(hProc); return TRUE; } int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hVM, hStatus; hVM = FindWindowEx(NULL, NULL, "VMUIFrame", NULL); //CabinetWClass //hStatus = FindWindowEx(hVM, NULL, "msctls_statusbar32", NULL); /* hFile = CreateFile("C:\\VMwnd.TXT", GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, 0, NULL); */ Sleep(5000); EnumChildWindows(hVM, EnumProc, 0); GetStatusText(wndStatus); // CloseHandle(hFile); return 0; } -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.73.254.33 zha0:轉錄至看板 C_and_CPP 03/05 14:55
文章代碼(AID): #17paEuyZ (Programming)
文章代碼(AID): #17paEuyZ (Programming)