Click here to Skip to main content
15,924,901 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Maximum value of unsigned long Pin
Joaquín M López Muñoz29-May-02 19:59
Joaquín M López Muñoz29-May-02 19:59 
GeneralRe: Maximum value of unsigned long Pin
Michael Dunn29-May-02 20:24
sitebuilderMichael Dunn29-May-02 20:24 
GeneralRe: Maximum value of unsigned long Pin
Joaquín M López Muñoz29-May-02 21:52
Joaquín M López Muñoz29-May-02 21:52 
GeneralRe: Maximum value of unsigned long Pin
Mike Nordell1-Jun-02 0:54
Mike Nordell1-Jun-02 0:54 
GeneralRe: Maximum value of unsigned long Pin
Michael Dunn1-Jun-02 6:22
sitebuilderMichael Dunn1-Jun-02 6:22 
GeneralRe: Maximum value of unsigned long Pin
Mike Nordell1-Jun-02 7:57
Mike Nordell1-Jun-02 7:57 
GeneralCreate a bitmap file Pin
Francis B.29-May-02 8:36
Francis B.29-May-02 8:36 
GeneralChange Font to the Default Printer! Pin
29-May-02 7:51
suss29-May-02 7:51 
Hi,

I have a Visual C++ 6.0 that uses a LictControl dialog, it works fine when I edit colums, rows on it! I also can print out its contents ... except:

a) I can not print the column titles
b) Somehow my fonts is very very small

PS: I do have a small zip project file ... I can not attach here. I can send to any one if I have the Email address!

- On the CNewDlg::OnInitDialog() ==> I insert colums titles and row text: OK!
- On the CNewDlg::OnBntPrint() ==> Please help in the // *********> actually do PRINTING here <******** (it locates at the end)

BOOL CNewDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    
    ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
    ASSERT(IDM_ABOUTBOX < 0xF000);

    CMenu* pSysMenu = GetSystemMenu(FALSE);
    if (pSysMenu != NULL)
    {
	CString strAboutMenu;
	strAboutMenu.LoadString(IDS_ABOUTBOX);
	if (!strAboutMenu.IsEmpty())
	{
	    pSysMenu->AppendMenu(MF_SEPARATOR);
	    pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
	}
     }

     SetIcon(m_hIcon, TRUE);			// Set big icon
     SetIcon(m_hIcon, FALSE);		// Set small icon
	
     // TODO: Add extra initialization here
	
     CString	temp, strSQL;
     LVCOLUMN	column;
     LVITEM     item;
     int        i;

     char*    guestListCol[9] = {"Room#", "Status", "FirstName", "LastName",
			             "CheckIn", "Until", "ExtraDays", "Adults", "Children"};

     column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
     column.fmt  = LVCFMT_LEFT;

     temp = "CHECK-IN GUEST LIST REPORT FOR   " + COleDateTime::GetCurrentTime().Format("%m/%d/%Y  %H:%M:%S"); 

     strSQL.Format ("SELECT * FROM CurrentGuestList WHERE GuestStatus = 'CheckIn'"); 

     UpdateData (false);

     for (i=0; i<9; i++)
     {
	column.cx   = 75;
	column.iSubItem = i;
	column.pszText  = guestListCol[i];
	m_report.InsertColumn (i, &column);
     }

     m_report.DeleteAllItems();
     item.mask     = LVIF_TEXT;
     item.iSubItem = 0;	
     i = 0;
 
     item.iItem = i;
     item.pszText = "dummy";
     m_report.InsertItem (&item);        
	
     m_report.SetItemText (i, 0, "101");
     m_report.SetItemText (i, 1, "Check-In");
     m_report.SetItemText (i, 2, "John");
     m_report.SetItemText (i, 3, "Senior");
     m_report.SetItemText (i, 4, "May/20/2002");
     m_report.SetItemText (i, 5, "May/22/2002");
     m_report.SetItemText (i, 6, "1");
     m_report.SetItemText (i, 7, "2");
     m_report.SetItemText (i, 8, "4");      
	
     return TRUE;  // return TRUE  unless you set the focus to a control
}

void CNewDlg::OnBntPrint() 
{
    CPrintDialog        dlg (FALSE);

    if (dlg.DoModal() == IDOK)
    {
	HDC hdc = dlg.GetPrinterDC();
	CDC dc;

        DOCINFO docinfo;
        memset(&docinfo, 0, sizeof(docinfo));
        docinfo.cbSize = sizeof(docinfo);
        docinfo.lpszDocName = _T("CDC::StartDoc() Code Fragment");

        dc.Attach(hdc);

        if (dc.StartDoc(&docinfo) < 0)
                   MessageBox(_T("Printer wouldn't initalize"));
        else
        {
	   if (dc.StartPage() < 0)
	   {
	       MessageBox(_T("Could not start page"));
	       dc.AbortDoc();
	   }
	   else   
	   {
               // *********> actually do PRINTING  here <********    
         
               m_report.Print(&dc, PRF_NONCLIENT);   // print frame
               m_report.Print(&dc, PRF_CLIENT);      // print contents
           }

           dc.EndPage();
           dc.EndDoc(); 
        }
    }
}


I tried to do a lot of things but failed, can anyone help me? Cry | :(( Cry | :(( Cry | :((

Thanks


ATC
GeneralEvery other letter Pin
Nnamdi Onyeyiri29-May-02 7:30
Nnamdi Onyeyiri29-May-02 7:30 
GeneralRe: Every other letter Pin
Nish Nishant29-May-02 8:04
sitebuilderNish Nishant29-May-02 8:04 
GeneralRe: Every other letter Pin
PJ Arends29-May-02 8:18
professionalPJ Arends29-May-02 8:18 
Generalconvert a CString to a char Pin
Nnamdi Onyeyiri29-May-02 7:14
Nnamdi Onyeyiri29-May-02 7:14 
GeneralRe: convert a CString to a char Pin
Lucky the code machine29-May-02 7:15
Lucky the code machine29-May-02 7:15 
GeneralRe: convert a CString to a char Pin
ed987129-May-02 7:17
ed987129-May-02 7:17 
GeneralRe: convert a CString to a char Pin
Martin Ziacek29-May-02 7:23
Martin Ziacek29-May-02 7:23 
GeneralRead / Write Registry Pin
Lucky the code machine29-May-02 7:08
Lucky the code machine29-May-02 7:08 
GeneralRe: Read / Write Registry Pin
Martin Ziacek29-May-02 7:19
Martin Ziacek29-May-02 7:19 
GeneralRe: Read / Write Registry Pin
Lucky the code machine29-May-02 7:17
Lucky the code machine29-May-02 7:17 
GeneralRe: Read / Write Registry Pin
Martin Ziacek29-May-02 7:28
Martin Ziacek29-May-02 7:28 
GeneralRe: Read / Write Registry Pin
Lucky the code machine30-May-02 2:15
Lucky the code machine30-May-02 2:15 
GeneralRe: Read / Write Registry Pin
Martin Ziacek29-May-02 7:31
Martin Ziacek29-May-02 7:31 
GeneralRe: Read / Write Registry Pin
Lucky the code machine29-May-02 7:29
Lucky the code machine29-May-02 7:29 
GeneralWindow Programming (Saving Results) Pin
29-May-02 7:01
suss29-May-02 7:01 
GeneralRe: Window Programming (Saving Results) Pin
Nish Nishant29-May-02 7:02
sitebuilderNish Nishant29-May-02 7:02 
GeneralCount Number of Items in a struct Pin
Anton A. Loukine29-May-02 6:36
Anton A. Loukine29-May-02 6:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.