|
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?
|
|
|
|
|
Does the application say anything when it crashes? Does it crash in both debug and release modes? Does it crash immediately or run for a while? If it crashes immediately, why not just look at the call stack to see where it crashes.
You need to provide a lot more information...
|
|
|
|
|
Dear friend don't worry it is a normal issue. The solution is available at http://connect.microsoft.com/VisualStudio/feedback/details/527167/upgraded-2008-project-compile-error-filetracker-dll
|
|
|
|
|
1. You should reply to the OP not to others who offer answers.
2. You should make your links clickable; like this[^].
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Perhaps you should have replied to the original poster, rather than to Albert. He isn't the one having the issue, and the original poster doesn't receive notifications of replies to other people.
|
|
|
|
|
Am really sorry, am new to this session
|
|
|
|
|
Have a look to the thread, Member4725068 gave a link where it is explained, which was reposted as a clickable link by Richard MacCutchan
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
I have been working with MFC for many years. I know the library and specially my way around to make my programs. Right now my career is not very into programming so I'm not over the newest and biggest wave around. Basically I’m programming for my pleasure and maintaining some programs I have. My doubts arise when you start seen winRT, .net and all those fireworks that we see every day. I want to keep doing what I do, but not be a dinosaur that someday realizes that it’s like still programming for Windows 98. What are your opinins and recommendations as what should be my next step (MFC, WinRT, TheBestFramerorkEver, etc.)
|
|
|
|
|