I would like have my current console app made into win32 api

i want to have an interface for my program. I have no idea how to work with win32 api.

i would like to create just buttons as interface to select options in my program. At the moment i am using GetAsyncKeyState to do that.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
do
	{
	//Temperory solution for selecting click options
		if (*pforce_selection == FALSE)	//If force selection is true then option 3 is selected
		{
//check		cout << "\nInsert value:\n1.Left click\n2.Double click\n";
			if (GetAsyncKeyState(0x31))	//if keyboard buffer has 1
			{
				*pclick_function = 1;	//left click option
			}
			if (GetAsyncKeyState(0x32))	//if keyboard buffer has 2
			{
				*pclick_function = 2;	//right click option
			}
			if (GetAsyncKeyState(0x33))	//if keyboard buffer has 3
			{
				*pclick_function = 3;	//select or drag icon option
			}
		}
		//end click selection

		GT_Program (pGT_X, pGT_Y, pScreen_Res_X, pScreen_Res_Y, pclick_function, pforce_selection);
		
	//Read keyboard buffer for enter key to terminate
		if(GetAsyncKeyState(VK_ESCAPE))
		{
			cout << "\nTerminated by user\n" << endl;
			repeat = FALSE;	//Flag to terminate while loop
		}	//end if
	}
	while (repeat);


this is the part of the program that i need to select options.

How and what do i need to change to work in win32 api

How and what do i need to change to work in win32 api


The next six months of your life. That's how long eminent Windows Programming author Charles Petzold says it takes a professional C programmer coming from a console mode background to become proficient in writing Windows graphical user interfaces programs. However, (or so he says), by using his books he expects that down time could be reduced to perhaps 26 weeks or so.

I'd recommend getting Petzold's last book on 'Programming Windows' using the Api. Its pretty much the bible. It was published around 1998 I think. Also, there are a lot of tutorials on the web. Heck, I've written one myself. Its here...

http://www.jose.it-berater.org/smfforum/index.php?topic=3389.0
thx.

by the way, does my codings need to be in OOP to work in win32api??

by the way, does my codings need to be in OOP to work in win32api??


For one thing, you are already calling Win32Api functions in your code above - just not Win32Api functions that deal/create windows.

And no, OOP is an issue not really related to the Win32Api. The Win32Api was written before C++ came into very widespread use; it consists of several thousand functions written in C presumably. At least the documentation/SDK provided by Microsoft is in C. Some of the functions are possibly written in assembler for all I know and just prototyped in C because that is so common and important of a language.

You can create graphical user interfaces using the raw Api by calling the right functions; it doesn't matter whether you compile your programs as C or C++ programs. Personally, I always compile my programs as C++ programs that use the raw Api because I like to create my own classes for the various things I write programs about, i.e., 'business objects', so to speak. However, I prefer to leave Microsoft's interface to its operating system, i.e., its Api, the way it is and use it just as it is. I prefer to not use OOP frameworks such as MFC to 'wrap' the low level procedural Api. But that is a personal choice and preference of mine. Very many other programmers prefer to interface to Windows through an OOP class framework, i.e., .NET, MFC, etc. There are many pros/cons about either approach.
Oh, and I do have your program for you that creates buttons, etc, to launch various program options. There will be the main program window with three buttons on it that launches Program Options #1, #2, and #3. Clicking each of these buttons creates a seperate Window/Dialog/Form to take care of that modality of the program. The files involved in this are Main.cpp and Main.h. Then for the three Forms there are Form1.cpp, Form1.h, Form2.cpp, Form2.h, Form3.cpp and Form3.h. The program compiles to only 10,752 bytes unfortunately. However, if you are getting paid by the byte you could easily bloat it up to well over a megabyte with MFC or wxWidgets. Anyway, here is all the code. I'll start with Main.h...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//Main.h
#ifndef MAIN_H
#define MAIN_H
#define IDC_BUTTON_FORM1   1600
#define IDC_BUTTON_FORM2   1605
#define IDC_BUTTON_FORM3   1610

typedef struct    WindowsEventArguments
{
 HWND             hWnd;
 WPARAM           wParam;
 LPARAM           lParam;
 HINSTANCE        hIns;
}WndEventArgs, *lpWndEventArgs;


