Answer the question
In order to leave comments, you need to log in
Handle not caught?
Not catching message box window handle
// simple.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <Windows.h>
#include <stdio.h>
void session_(LPVOID args)
{
MessageBox(NULL, L"What a you doing", L"Fuck this shit", MB_OK);
}
int main()
{
HANDLE* thread = (HANDLE*)malloc(sizeof(HANDLE) * 1);
thread[0] = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)(session_), 0, 0, 0);
long i;
HWND hWnd = NULL;
char sMsg[256] = { 0 };
system("chcp 1251");
while (TRUE)
{
//"#32770" äà ïðàâåëüíî ïîíÿëè ó MessageBox êëàññíºéì èìåííî òàêîé
if (!(hWnd = FindWindow(L"simple",NULL)))
printf("MessageBox is not detected\n");
else
{
for (i = 100000; 0 < i; i--)
{
if (GetDlgItemText(hWnd, i, (LPWSTR)sMsg, 256))
printf("MessageBox says (in ID %d) : %s\n", i, sMsg);
}
system("pause");
}
}
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question