User ID:
Password:
Remember Me:
Forgot Password?
Not a member?
Click here for more information and to register.

    Log Book Control



    The CMMALogListBox class is a class for implementing a logbook in an application. The logbook can be used as a control (CMMALogListBox) or as a dialog which includes the control (CMMALogbookDlg). Using the CMMALogbookDlg class is very simple to use instead of the control himself. The logbook file will be automatically created. Here are some feature of my logbook :

    • Multilines
    • Colors
    • Fonts
    • Printing

    Using the CMMALogListBox Class

    To use CMMALogListBox class, you must do the following: 1. In the dialog resource, add a listbox (IDLB_LOGBOOK) and set the LVS_OWNERDRAWVARIABLE and LVS_SORT flags. And don't set the LVS_HASSTRING flag. 2. Add in the dialog message handler these lines (the dialog were you use the control) :
    if (message == WM_DRAWITEM 
    && (UINT)wParam == IDLB_LOGBOOK)
    {
     MMALogListBoxWndProc_DrawItem((LPDRAWITEMSTRUCT)lParam);
     return TRUE;
    }
    
    if (message == WM_MEASUREITEM 
    && if (UINT)wParam == IDLB_LOGBOOK)
    {
     MMALogListBoxWndProc_MeasureItem((LPMEASUREITEMSTRUCT)lParam);
     return TRUE;
    }
    
    3. Add a membre variable to the dialog like this :
    CMMALogListBox m_cMMALogListBox;
    
    4. In the WM_INITDIALOG message, call the attach function on the control class :
    m_cMMALogListBox.Attach(GetDlgItem(hDlg,IDLB_LOGBOOK), 
     "LOGBOOK.LOG", MAXLINES, TRUE);
    
    You can peer through the source code to see how to implement the CMMALogListBox class.

    Using the CMMALogbookDlg class

    For using CMMALogbookDlg class, you must do this : 1. Add a variable :
    CMMALogbookDlg cMMALogbookDlg;
    
    2. Create the logbook dialog box and show it :
    cMMALogbookDlg.CreateLogbookDlg(AfxGetInstanceHandle(), 
     NULL, "LOGBOOK.LOG", MAXLINES)
    
    cMMALogbookDlg.Show(TRUE);
    
    3. After using the logbook dialog, you must destroy it :
    cMMALogbookDlg.DestroyLogbookDlg();
    
    You can peer through the source code to see how to implement the CMMALogbookDlg class.

    Downloads

    Download demo project - 90 Kb
    Download source - 17 Kb

    IT Offers


    Top Authors