struct EVENTHANDLER
{
 unsigned int    Code;
 long            (*fnPtr)(lpWndEventArgs);
};
#endif 
Here's Main.cpp, i.e., the main program...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//Main.cpp                //Program displays a main Form/Window/Dialog With Three Buttons on it
#include <windows.h>      //to simulate a program started from a main Form with three modules/
#include <tchar.h>        //options/modalities within which it operates.  When you click the top
#include <stdio.h>        //button a new Form/Window/Dialog is created with CreateWindow() of
#include "Main.h"         //the "Form1" Window Class, and in the WM_CREATE handler of this new
#include "Form1.h"        //window it disables the main form with the three buttons and therefore
#include "Form2.h"        //is an example of a modal dialog.  When you dismiss this modal dialog
#include "Form3.h"        //and click on Button/Option #2 on the Main Form, a CreateWindow() call
EVENTHANDLER  MainEventHandler[3];   //creates a window of "Form2" Window Class, and in the
EVENTHANDLER  Form1EventHandler[4];  //WM_CREATE handler for this window it hides or makes
EVENTHANDLER  Form2EventHandler[4];  //invisible the main window.  After dismssing this window
EVENTHANDLER  Form3EventHandler[4];  //you'll find that you can click on the Option #3 button as
FILE* fp;                            //many times as you like because the window/form/dialog it
                                     //creates neither disables nor makes invisible the main
                                                      //window.  However, they all are created
long fnWndProc_OnCreate(lpWndEventArgs Wea)           //in the same location, so you'll need to
{                                                     //move them from on top of one another.
 DWORD dwStyle=WS_CHILD|WS_VISIBLE;                   //Further note that these Option #3
 TCHAR szClassName[16];                               //windows can be interacted with irregard-
 WNDCLASSEX wc;                                       //less of what ever is going on with the
 HWND hCtl;                                           //other windows.

 fp=_tfopen(_T("Output.txt"),TEXT("w"));
 _ftprintf(fp,_T("Entering fnWndProc_OnCreate()\n"));
 _ftprintf(fp,_T("  Wea->hWnd = %u\n"),(unsigned int)Wea->hWnd);
 Wea->hIns=((LPCREATESTRUCT)Wea->lParam)->hInstance;
 hCtl=CreateWindow(_T("button"),_T("Option #1"),dwStyle,65,15,120,25,Wea->hWnd,(HMENU)IDC_BUTTON_FORM1,Wea->hIns,0);
 hCtl=CreateWindow(_T("button"),_T("Option #2"),dwStyle,65,55,120,25,Wea->hWnd,(HMENU)IDC_BUTTON_FORM2,Wea->hIns,0);
 hCtl=CreateWindow(_T("button"),_T("Option #3"),dwStyle,65,95,120,25,Wea->hWnd,(HMENU)IDC_BUTTON_FORM3,Wea->hIns,0);

 //Register Window Classes For Form1, Form2 and Form3
 wc.cbSize=sizeof(WNDCLASSEX),                                 wc.style=CS_HREDRAW | CS_VREDRAW;
 wc.cbClsExtra=0,                                              wc.cbWndExtra=0;
 wc.hInstance=Wea->hIns,                                       wc.hIcon=LoadIcon(NULL, IDI_APPLICATION);
 wc.hIconSm=0,                                                 wc.hCursor=LoadCursor(NULL, IDC_ARROW);
 wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH),         wc.lpszMenuName=NULL;
 _tcscpy(szClassName,_T("Form1")),                             wc.lpszClassName=szClassName;
 wc.lpfnWndProc=fnForm1_WndProc;
 RegisterClassEx(&wc);

 _tcscpy(szClassName,_T("Form2"));
 wc.lpfnWndProc=fnForm2_WndProc;
 wc.lpszClassName=szClassName;
 RegisterClassEx(&wc);
 _tcscpy(szClassName,_T("Form3"));
 wc.lpszClassName=szClassName;
 wc.lpfnWndProc=fnForm3_WndProc;
 RegisterClassEx(&wc);
 _ftprintf(fp,_T("Leaving fnWndProc_OnCreate()\n\n"));

 return 0;
}


