Original Post
Hi all,
I have some problems about program design.
1. I created a class call MainWnd, it is the first created Window when the program start and it will initial data members. e.g. database connection object, network connection object.....
The MainWnd class is contained three menu items, when user clicked menu item1, item2 or item3, a mdi window will create and called MdiWnd1 MdiWnd2 or MdiWnd3. The three MdiWnds will use the MainWnd.Connection to access database.
My question is that should i set the connection data member static in MainWnd and then the three classes can use it without new instance? Or should i pass the connection object to the three mdiwnd classes for the reference when creating itself?
It seem the second solution beauty. However, it is unconvenient.
How can i make decision? Or any other solution?
2. How can i post/send a message to mdi from parent window or post/send message from parent window to mdi in .Net framework using C#?
3. I have a class call CWindow, it will contain a CallBack method call WinProc(....). And the the callback will used for te value of
WNDCLASSEX WinClassEx;
WinClassEx.lpfnWndProc = CWindow::WinProc;
What is the syntax? I tried the following syntax, but it doesn''t work.
//CWindow.h
class CWindow
{
......
static long WINAPI WinProc(.....);
}
//CWindow.cpp
#include "CWindow.h"
CWindow::CWindow()
{
......
WNDCLASSEX WinClassEx;
WinClassEx.lpfnWndProc = CWindow::WinProc;
.....
}
long CWindow::WinProc(...){....}
Pls help me to answer those question. It make me so tired. Thx a lot of ^_^