It is correct. I selected it from the dropdown list. Besides that when I use that same ID in with the CWinApp Message Map for the OnFilePrintSetup, it is no longer grayed and I can select it. It of course displays the Print Setup dialog, but does nothing. Here is some of the code from the project. I added the class KClass in with this code because I know the MyApp class works and if I uncomment the line of code in the MyApp message map, the print button becomes available. The code is very messy so please forgive me. I double checked to make sure that the ID for the print option matches the one in the code.
Code:
//
#include "StdAfx.h"
#include "TraceWin.h"
#include "resource.h"
#include "MainFrm.h"
#include "View.h"
#include "StatLink.h"
#include "PictCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//////////////////
// Standard application class
//
class CMyApp : public CWinApp {
public:
DECLARE_DYNAMIC(CMyApp)
virtual BOOL InitInstance();
protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnAppAbout();
};
class KClass : public CView {
public:
DECLARE_DYNAMIC(KClass)
virtual void OnDraw(CDC* pDC); // overridden to draw this view
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CMyApp, CWinApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
//ON_COMMAND(ID_FILE_PRINT, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()
BEGIN_MESSAGE_MAP(KClass, CView)
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
END_MESSAGE_MAP()
IMPLEMENT_DYNAMIC(KClass,CView)
IMPLEMENT_DYNAMIC(CMyApp, CWinApp)
CMyApp theApp;
KClass KApp;
BOOL CMyApp::InitInstance()
{
SetRegistryKey("MSDN Magazine"); // Save settings in registry, not INI file
LoadStdProfileSettings(8); // Standard file options (8 MRU files)
// initialize coolbars. Note: assumes you have
// comctl32.dll version 470 or greater
//
INITCOMMONCONTROLSEX sex;
sex.dwSize = sizeof(INITCOMMONCONTROLSEX);
sex.dwICC = ICC_COOL_CLASSES;
InitCommonControlsEx(&sex);
// Create standard doc/frame/view
AddDocTemplate(new CSingleDocTemplate(IDR_MAINFRAME,
RUNTIME_CLASS(CPictureDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CPictureView)));
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
return ProcessShellCommand(cmdInfo);
}
//////////////////
// Custom about dialog uses CStaticLink for hyperlinks.
// * for text control, URL is specified as text in dialog editor
// * for icon control, URL is specified by setting m_iconLink.m_link
//
class CAboutDialog : public CDialog {
protected:
// static controls with hyperlinks
CStaticLink m_wndLink1;
CStaticLink m_wndLink2;
CStaticLink m_wndLink3;
CPictureCtrl m_wndPict;
public:
CAboutDialog() : CDialog(IDD_ABOUTBOX) { }
virtual BOOL OnInitDialog();
};
/////////////////
// Initialize dialog: subclass static text/icon controls
//
BOOL CAboutDialog::OnInitDialog()
{
// subclass static controls. URL is static text or 3rd arg
m_wndLink1.SubclassDlgItem(IDC_STATICURLPD,this);
m_wndLink2.SubclassDlgItem(IDC_STATICURLMSDN,this);
m_wndPict.SubclassDlgItem(IDC_IMAGECATFLY,this);
return CDialog::OnInitDialog();
}
//////////////////
// Handle Help | About : run the About dialog
//
void CMyApp::OnAppAbout()
{
static CAboutDialog dlg;
dlg.DoModal();
}
///////////////////////////////////////////////////////////////////
// KPrintClass drawing
void KClass::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
// KPrintClass diagnostics
#ifdef _DEBUG
void KClass::AssertValid() const
{
CView::AssertValid();
}
void KClass::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
What do you think???
Thanks again,
Kendal