long btnForm1_Click(lpWndEventArgs Wea)
{
 HWND hWnd;

 _ftprintf(fp,_T("Entering btnForm1_Click()\n"));
 hWnd=CreateWindow(_T("Form1"),_T("Form1"),WS_OVERLAPPEDWINDOW,50,25,300,175,Wea->hWnd,(HMENU)0,GetModuleHandle(0),Wea->hWnd);
 ShowWindow(hWnd,SW_SHOWNORMAL);
 UpdateWindow(hWnd);
 _ftprintf(fp,_T("Leaving btnForm1_OnClick()\n\n"));

 return 0;
}


long btnForm2_Click(lpWndEventArgs Wea)
{
 HWND hWnd;

 _ftprintf(fp,_T("Entering btnForm2_Click()\n"));
 hWnd=CreateWindow(_T("Form2"),_T("Form2"),WS_OVERLAPPEDWINDOW,200,250,300,175,Wea->hWnd,(HMENU)0,GetModuleHandle(0),Wea->hWnd);
 ShowWindow(hWnd,SW_SHOWNORMAL);
 UpdateWindow(hWnd);
 _ftprintf(fp,_T("Leaving btnForm2_OnClick()\n\n"));

 return 0;
}


long btnForm3_Click(lpWndEventArgs Wea)
{
 HWND hWnd;

 hWnd=CreateWindow(_T("Form3"),_T("Form3"),WS_OVERLAPPEDWINDOW,600,500,300,240,Wea->hWnd,(HMENU)0,GetModuleHandle(0),Wea->hWnd);
 ShowWindow(hWnd,SW_SHOWNORMAL);
 UpdateWindow(hWnd);

 return 0;
}


long fnWndProc_OnCommand(lpWndEventArgs Wea)
{
 switch(LOWORD(Wea->wParam))
 {
    case IDC_BUTTON_FORM1:
      return btnForm1_Click(Wea);
    case IDC_BUTTON_FORM2:
      return btnForm2_Click(Wea);
    case IDC_BUTTON_FORM3:
      return btnForm3_Click(Wea);
 }

 return 0;
}


long fnWndProc_OnClose(lpWndEventArgs Wea)
{
 _ftprintf(fp,_T("Entering fnWndProc_OnClose()\n"));
 DestroyWindow(Wea->hWnd);
 PostQuitMessage(0);
 _ftprintf(fp,_T("Leaving fnWndProc_OnClose()\n"));
 fclose(fp);

 return 0;
}


void AttachEventHandlers(void)             //This procedure maps windows messages to the
{                                          //procedure which handles them.
 MainEventHandler[0].Code=WM_CREATE,        MainEventHandler[0].fnPtr=fnWndProc_OnCreate;
 MainEventHandler[1].Code=WM_COMMAND,       MainEventHandler[1].fnPtr=fnWndProc_OnCommand;
 MainEventHandler[2].Code=WM_CLOSE,         MainEventHandler[2].fnPtr=fnWndProc_OnClose;

 Form1EventHandler[0].Code=WM_CREATE,       Form1EventHandler[0].fnPtr=fnForm1_OnCreate;
 Form1EventHandler[1].Code=WM_CHAR,         Form1EventHandler[1].fnPtr=fnForm1_OnChar;
 Form1EventHandler[2].Code=WM_PAINT,        Form1EventHandler[2].fnPtr=fnForm1_OnPaint;
 Form1EventHandler[3].Code=WM_CLOSE,        Form1EventHandler[3].fnPtr=fnForm1_OnClose;

 Form2EventHandler[0].Code=WM_CREATE,       Form2EventHandler[0].fnPtr=fnForm2_OnCreate;
 Form2EventHandler[1].Code=WM_CHAR,         Form2EventHandler[1].fnPtr=fnForm2_OnChar;
 Form2EventHandler[2].Code=WM_PAINT,        Form2EventHandler[2].fnPtr=fnForm2_OnPaint;
 Form2EventHandler[3].Code=WM_CLOSE,        Form2EventHandler[3].fnPtr=fnForm2_OnClose;

 Form3EventHandler[0].Code=WM_CHAR,         Form3EventHandler[0].fnPtr=fnForm3_OnChar;
 Form3EventHandler[1].Code=WM_PAINT,        Form3EventHandler[1].fnPtr=fnForm3_OnPaint;
 Form3EventHandler[2].Code=WM_CLOSE,        Form3EventHandler[2].fnPtr=fnForm3_OnClose;
}


