Click here to Skip to main content
15,897,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: auto start program when load Pin
Vietnight28-Dec-03 7:05
Vietnight28-Dec-03 7:05 
GeneralRe: auto start program when load Pin
valikac27-Dec-03 5:45
valikac27-Dec-03 5:45 
GeneralRe: auto start program when load Pin
Vietnight27-Dec-03 6:39
Vietnight27-Dec-03 6:39 
GeneralProject always out of date ?! Pin
ldaoust26-Dec-03 10:30
ldaoust26-Dec-03 10:30 
GeneralRe: Project always out of date ?! Pin
ldaoust26-Dec-03 11:15
ldaoust26-Dec-03 11:15 
GeneralHelp, can't resolve an error. Pin
Snyp26-Dec-03 8:28
Snyp26-Dec-03 8:28 
GeneralRe: Help, can't resolve an error. Pin
Michael Dunn26-Dec-03 8:49
sitebuilderMichael Dunn26-Dec-03 8:49 
GeneralRe: Help, can't resolve an error. Pin
Snyp26-Dec-03 9:03
Snyp26-Dec-03 9:03 
Try running the following: (I bought a book, programming role playing games with directx and this is the first sample, one problem, it gives me an error, this is off the cd:

/**************************************************
WinMain.cpp
Chapter 5 Shell Application

Programming Role-Playing Games with DirectX
by Jim Adams (01 Jan 2002)
**************************************************/

// Include files
#include <windows.h>
#include <stdio.h>

// Window handles, class and caption text
HWND g_hWnd;
HINSTANCE g_hInst;
static char g_szClass[] = "ShellClass";
static char g_szCaption[] = "Shell Application";

// Function prototypes
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev,
LPSTR szCmdLine, int nCmdShow);
long FAR PASCAL WindowProc(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam);

BOOL DoInit();
BOOL DoShutdown();
BOOL DoFrame();

int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev,
LPSTR szCmdLine, int nCmdShow)
{
WNDCLASSEX wcex;
MSG Msg;

g_hInst = hInst;

// Create the window class here and register it
wcex.cbSize = sizeof(wcex);
wcex.style = CS_CLASSDC;
wcex.lpfnWndProc = WindowProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInst;
wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = NULL;
wcex.lpszMenuName = NULL;
wcex.lpszClassName = g_szClass;
wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wcex))
return FALSE;

// Create the Main Window
g_hWnd = CreateWindow(g_szClass, g_szCaption,
WS_CAPTION | WS_SYSMENU,
0, 0, 400, 400,
NULL, NULL,
hInst, NULL );
if(!g_hWnd)
return FALSE;
ShowWindow(g_hWnd, SW_NORMAL);
UpdateWindow(g_hWnd);

// Run init function and return on error
if(DoInit() == FALSE)
return FALSE;

// Start message pump, waiting for signal to quit
ZeroMemory(&Msg, sizeof(MSG));
while(Msg.message != WM_QUIT) {
if(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
if(DoFrame() == FALSE)
break;
}

// Run shutdown function
DoShutdown();

UnregisterClass(g_szClass, hInst);

return Msg.wParam;
}

long FAR PASCAL WindowProc(HWND hWnd, UINT uMsg, \
WPARAM wParam, LPARAM lParam)
{
switch(uMsg) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;

}

return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

BOOL DoInit()
{
return TRUE;
}

BOOL DoShutdown()
{
return TRUE;
}

BOOL DoFrame()
{
return TRUE;
}

I have always had my suspicions about VB
GeneralRe: Help, can't resolve an error. Pin
Monty226-Dec-03 21:56
Monty226-Dec-03 21:56 
GeneralUse of MFC Pin
jdgonko26-Dec-03 6:57
jdgonko26-Dec-03 6:57 
GeneralRe: Use of MFC Pin
Ian Darling26-Dec-03 7:40
Ian Darling26-Dec-03 7:40 
GeneralRe: Use of MFC Pin
jdgonko26-Dec-03 8:57
jdgonko26-Dec-03 8:57 
GeneralRe: Use of MFC Pin
Monty226-Dec-03 21:29
Monty226-Dec-03 21:29 
GeneralCImage (the build in atl/mfc class) Pin
loading26-Dec-03 5:13
loading26-Dec-03 5:13 
GeneralMake Static Text (CEdit) to detect mouse click Pin
J.B.26-Dec-03 4:17
J.B.26-Dec-03 4:17 
GeneralRe: Make Static Text (CEdit) to detect mouse click Pin
valikac26-Dec-03 5:37
valikac26-Dec-03 5:37 
GeneralRe: Make Static Text (CEdit) to detect mouse click Pin
Michael Dunn26-Dec-03 6:31
sitebuilderMichael Dunn26-Dec-03 6:31 
GeneralRe: Make Static Text (CEdit) to detect mouse click Pin
J.B.26-Dec-03 17:42
J.B.26-Dec-03 17:42 
GeneralA perl question Pin
The_Server26-Dec-03 2:42
The_Server26-Dec-03 2:42 
GeneralRe: A perl question Pin
Prakash Nadar26-Dec-03 5:52
Prakash Nadar26-Dec-03 5:52 
GeneralUnexpted termination of Service. Pin
Prakash Nadar26-Dec-03 0:57
Prakash Nadar26-Dec-03 0:57 
GeneralCallback function Pin
Shah Shehpori26-Dec-03 0:46
sussShah Shehpori26-Dec-03 0:46 
GeneralRe: Callback function Pin
Gary R. Wheeler26-Dec-03 2:25
Gary R. Wheeler26-Dec-03 2:25 
GeneralCObList Pin
Ananya Kaul25-Dec-03 23:43
Ananya Kaul25-Dec-03 23:43 
GeneralRe: CObList Pin
Monty226-Dec-03 23:31
Monty226-Dec-03 23:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.