|
overloaded Name wrote: Context of the program: actually I am adding CPropertyPage s to CPropertySheet .
Which you should probably be doing in the sheet's constructor. Something like:
CMySheet::CMySheet(CWnd* pParentWnd , UINT iSelectPage )
:CPropertySheet(IDS_CAPTION_FRUITS, pParentWnd, iSelectPage)
{
AddPage(&m_page1);
AddPage(&m_page2);
AddPage(&m_page3);
AddPage(&m_page4);
}
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
DavidCrow wrote: Which you should probably be doing in the sheet's constructor
Yes. I have done that too. But eventually, the assertion is shown using that method too.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
Then something else is fundamentally wrong. Other than calling AddPage() in the sheet's constructor, and creating a dialog template for each page, that's all there is to it. Since you are not getting a compiler/linker error, we can assume there is a CPropertyPage -derived object in the sheet's .h file for each page you want added.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
class CString1Dlg : public CPropertyPage
{
public:
CString1Dlg(CWnd* pParent = NULL);
enum { IDD = IDD_STRING1_DLG };
Comparison of this code with previous one can be done here.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
Are you working with a DLL or EXE?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
EXE . This is solved now. As I said in earlier posts, Resource was missing. I was instantiating my CPropertySheet class in the wrong place. I was doing so in the constructor of my APP file like this.
CxyzApp::CxyzApp()
{
MySheet sheet = new MySheet(_T("My Sheet"));
}
But this was wrong. Controls are not loaded until InitInstance() is called. I should have instantiated my sheet class in the InitInstance() of APP like this
BOOL CxyzApp::InitInstance()
{
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
MySheet = new CEmplSheet(_T("My Sheet"));
if(MySheet != NULL)
m_pMainWnd = MySheet;
}
Thank you for you time.
This world is going to explode due to international politics, SOON.
|
|
|
|
|
overloaded Name wrote: I should have instantiated my sheet class in the InitInstance() of APP like this
Or you could have waited to construct the sheet object until it was actually called for. For example:
void CxyzApp::SomeFunction( void )
{
CEmplSheet sheet(_T("My Sheet"));
sheet.DoModal();
}
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
overloaded Name wrote: Now MAKEINTRESOURCE here, does not convert this ID to corresponding resource type.
It's not supposed to convert it to anything, it merely casts its type to the appropriate LPSTR so that the receiving function's definition is satisfied. The key issue is whether the value is correct and identifies a valid dialog template.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
I've got an SDI application created with VS2008. After some of the submenu item captions, I've added the tab escape sequence (\t) followed by the accelerator key I want (e.g., F2, F5). Visual Studio menu editor shows this correctly. The accelerator key table has also been updated. When I run the program, the submenu options work fine, but the accelerator keys do not show up in the submenu. Any obvious reason for this?
[edit]
It has something to do with a plain SDI app vs. one with a style and/or menu bar. I created another SDI app but opted for the standard style and the classic menu. My F5 accelerator key showed at run time.
[/edit]
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 18-Apr-12 12:20pm.
|
|
|
|
|
|
jkirkerx wrote: I didn't quite understand the question, you mean the F5 key is not doing it's thing, or F5 is not showing up in the SubMenu after the value?
The latter.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I'm not at your skill level, but I would create a new project as a test, and add the \t F5, and see if you get the same result.
|
|
|
|
|
jkirkerx wrote: ...I would create a new project as a test, and add the \t F5, and see if you get the same result. Same result. I created a new SDI project, ran it without any mods, and I see the stock set of accelerator keys in the submenus. So I created a menu and added a few submenu items, each with an accelerator key. For simplicity, I deleted IDR_MAINFRAME , and renamed my menu to IDR_MAINFRAME . Running the app now shows my menu and submenus but does not show the accelerator keys.
I took it one step further and rather than create a new menu to replace a stock one, I simply made a change to the IDR_MAINFRAME menu. For the Save option, I changed Ctrl+S to F2. While F2 shows up in the menu editor next to Save, when I run the app, Ctrl+S still shows up next to Save in the File menu. I also added F3 to one of the Office themes in the View menu. It does not show up at all. I've looked at the project's .rc file in Notepad and there's no sign of Ctrl+S. I've cleaned the project so it rebuilt everything.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 17-Apr-12 15:51pm.
|
|
|
|
|
I created a Win32 non empty test project in VS2008 and it worked fine. I hand edited the rc file, and added \t Alt-F5 to Exit in the File Column.
I doubt if this is of any help, but this is my rc file content from the test project. Perhaps there's something in there you don't have. I'm sure it's the \t that's terminating the menu item value, just not sure why.
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#undef APSTUDIO_READONLY_SYMBOLS
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#pragma code_page(1252)
IDI_MENUTESTDELETE ICON "MenuTestDelete.ico"
IDI_SMALL ICON "small.ico"
IDC_MENUTESTDELETE MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit\t Alt-F5", IDM_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About ...", IDM_ABOUT
END
END
IDC_MENUTESTDELETE ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
END
IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About MenuTestDelete"
FONT 8, "MS Shell Dlg"
BEGIN
ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20
LTEXT "MenuTestDelete, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
LTEXT "Copyright (C) 2012",IDC_STATIC,42,26,114,8
DEFPUSHBUTTON "OK",IDOK,113,41,50,14,WS_GROUP
END
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 163
TOPMARGIN, 7
BOTTOMMARGIN, 55
END
END
#endif // APSTUDIO_INVOKED
#ifdef APSTUDIO_INVOKED
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#ifndef APSTUDIO_INVOKED\r\n"
"#include ""targetver.h""\r\n"
"#endif\r\n"
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
STRINGTABLE
BEGIN
IDC_MENUTESTDELETE "MENUTESTDELETE"
IDS_APP_TITLE "MenuTestDelete"
END
#endif
#ifndef APSTUDIO_INVOKED
#endif // not APSTUDIO_INVOKED
|
|
|
|
|
jkirkerx wrote: I created a Win32 non empty test project SDI or dialog-based? If the former, what style did you opt for?
jkirkerx wrote: ...I hand edited the rc file, and added \t Alt-F5 to Exit in the File Column.
I did the same thing. It failed to show at runtime. It shows in the menu editor, however.
I still don't understand how I removed Ctrl+S earlier (there's no sign of it in the .rc file) and it still shows up at runtime.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Opened Visual Studio 2008 on Windows XP
New Project
Visual C++
Win32 Project
TestProject
OK
Welcome to the Win32 Application Wizard - Next
Windows Application
Finish
Right Clicked TestProject.rc - > View Code
Went to MENUITEM "E&xit"
typed in "E&xit\t Alt-F5"
Save
Run
I get the Exit tab Alt-F5 in the menu bar
I didn't add an accelerator to it, just wanted to see if it displays.
Properties
Use of MFC - Use Standard Windows Library
Use of ATL - Not using ATL
Character Set - Use Unicode Character Set
|
|
|
|
|
jkirkerx wrote: Opened Visual Studio 2008 on Windows XP New Project Visual C++ Win32 Project
The problem has to do with MFC.
[edit]
Related questions here and here.
[/edit]
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 18-Apr-12 11:13am.
|
|
|
|
|
I had the problem where the Alt-X worked for Exit, but my Alt-F5 work not do anything.
I loaded the accelerators,
HACCEL hAccelTable_Main, hAccelTable_Keys;
hAccelTable_Main = LoadAccelerators( hInstance, MAKEINTRESOURCE( IDR_NASE2012_SUWIZARD ));
hAccelTable_Keys = LoadAccelerators( hInstance, MAKEINTRESOURCE( IDA_KEYBOARD_ACCELERATORS ));
And then I realized I had to capture the messages. So now both sets of accelerators work concurrently.
while ((bReturn = GetMessage(&msg, NULL, 0, 0)) !=0) {
if (bReturn == -1) {
}
else {
if (( !TranslateAccelerator( g_hWndMainFrame, hAccelTable_Main, &msg )) && ( !TranslateAccelerator( g_hWndMainFrame, hAccelTable_Keys, &msg ))) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
|
|
|
|
|
I've done this before with Win32 and with dialog-based applications. Not something you typically have to do, however, with an SDI (MFC) application.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
That's why I started with win32, to learn the basics or foundation first. Then I can just perhaps upgrade my app to MFC.
Good to hear your accelerators work and display correctly now. I'm sure that was a head banger.
I'll be posting my head banger soon today, after I have exhausted Google, Docked toolbars.
|
|
|
|
|
The code below includes NameOfClass in debug build.
#ifdef _DEBUG
friend class NameOfClass;
#endif
How do I exclude NameOfClass from release build in vs2008?
Thanks
modified 16-Apr-12 11:54am.
|
|
|
|
|
You're already excluding it with that statement. If you want to exclude the whole class completely, wrap the include statement with that same pre-processor directive.
|
|
|
|
|
|
Hello,
I developed an MFC application in vs2008 and it works fine.
After compiling the project in vs2010 the program crushes when i run it(the compilation goes fine).
What could be the problem?
Thanks.
|
|
|
|
|
Your glurblecruncheon interfaced with your gobblewarts.
It's not sufficient to say that it crashes - what is it doing when it crashes? What environment is it running on? What does the code actually look like at this point? Is anything written to the event log?
|
|
|
|
|