long __stdcall fnWndProc(HWND hwnd, unsigned int msg, WPARAM wParam,LPARAM lParam)
{
 WndEventArgs Wea;

 for(unsigned int i=0; i<3; i++)
 {
     if(MainEventHandler[i].Code==msg)
     {
        Wea.hWnd=hwnd, Wea.lParam=lParam, Wea.wParam=wParam;
        return (*MainEventHandler[i].fnPtr)(&Wea);
     }
 }

 return (DefWindowProc(hwnd, msg, wParam, lParam));
}


int __stdcall WinMain(HINSTANCE hIns, HINSTANCE hPrevIns, LPSTR lpszArgument, int iShow)
{
 TCHAR szClassName[]=_T("Form4");
 WNDCLASSEX wc;
 MSG messages;
 HWND hWnd;

 AttachEventHandlers();
 wc.lpszClassName=szClassName;                wc.lpfnWndProc=fnWndProc;
 wc.cbSize=sizeof (WNDCLASSEX);               wc.style=CS_DBLCLKS;
 wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);     wc.hInstance=hIns;
 wc.hIconSm=LoadIcon(NULL, IDI_APPLICATION);  wc.hCursor=LoadCursor(NULL,IDC_ARROW);
 wc.hbrBackground=(HBRUSH)COLOR_BTNSHADOW;    wc.cbWndExtra=0;
 wc.lpszMenuName=NULL;                        wc.cbClsExtra=0;
 RegisterClassEx(&wc);
 hWnd=CreateWindowEx(0,szClassName,szClassName,WS_OVERLAPPEDWINDOW,250,500,260,170,HWND_DESKTOP,0,hIns,0);
 ShowWindow(hWnd,iShow);
 while(GetMessage(&messages,NULL,0,0))
 {
    TranslateMessage(&messages);
    DispatchMessage(&messages);
 }

 return messages.wParam;
}
Here are Form1.h and Form1.cpp

1
2
3
4
5
6
7
8
9
10
//Form1.h
#ifndef FORM1_H
#define FORM1_H

long fnForm1_OnCreate(lpWndEventArgs);
long fnForm1_OnChar(lpWndEventArgs);
long fnForm1_OnPaint(lpWndEventArgs);
long fnForm1_OnClose(lpWndEventArgs);
long __stdcall fnForm1_WndProc(HWND, unsigned int, WPARAM, LPARAM);
#endif 



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//Form1.cpp
#include <Windows.h>
#include <tchar.h>
#include <stdio.h>
#include "Main.h"
#include "Form1.h"
extern EVENTHANDLER  Form1EventHandler[4];
extern FILE* fp;

long fnForm1_OnCreate(lpWndEventArgs Wea)
{
 CREATESTRUCT *pCreateStruct;
 HWND hMain;

 _ftprintf(fp,_T("  Entering fnForm1_OnCreate()\n"));
 pCreateStruct=(CREATESTRUCT*)Wea->lParam;
 hMain=(HWND)pCreateStruct->lpCreateParams;
 SetWindowLong(Wea->hWnd,GWL_USERDATA,(long)hMain);
 EnableWindow(hMain,FALSE);
 _ftprintf(fp,_T("    hMain = %u\n"),(unsigned int)hMain);
 _ftprintf(fp,_T("  Leaving fnForm1_OnCreate()\n"));

 return 0;
}


long fnForm1_OnChar(lpWndEventArgs Wea)
{
 return 0;
}


