Topic: More fun at Toasty0's expense  (Read 2283 times)

0 Members and 1 Guest are viewing this topic.

Toasty0

  • Guest
More fun at Toasty0's expense
« on: December 21, 2003, 10:20:51 pm »
So there I was trying a new way to create a win32 window when to my tired di I receive during compilation but an error.

Oh what could that error be?

//Standard wondows include
#include

//Message Loop CallBack Function Prototype
LRESULT CALLBACK fnMessageProcessor (HWND, UINT, WPARAM, LPARAM);

//Function called automatically when the program starts
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
               int iCmdShow)

{
   HWND hWnd;
   MSG  msg;
   WNDCLASSEX wndclass;

   //Set up window class
   wndclass.cbSize    =sizeof(WNDCLASSEX);
   wndclass.style     =CS_HREDRAW | CS_VREDRAW;
   wndclass.lpfnWndProc =fnMessageProcessor;
   wndclass.cbClsExtra =0;
   wndclass.cbWndExtra =0;
   wndclass.hInstance  =hInstance;
   wndclass.hIcon      =LoadIcon(NULL, IDI_APPLICATION);
   wndclass.hCursor    =LoadCursor(NULL, IDC_ARROW);
   wndclass.hbrBackground=(HBRUSH) GetStockObject (WHITE_BRUSH);
   wndclass.lpszMenuName=NULL;
   wndclass.lpszClassName="Window Class";

   //Class Name
   wndclass.hIconSm     =LoadIcon(NULL, IDI_APPLICATION);

   //Register the window class
   if(RegisterClassEx(&wndclass)==0)
   {
      //the program failed, exit
      exit(1);
   }

   //Create the window
   hWnd=CreateWindowEx(
      WS_EX_OVERLAPPEDWINDOW,
      "Window Class",  //Class Name
      "Create Window Example", //Title bar text
      WS_OVERLAPPEDWINDOW,
      0,
      0,
      320,
      200,
      NULL,
      NULL,
      hInstance,
      NULL);

   //Display Window
   ShowWindow(hWnd, iCmdShow);

   //Process Messages until program is terminated
   while(GetMessage (&msg,NULL, 0, 0));
   {
      TranslateMessage(&msg);
      DispatchMessage(&msg);
   }

   return (msg.wParam);

}

//Message loop callBack function (Required for all windows programs)
LRESULT CALLBACK fnMessageProcessor(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
   switch(iMsg)
   {
      //Called when window is first created
   case WM_CREATE:
      return(0);
      //Called when window is refreshed
   case WM_PAINT:
      return(0);
      //Called when the user closes the window
   case WM_DESTROY:
      PostQuitMessage(0);
      return(0);
   default:
      return DefWindowProc(hWnd, iMsg, wParam, lParam);
   }
}


Any takers?

Best,
Jerry  

Karnak

  • Guest
Re: More fun at Toasty0's expense
« Reply #1 on: December 23, 2003, 10:05:36 pm »
Quote:

//Standard wondows include
#include




What file are you trying to include?  

 None is specified.    

Toasty0

  • Guest
Re: More fun at Toasty0's expense
« Reply #2 on: December 24, 2003, 12:33:01 am »
Damn, UBB, that's not the bug though but the UBB not posting a copy&past of <windows.h>

every once in a while the UBB likes the vomit out anything placed within carets. Sorry for the unintentional misdirection.

Best,
Jerry