Ok I fixed the error but the message box in the function is not showing up. Here is my code:
PHP Code://Includes
#include <iostream.h>
#include <windows.h>
//Globals
HWND myhwnd=FindWindow("ConsoleWindowClass", NULL);
//Function Prototypes
void sleep(int milliseconds);
VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
int main()
{
SetTimer(myhwnd, 1, 1000, (TIMERPROC) &TimerProc);
cout << "Hello." << endl;
MessageBox(myhwnd, "Wow, I can make message boxes...haha", "WEEEEE!!!", MB_OK + MB_ICONSTOP);
cout << "Exiting in 2 seconds.\n";
//sleep(2000);
return 0;
}
void sleep(int milliseconds)
{
Sleep(milliseconds);
}
VOID CALLBACK TimerProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_TIMER message
UINT_PTR idEvent, // timer identifier
DWORD dwTime // current system time
)
{
MessageBox(myhwnd, "HELLO", "HELLO", MB_OK);
}




Reply With Quote