Reading statusbar from another application
<p>I'm trying to read the text from another application's statusbar that contains multiple panels. How would I go about that. I have tried to allocate memory in the other application and read that buffer based on this:</p>

<p><a href="http://www.codeproject.com/Articles/5570/Stealing-Program-s-Memory" rel="nofollow">http://www.codeproject.com/Articles/5570/Stealing-Program-s-Memory</a></p>

<p>My current code is:</p>

<pre><code>GetWindowThreadProcessId(grxstatusbar, &amp;statusbarpid);
statusbarprocess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_QUERY_INFORMATION, FALSE, statusbarpid);

char* _buffer = nullptr;
char buffer[20];

_buffer = (char*)VirtualAllocEx(statusbarprocess, NULL, 20, MEM_COMMIT, PAGE_READWRITE);
WriteProcessMemory(statusbarprocess, _buffer, &amp;buffer, 20, NULL);

SendMessage(grxstatusbar, SB_GETTEXT, (WPARAM)0, (LPARAM)_buffer);
ReadProcessMemory(statusbarprocess, _buffer, buffer, 20, NULL);
VirtualFreeEx(statusbarprocess, _buffer, 0, MEM_RELEASE);
</code></pre>

<p>However, buffer is always just gibberish. What would be the best way to approach this problem.</p>