Closing a window with DestroyWindow() not working.
Apr 14, 2017 at 6:18pm UTC
I am messing around with some windows functiosn and i am trying to close the current window i am tabbed into yet for some reason it doesn't work and it didn't return an error
My Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
int main()
{
HWND curwind;
char ccurwind[256];
HWND newwind;
HWND wind2;
Sleep(1000);
printf("Destroying in 5...\n" );
Sleep(1000);
printf("Destroying in 4...\n" );
Sleep(1000);
printf("Destroying in 3...\n" );
Sleep(1000);
printf("Destroying in 2...\n" );
Sleep(1000);
printf("Destroying in 1...\n" );
curwind = GetForegroundWindow();
GetWindowTextA(curwind, ccurwind, 256);
//DestroyWindow(curwind);
if (DestroyWindow(curwind) == 0) {
printf("Failed with error: %s" , GetLastError());
}
else {
printf("\nDestroyed %s" , ccurwind);
}
getch();
return 0;
}
Topic archived. No new replies allowed.