0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
Starting point for win32 based applications is WinMain()

WinMain begins by calling the API function RegisterClass to register a window class.

The window class(WNDCLASS) defines important characteristics of a window such as its window procedure address, its default background color, and its icon.
Once the WNDCLASS is registered, WinMain calls the all-important CreateWindow function to create the application's window.

WinMain follows CreateWindow with calls to ShowWindow and UpdateWindow, which make the window visible and ensure that its WM_PAINT handler is called immediately.

Next comes the message loop. In order to retrieve and dispatch messages, WinMain executes a simple while loop that calls the GetMessage, TranslateMessage, and DispatchMessage API functions repeatedly.

GetMessage checks the message queue. If a message is available, it is removed from the queue and copied to msg;
TranslateMessage converts a keyboard message denoting a character key to an easier-to-use WM_CHAR message,
and DispatchMessage dispatches the message to the window procedure. The message loop executes until GetMessage returns 0, which happens only when a WM_QUIT message is retrieved from the message queue. When this occurs, WinMain ends and the program terminates.
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
When we create Modal Dialog Box we can't move to other windows until this dialog is closed. For eg: MessageBox, where we can't move to the other window until we press ok or cancel.

When we create Modeless Dilaog Box we can swap to the other windows. For eg: like a conventional window.
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
In CommonDialogs class we have to use CFileDialog class where the first parameter TRUE for open dialog and FALSE for Save dialog.

For file open:
CFileDialog SampleDlg(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,"Text Files (*.txt)|*.txt|Comma Separated Values(*.csv)|*.csv||");

int iRet = SampleDlg.DoModal();
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
What is CSingleDocTemplate?

It’s a document template class used to create single document interface SDI applications. Only one document can be opened at a time. It identifies the document class used to manage the application's data, the frame window class that encloses views of that data, and the view class used to draw visual representations of the data. The document template also stores a resource ID that the framework uses to load menus, accelerators, and other resources that shape the application's user interface.
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
What is the difference between hinstance and hprevinstance in WinMain function?

hInstance is used for things like loading resources and any other task which is performed on a per-module basis. A module is either the EXE or a DLL loaded into your program. hPrevInstance used to be the handle to the previously run instance of your program (if any) in Win16. It is always NULL for Win32 programs.
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
MDI applications are designed using the doc-view architectures in which there could be many views associated with a single document object and an application can open multiple docuements at the same time for eg:WORD.
In MDI terms, your main window is called the Frame, this is probably the only window you would have in a SDI (Single Document Interface) program. In MDI there is an additional window, called the MDI Client Window which is a child of your Frame window. CMultiDocTemplate is the document template class used to create MDI applications..The document template also stores a resource ID that the framework uses to load menus, accelerators, and other resources that shape the application's user interface.

Last edited by rajeswaridvssnr; 30Oct2006 at 18:17..
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
CAnimateCtrl,CButton,CEdit,CListBox,CComboBox,CRic hEditCtrl,CStatic, CTreeCtrl,CToolTipCtrl,CIPAddressCtrl,CTabCtrl,CDa teTimeCtrl,CHeaderCtrl,CListCtrl,CMonthCalCtrl,COl eCtrl,CProgressCtrl,CScrollBar,CSliderCtrl,CStatus BarCtrl,CTollBarCtrl etc.,

Last edited by rajeswaridvssnr; 30Oct2006 at 18:17..
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
This message is sent to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed. This can be used to intialize the dialog controls or show/hide the controls etc.,

Last edited by rajeswaridvssnr; 30Oct2006 at 18:17..
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
This is to initialize data in a dialog box, or to retrieve and validate dialog data.
The framework automatically calls UpdateData with bSaveAndValidate set to FALSE when a modal dialog box is created in the default implementation of CDialog::OnInitDialog. The call occurs before the dialog box is visible. The default implementation of CDialog::OnOK calls this member function with bSaveAndValidate set to TRUE to retrieve the data, and if successful, will close the dialog box. If the Cancel button is clicked in the dialog box, the dialog box is closed without the data being retrieved.
0
rajeswaridvssnr's Avatar, Join Date: Oct 2006
Go4Expert Member
call UpdateAllViews()- which updates all views associated with the document by calling OnUpdate() function of all the views.