|
From: Yohaan <jsh...@ho...> - 2007-03-29 16:29:56
|
I asked a question a bit ago through the list, however my terminology is no=
t correct. so in order to be able to pursue the learning process and focus =
thoughts, a rephrasing of the questions appears to be in order. Following i=
s the simpwin code from dev 4.9.9.2 : /* Creation of a simple Window=
s API program */#include <windows.h>/* Declare Windows procedure */LRESUL=
T CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);/* Make the class =
name into a global variable */char szClassName[ ] =3D "WindowsApp";int WIN=
APIWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, =
LPSTR lpszArgument, int nFunsterStil){ HWND hwnd; =
/* This is the handle for our window */ MSG messages; /* H=
ere messages to the application are saved */ WNDCLASSEX wincl; /*=
Data structure for the windowclass */ /* The Window structure */ win=
cl.hInstance =3D hThisInstance; wincl.lpszClassName =3D szClassName; =
wincl.lpfnWndProc =3D WindowProcedure; /* This function is called by w=
indows */ wincl.style =3D CS_DBLCLKS; /* Catch double-cl=
icks */ wincl.cbSize =3D sizeof (WNDCLASSEX); /* Use default icon and=
mouse-pointer */ wincl.hIcon =3D LoadIcon (NULL, IDI_APPLICATION); w=
incl.hIconSm =3D LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor =3D Loa=
dCursor (NULL, IDC_ARROW); wincl.lpszMenuName =3D NULL; =
/* No menu */ wincl.cbClsExtra =3D 0; /* No extra b=
ytes after the window class */ wincl.cbWndExtra =3D 0; =
/* structure or the window instance */ /* Use Windows's default colo=
r as the background of the window */ wincl.hbrBackground =3D (HBRUSH) CO=
LOR_BACKGROUND; /* Register the window class, and if it fails quit the p=
rogram */ if (!RegisterClassEx (&wincl)) return 0; /* The clas=
s is registered, let's create the program*/ hwnd =3D CreateWindowEx ( =
0, /* Extended possibilites for variation */ =
szClassName, /* Classname */ "Window App", /*=
Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ =
CW_USEDEFAULT, /* Windows decides the position */ CW_USED=
EFAULT, /* where the window ends up on the screen */ 544, =
/* The programs width */ 375, /* a=
nd height in pixels */ HWND_DESKTOP, /* The window is a ch=
ild-window to desktop */ NULL, /* No menu */ =
hThisInstance, /* Program Instance handler */ NULL =
/* No Window Creation data */ ); /* Make the wind=
ow visible on the screen */ ShowWindow (hwnd, nFunsterStil); /* Run t=
he message loop. It will run until GetMessage() returns 0 */ while (GetM=
essage (&messages, NULL, 0, 0)) { /* Translate virtual-key messag=
es into character messages */ TranslateMessage(&messages); /*=
Send message to WindowProcedure */ DispatchMessage(&messages); }=
/* The program return-value is 0 - The value that PostQuitMessage() gav=
e */ return messages.wParam;}/* This function is called by the Windows =
function DispatchMessage() */LRESULT CALLBACKWindowProcedure (HWND hwnd, U=
INT message, WPARAM wParam, LPARAM lParam){ switch (message) =
/* handle the messages */ { case WM_DESTROY: =
PostQuitMessage (0); /* send a WM_QUIT to the message queue */ =
break; default: /* for messages that we =
don't deal with */ return DefWindowProc (hwnd, message, wParam, =
lParam); } return 0;}1. a) Why when this code is a source file, does =
the window opened contain both the 'command console' style of window and th=
e window described by the code? b)What part of the linking and compiling pr=
ocess is the default window? c)2. In the array hwnd =3D CreateWindowEx the=
twelfth element appears to be the 'window creation data' does this allow m=
e to call a .rc from this element? 3. Is the message switch function where=
the messages are handled?These are obviously very basic questions, yet by =
the very asking I have seen a new manner of approach which could be fun. so=
thanks and take care....
_________________________________________________________________
Take a break and play crossword puzzles - FREE!
http://games.msn.com/en/flexicon/default.htm?icid=3Dflexicon_ wlmemailtagli=
nemarch07=
|