long fnForm1_OnPaint(lpWndEventArgs Wea)
{
 PAINTSTRUCT ps;
 HDC hDC;

 hDC=BeginPaint(Wea->hWnd,&ps);
 TextOut(hDC,0,0,_T("This Is Form1.  It Disables The Main"),36);
 TextOut(hDC,0,16,_T("Window, And That Makes It Modal.  Note"),38);
 TextOut(hDC,0,32,_T("That We Passed The Handle Of The Main"),37);
 TextOut(hDC,0,48,_T("Window In The Last Parameter Of The"),35);
 TextOut(hDC,0,64,_T("CreateWindow() Call, And Retrieved It In"),40);
 TextOut(hDC,0,80,_T("fnForm1_OnCreate().  We Then Stored It So"),41);
 TextOut(hDC,0,96,_T("We Could EnableWindow(TRUE) The Main"),36);
 TextOut(hDC,0,112,_T("Window When This Modal Form Is"),30);
 TextOut(hDC,0,128,_T("Dismissed."),10);
 EndPaint(Wea->hWnd,&ps);

 return 0;
}


long fnForm1_OnClose(lpWndEventArgs Wea)
{
 HWND hMain;

 hMain=(HWND)GetWindowLong(Wea->hWnd,GWL_USERDATA);
 EnableWindow(hMain,TRUE);
 DestroyWindow(Wea->hWnd);
 return 0;
}


long __stdcall fnForm1_WndProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM lParam)
{
 WndEventArgs Wea;

 for(unsigned int i=0; i<4; i++)
 {
     if(Form1EventHandler[i].Code==msg)
     {
        Wea.hWnd=hWnd, Wea.lParam=lParam, Wea.wParam=wParam;
        return (*Form1EventHandler[i].fnPtr)(&Wea);
     }
 }

 return (DefWindowProc(hWnd, msg, wParam, lParam));
}
Here's Form2.h and Form2.cpp

1
2
3
4
5
6
7
8
9
10
//Form2.h
#ifndef FORM2_H
#define FORM2_H

long fnForm2_OnCreate(lpWndEventArgs);
long fnForm2_OnChar(lpWndEventArgs);
long fnForm2_OnPaint(lpWndEventArgs);
long fnForm2_OnClose(lpWndEventArgs);
long __stdcall fnForm2_WndProc(HWND, unsigned int, WPARAM, LPARAM);
#endif 



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//Form2.cpp
#include <Windows.h>
#include <tchar.h>
#include <stdio.h>
#include "Main.h"
#include "Form2.h"
extern EVENTHANDLER  Form2EventHandler[4];
extern FILE* fp;

long fnForm2_OnCreate(lpWndEventArgs Wea)
{
 CREATESTRUCT *pCreateStruct;
 HWND hMain;

 _ftprintf(fp,_T("  Entering fnForm2_OnCreate()\n"));
 pCreateStruct=(CREATESTRUCT*)Wea->lParam;
 hMain=(HWND)pCreateStruct->lpCreateParams;
 SetWindowLong(Wea->hWnd,GWL_USERDATA,(long)hMain);
 ShowWindow(hMain,SW_HIDE);
 _ftprintf(fp,_T("    hMain = %u\n"),(unsigned int)hMain);
 _ftprintf(fp,_T("  Leaving fnForm2_OnCreate()\n"));

 return 0;
}


long fnForm2_OnChar(lpWndEventArgs Wea)
{
 return 0;
}


long fnForm2_OnPaint(lpWndEventArgs Wea)
{
 PAINTSTRUCT ps;
 HDC hDC;

 hDC=BeginPaint(Wea->hWnd,&ps);
 TextOut(hDC,0,0,_T("This Is Form2.  It SW_HIDEs The Main"),36);
 TextOut(hDC,0,16,_T("Window, And SW_SHOWs It Upon Closing."),37);
 TextOut(hDC,0,32,_T("This Technique Can Be Used Similiarly"),37);
 TextOut(hDC,0,48,_T("To A Modal Dialog If It Isn't Necessary To"),42);
 TextOut(hDC,0,64,_T("View Simultaneously A Form Underneath The"),41);
 TextOut(hDC,0,80,_T("Dialog With Which You Can't Interact"),36);
 TextOut(hDC,0,96,_T("Anyway"),6);
 EndPaint(Wea->hWnd,&ps);

 return 0;
}


