NO

Author Topic: Just Learning  (Read 3265 times)

shamun.toha

  • Guest
Just Learning
« on: May 04, 2008, 07:02:39 PM »
' 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;
}

 

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Just Learning
« Reply #1 on: May 04, 2008, 07:37:28 PM »
chance this:
Code: [Select]
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)to this:
Code: [Select]
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
May the source be with you