×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: DirectX SDK (for software developers) FAQ

skeleton

where do i start in building my ultimate game ? by NEVERSLEEP
Posted: 7 May 02 (Edited 8 May 02)

here the skeleton i use with my vc++6 compiler

// start m_ain.h
#include <windows.h>

// fonction prototypes
int WINAPI WinMain(
   HINSTANCE hInstance,
   HINSTANCE hPrevInstance,
   LPSTR lpCmdLine,
   int nShowCmd
);
LRESULT CALLBACK WindowProc(
   HWND hWnd,
   UINT uMsg,
   WPARAM wParam,
   LPARAM lParam
);
// end m_ain.h
// start m_ain.cpp
#include "m_ain.h"

int WINAPI WinMain(
   HINSTANCE hInstance,
   HINSTANCE hPrevInstance,
   LPSTR lpCmdLine,
   int nShowCmd)
{
   HWND hWnd;
   MSG Msg;
   WNDCLASSEX wcex = {
      sizeof(WNDCLASSEX),
      CS_CLASSDC,
      WindowProc,
      0L, 0L,
      hInstance,
      NULL, NULL, NULL, NULL,
      "GameClass", NULL };
   // register class exit on error
   if(!RegisterClassEx(&wcex))
      return FALSE;
   hWnd = CreateWindow(
      "skeleton", "the title",
      WS_OVERLAPPEDWINDOW,
      0, 0, 400, 400,
      NULL, NULL, hInstance, NULL);
   // return if error on CreateWindow
   if(hWnd == NULL)
      return FALSE;
   // show the window
   ShowWindow(hWnd, SW_SHOWNORMAL);
   UpdateWindow(hWnd);
   // Clear out message structure
   ZeroMemory(&Msg, sizeof(MSG));
   // loop until msg = exit
   while(Msg.message != WM_QUIT) {
      // peek into queue to see if there's message waiting
      if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
     TranslateMessage(&Msg);
     DispatchMessage(&Msg);
      } else {
     // time-crusial stuff
      }
   }
   // unreg class
   UnregisterClass("skeleton", hInstance);
   // exit
   return 0;
}
// MSG procedure
LRESULT CALLBACK WindowProc(
   HWND hWnd,
   UINT uMsg,
   WPARAM wParam,
   LPARAM lParam)
{
   switch(uMsg) {
      case WM_DESTROY:
         PostQuitMessage(0); // close app
         break;
      // handle other mesage here
      default: return DefWindowProc(hWnd, uMsg, wParam, lParam);
   }
   return 0;
}
// end m_ain.cpp



not much but here's my contribution

 

Back to Microsoft: DirectX SDK (for software developers) FAQ Index
Back to Microsoft: DirectX SDK (for software developers) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close