Created
April 5, 2024 09:02
-
-
Save zamabuvaraeu/6950e1d0e8225bce901acf59835efb46 to your computer and use it in GitHub Desktop.
Получение текста строки состояния
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define unicode | |
#include once "windows.bi" | |
#include once "win\commctrl.bi" | |
Dim hwndStatus As HWND = Cast(HWND, &H002B0BAC) | |
Dim ProcessId As DWORD = Any | |
Dim ThreadId As DWORD = GetWindowThreadProcessId(hwndStatus, @ProcessId) | |
Dim ProcessHandle As HANDLE = OpenProcess(PROCESS_ALL_ACCESS, 0, ProcessId) | |
Dim StatusBarParts As Integer = SendMessage(hwndStatus, SB_GETPARTS, 0, 0) | |
For i As Integer = 0 To StatusBarParts - 1 | |
Dim textLength As Integer = SendMessage(hwndStatus, SB_GETTEXTLENGTH, i, 0) | |
If textLength Then | |
Dim cbBytes As Integer = SizeOf(WString) * (textLength + 1) | |
Dim lpRemoteBuff As WString Ptr = VirtualAllocEx( _ | |
ProcessHandle, _ | |
NULL, _ | |
cbBytes, _ | |
MEM_COMMIT, _ | |
PAGE_READWRITE _ | |
) | |
If lpRemoteBuff Then | |
SendMessage(hwndStatus, SB_GETTEXT, i, Cast(LPARAM, lpRemoteBuff)) | |
Dim lpLocalBuf As WString Ptr = Allocate(cbBytes) | |
If lpLocalBuf Then | |
Dim Readed As Integer = Any | |
Dim resRead As BOOL = ReadProcessMemory( _ | |
ProcessHandle, _ | |
lpRemoteBuff, _ | |
lpLocalBuf, _ | |
cbBytes, _ | |
@Readed _ | |
) | |
If resRead Then | |
Print *lpLocalBuf | |
End If | |
Deallocate(lpLocalBuf) | |
End If | |
VirtualFreeEx(ProcessHandle, lpRemoteBuff, 0, MEM_RELEASE) | |
End If | |
End If | |
Next | |
CloseHandle(ProcessHandle) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment