Click here to Skip to main content
15,911,039 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralOffice Automation Pin
Richard Ellis8-Nov-01 14:10
Richard Ellis8-Nov-01 14:10 
GeneralRe: Office Automation Pin
Christian Graus8-Nov-01 14:26
protectorChristian Graus8-Nov-01 14:26 
GeneralRe: Check VB sample! Pin
Masaaki Onishi8-Nov-01 14:52
Masaaki Onishi8-Nov-01 14:52 
GeneralRe: Office Automation Pin
Richard Ellis8-Nov-01 16:10
Richard Ellis8-Nov-01 16:10 
GeneralBeginning Windows CE Pin
8-Nov-01 11:48
suss8-Nov-01 11:48 
GeneralHelp with more than one window Pin
ParaSwarm8-Nov-01 10:30
ParaSwarm8-Nov-01 10:30 
GeneralRe: Help with more than one window Pin
Christian Graus8-Nov-01 10:51
protectorChristian Graus8-Nov-01 10:51 
GeneralRe: Help with more than one window Pin
ParaSwarm8-Nov-01 11:39
ParaSwarm8-Nov-01 11:39 
Sure, here's some code..

This is MAIN.


int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
// define variables
static TCHAR MainClass[] = "GRE",TestClass[]="Test";
static HWND wndMain,wndTest;
MSG msg;
WNDCLASS wndclass,testclass;
strcat(AboutPacer,AboutPacer2);


wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
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 (LTGRAY_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = MainClass;
testclass.style = CS_HREDRAW | CS_VREDRAW;
testclass.lpfnWndProc = WndProc;
testclass.cbClsExtra = 0;
testclass.cbWndExtra = 0;
testclass.hInstance = hInstance;
testclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
testclass.hCursor = LoadCursor (NULL, IDC_ARROW);
testclass.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_BRUSH);
testclass.lpszMenuName = NULL;
testclass.lpszClassName = TestClass;



if(!RegisterClass (&wndclass))
{
MessageBox (NULL, "This program requires Windows NT.", MainClass, MB_ICONERROR);
return 0;
}

if(!RegisterClass (&testclass))
{
MessageBox (NULL, "This program requires Windows NT.", TestClass, MB_ICONERROR);
return 0;
}


//Create all windows
wndMain = CreateWindow (MainClass, "GMAT/GRE INTRODUCTION", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 80, 80, 650, 450, NULL, NULL, hInstance, NULL);
wndTest = CreateWindow (TestClass, "Test", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 80, 80, 650, 450, NULL, NULL, hInstance, NULL);


ShowWindow(wndMain, SW_SHOWNORMAL);
UpdateWindow(wndMain);


Then in window wndMain's procedure, I try to show the test window I created earlier... (this is a portion of the procedure, not the whole thing)

case WM_COMMAND:

if(lParam==cmdAbout)
{
SetWindowText(txtMain,AboutPacer);
}
else if (lParam==cmdInstructions)
{
SetWindowText(txtMain,instructions);
}
else if(lParam==cmdStart)
{
ShowWindow(wndTest,SW_SHOWMAXIMIZED);


}

it says wndTest doesn't exist. This is obvously because wndTest was declared in MAIN and not procedure, but I dont know how to work this then. Any ideas?
GeneralRe: Help with more than one window Pin
Christian Graus8-Nov-01 11:48
protectorChristian Graus8-Nov-01 11:48 
GeneralRe: Help with more than one window Pin
8-Nov-01 18:44
suss8-Nov-01 18:44 
GeneralHELP - ReadDirectoryChangesW Pin
Dan Madden8-Nov-01 9:34
Dan Madden8-Nov-01 9:34 
GeneralRe: HELP - ReadDirectoryChangesW Pin
Carlos Antollini8-Nov-01 9:59
Carlos Antollini8-Nov-01 9:59 
GeneralRe: HELP - ReadDirectoryChangesW Pin
Joel Lucsy9-Nov-01 3:18
Joel Lucsy9-Nov-01 3:18 
GeneralDetect presence of key Pin
Peter Liddle8-Nov-01 9:06
Peter Liddle8-Nov-01 9:06 
GeneralMouse Cursor Control Pin
Vu Nguyen8-Nov-01 9:02
Vu Nguyen8-Nov-01 9:02 
GeneralRe: Mouse Cursor Control Pin
Michael Dunn8-Nov-01 9:08
sitebuilderMichael Dunn8-Nov-01 9:08 
GeneralSystray and Icons Pin
8-Nov-01 7:45
suss8-Nov-01 7:45 
GeneralRe: Systray and Icons Pin
Bernhard8-Nov-01 20:54
Bernhard8-Nov-01 20:54 
QuestionHow do you organize your shared source files? Pin
Todd Smith8-Nov-01 7:29
Todd Smith8-Nov-01 7:29 
AnswerRe: How do you organize your shared source files? Pin
Chris Losinger8-Nov-01 8:25
professionalChris Losinger8-Nov-01 8:25 
GeneralRe: How do you organize your shared source files? Pin
Jim A. Johnson8-Nov-01 13:04
Jim A. Johnson8-Nov-01 13:04 
GeneralRe: How do you organize your shared source files? Pin
Chris Losinger8-Nov-01 13:20
professionalChris Losinger8-Nov-01 13:20 
GeneralRe: How do you organize your shared source files? Pin
Rassman8-Nov-01 23:39
Rassman8-Nov-01 23:39 
AnswerRe: How do you organize your shared source files? Pin
Joaquín M López Muñoz8-Nov-01 8:27
Joaquín M López Muñoz8-Nov-01 8:27 
AnswerRe: How do you organize your shared source files? Pin
Michael P Butler8-Nov-01 9:01
Michael P Butler8-Nov-01 9:01 

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.