Friday, November 4, 2011

More Windows in C programming language

Now that we know how to create a window let us create several windows on the screen. The program to do this is given below.
#include <windows.h>
int _stdcall WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                                     LPSTR lpszCmdLine, int nCmdShow )
{
HWND h[10] ;
int x ;
for ( x = 0 ; x <= 9 ; x++ )
{
h[x] = CreateWindow ( "BUTTON", "Press Me",
                                WS_OVERLAPPEDWINDOW, x * 20,
                                     x * 20, 150, 100, 0, 0, i, 0 ) ;
ShowWindow ( h[x], l ) ;
}
MessageBox ( 0, "Hi!", "Waiting", 0 ) ;
return 0 ;
}








 Note that each window created in this program is assigned a different handle. You may experiment a bit by changing the name of the window class to EDIT and see the result.


No comments:

Post a Comment