long fnForm2_OnClose(lpWndEventArgs Wea)
{
 HWND hMain;

 hMain=(HWND)GetWindowLong(Wea->hWnd,GWL_USERDATA);
 EnableWindow(hMain,TRUE);
 DestroyWindow(Wea->hWnd);
 ShowWindow(hMain,TRUE);

 return 0;
}


long __stdcall fnForm2_WndProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM lParam)
{
 WndEventArgs Wea;

 for(unsigned int i=0; i<4; i++)
 {
     if(Form2EventHandler[i].Code==msg)
     {
        Wea.hWnd=hWnd, Wea.lParam=lParam, Wea.wParam=wParam;
        return (*Form2EventHandler[i].fnPtr)(&Wea);
     }
 }

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


...and finally Form3.cpp and Form3.h. You'll need to create a new Win32 GUI project in whatever IDE you are using. I used CodeBlocks but it shouldn't really matter.

1
2
3
4
5
6
7
8
9
10
//Form3.h
#ifndef FORM3_H
#define FORM3_H

long fnForm3_OnCreate(lpWndEventArgs);
long fnForm3_OnChar(lpWndEventArgs);
long fnForm3_OnPaint(lpWndEventArgs);
long fnForm3_OnClose(lpWndEventArgs);
long __stdcall fnForm3_WndProc(HWND, unsigned int, WPARAM, LPARAM);
#endif 



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//Form3.cpp
#include <Windows.h>
#include <tchar.h>
#include <stdio.h>
#include "Main.h"
#include "Form3.h"
extern EVENTHANDLER  Form3EventHandler[3];
extern FILE* fp;


long fnForm3_OnChar(lpWndEventArgs Wea)
{
 return 0;
}


long fnForm3_OnPaint(lpWndEventArgs Wea)
{
 PAINTSTRUCT ps;
 HDC hDC;

 hDC=BeginPaint(Wea->hWnd,&ps);
 TextOut(hDC,0,0,_T("This Is Form3.  Not Only Does It Neither"),40);
 TextOut(hDC,0,16,_T("Hide Nor Disable The Main Window, But"),37);
 TextOut(hDC,0,32,_T("You'll Find That You Can Create As Many"),39);
 TextOut(hDC,0,48,_T("Of These As You Like By Continually"),35);
 TextOut(hDC,0,64,_T("Clicking The Bottom Button On The Main"),38);
 TextOut(hDC,0,80,_T("Form.  However, You'll Have To Drag One"),39);
 TextOut(hDC,0,96,_T("From On Top Of The Other Because They"),37);
 TextOut(hDC,0,112,_T("All Appear In The Same Location.  You"),37);
 TextOut(hDC,0,128,_T("May Further Note That Since These"),33);
 TextOut(hDC,0,144,_T("Windows Are Neither Disabled Nor Hidden"),39);
 TextOut(hDC,0,160,_T("At Any Time, You May Interact With Them"),39);
 TextOut(hDC,0,176,_T("Irregardless Of The State Of Form1 Or"),37);
 TextOut(hDC,0,192,_T("Form2. Pretty Neat, Don't You Think?"),36);
 EndPaint(Wea->hWnd,&ps);

 return 0;
}


long fnForm3_OnClose(lpWndEventArgs Wea)
{
 HWND hMain;

 hMain=(HWND)GetWindowLong(Wea->hWnd,GWL_USERDATA);
 EnableWindow(hMain,TRUE);
 DestroyWindow(Wea->hWnd);
 ShowWindow(hMain,TRUE);

 return 0;
}


long __stdcall fnForm3_WndProc(HWND hWnd, unsigned int msg, WPARAM wParam, LPARAM lParam)
{
 WndEventArgs Wea;

 for(unsigned int i=0; i<3; i++)
 {
     if(Form3EventHandler[i].Code==msg)
     {
        Wea.hWnd=hWnd, Wea.lParam=lParam, Wea.wParam=wParam;
        return (*Form3EventHandler[i].fnPtr)(&Wea);
     }
 }

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


Ummm. I see I stubbed out the WM_CHAR handlers but forgot to write the code. Oh well, deduct 10% from my pay.

WOW thanks!!!!

ooh and Happy New Year and Hope U had a great christmas!!
Topic archived. No new replies allowed.