' I am not able to execute the simulator for this. After compile getting this following error.
C:\Program Files\PellesC\Projects\Prototype\main.c(18): error #2120: Redeclaration of 'WinMain' previously declared at C:\Program Files\PellesC\Include\WinCE\winbase.h(196): found 'int __stdcall function(HINSTANCE, HINSTANCE, wchar_t *, int)', expected 'int __cdecl function(HINSTANCE, HINSTANCE, wchar_t *, int)'.
C:\Program Files\PellesC\Projects\Prototype\main.c(31): warning #2030: = used in a conditional expression.
*** Error code: 1 ***
#include <windows.h>
#include <aygshell.h>
LRESULT MainWndProc(HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam)
{
if(message == WM_LBUTTONDOWN)
{
DestroyWindow(hWnd);
return 0;
}
return DefWindowProc(hWnd, message, uParam, lParam);
}
//--------------------------------------------------------------------------------------
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc = {0};
wc.style = CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) MainWndProc;
wc.hInstance = hInstance;
wc.hbrBackground = GetStockObject(WHITE_BRUSH);
wc.lpszClassName = L"myapp";
if(RegisterClass(&wc))
{
HWND hWndMain;
if(hWndMain = CreateWindow(L"myapp",L"Prototype",WS_VISIBLE,0,0,240,320,0,0,hInstance,0))
{
MSG msg;
SHFullScreen(hWndMain, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON | SHFS_HIDESIPBUTTON);
ShowWindow(hWndMain, SW_MAXIMIZE);
UpdateWindow(hWndMain);
ShowWindow(hWndMain, SW_MAXIMIZE);
UpdateWindow(hWndMain);
while(GetMessage(&msg,hWndMain,0,0))
DispatchMessage(&msg);
return msg.wParam;
}
}
return 0;
}