Accelerator Resources  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| |
Okay, so the tutorial I'm using is creating Accelerator (Keyboard shortcuts) resources using Visual C++. I'm using DevC++ and was unable to find a similar function in their resource editor. So what I did was copy that part of his resource file. - IDR_ACCELERATOR1 ACCELERATORS
-
BEGIN
-
VK_F4, ID_ACC_F4, VIRTKEY, NOINVERT
-
VK_RETURN, ID_ACC_ENTER, VIRTKEY, NOINVERT
-
END
I'm getting a parse error for the line after BEGIN.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources
Just thought I'd give this a bump.
| | Member | | Join Date: Apr 2007 Location: Malaysia
Posts: 55
| | | re: Accelerator Resources
I don't understand what you doing here because i am a newbie. I would like to learn from you.
Thanks for oyur explanation.
Your help is greatly appreciated by me and others.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources
I've been looking on google but I've yet to find anything useful.
I tried copying over the tutorial's source files but I had to remove a lot of the stuff in resouce file that he didn't include in his files. I still got a parse error on that line.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources
Bumping the thread.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources
I'm not sure if there's no replies because no one knows the answer or because everyone thinks I'm already getting helped because of how many replies there are.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources
I'm gonna post another thread linking this one because I don't think anyone's actually looking at this thread.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources Accelerator Resources
The link is to a thread that I haven't received a response to. Thanks.
|  | Site Moderator | | Join Date: Jan 2007 Location: America
Posts: 3,392
| | | re: Accelerator Resources
I wasn't looking at this thread until I saw a double post! Shame, shame, Rabbit you should know better!
I suspect that DevC++ or whatever you are using doesn't know what VK_F4 is and that is your problem.
|  | Site Moderator | | Join Date: Jan 2007 Location: America
Posts: 3,392
| | | re: Accelerator Resources
Another thought occurs to me... have you compared the resource files of Visual Studio with the resource files of whatever you are looking at? Perhaps the syntax is slightly different. Or is Dev c++ strictly an IDE?
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources Quote:
Originally Posted by RedSon I wasn't looking at this thread until I saw a double post! Shame, shame, Rabbit you should know better!
I suspect that DevC++ or whatever you are using doesn't know what VK_F4 is and that is your problem. LOL, had to get attention for the unnoticed thread.
At least I waited half a month before double posting :)
I thought it may be that the syntax is different across the IDEs but I couldn't find an example for DevC++ so I really have no idea which part of the syntax is wrong.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources Quote:
Originally Posted by RedSon Another thought occurs to me... have you compared the resource files of Visual Studio with the resource files of whatever you are looking at? Perhaps the syntax is slightly different. Or is Dev c++ strictly an IDE? As far as I can tell, the syntax is the same for the most part, i.e. I copied the Visual C++ resource file and it likes most of it except for a couple of things.
1) The accerlerator syntax
2) There are some Includes in the Visual C++ Resource file that were not included in the tutorial package so I removed those, in which case everything works except for the Accelerators.
Only conclusion I can make is either the DevC++ syntax is different or those include files were Visual C++ only and were needed for the accelerators to work.
Edit: As far as I can tell from other examples I found online, they used the same syntax as the Visual C++. Unless of course all the examples were using Visual C++ lol.
|  | Site Moderator | | Join Date: Jan 2007 Location: America
Posts: 3,392
| | | re: Accelerator Resources Quote:
Originally Posted by Rabbit As far as I can tell, the syntax is the same for the most part, i.e. I copied the Visual C++ resource file and it likes most of it except for a couple of things.
1) The accerlerator syntax
2) There are some Includes in the Visual C++ Resource file that were not included in the tutorial package so I removed those, in which case everything works except for the Accelerators.
Only conclusion I can make is either the DevC++ syntax is different or those include files were Visual C++ only and were needed for the accelerators to work.
Edit: As far as I can tell from other examples I found online, they used the same syntax as the Visual C++. Unless of course all the examples were using Visual C++ lol. So does DevC++ have resource editors? If so can you make a new res and see what it looks like. Its gotta be that DevC++ doesnt understand what some of those constants are.
|  | AdministratorVoR | | Join Date: Feb 2006 Location: South West UK
Posts: 6,167
| | | re: Accelerator Resources
I have merged the threads so that this thread has it's context.
lets start with the basics in the line -
VK_F4, ID_ACC_F4, VIRTKEY, NOINVERT
-
VK_RETURN, ID_ACC_ENTER, VIRTKEY, NOINVERT
-
VK_F4 is defined in the windows headers (winuser.h) and VIRTKEY and NOINVERT are keywords used by the resource compiler.
ID_ACC_F4 is a symbol that must be #defined by you in a header somewhere.
So are you sure that you have defined ID_ACC_F4 somewhere and that that file is #included into the resource file?
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources Quote:
Originally Posted by RedSon So does DevC++ have resource editors? If so can you make a new res and see what it looks like. Its gotta be that DevC++ doesnt understand what some of those constants are. Yes DevC++ has a resource editor but it doesn't have an option to create an accelerator like Visual C++ does.
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources
The only difference from my source files and the tutorial's source files is the resource file and the resource.h file.
Below is the tutorials resource file. I #included "resource.h" in mines as well. I excluded everything after that until the the bitmap because 1) I have no idea what afxres.h was, it was never included in the tutorial files and the tutorial never went over it and 2) The same goes for all the APS Studio stuff.
I included everything from the bitmap to the accelerators. Everything after that doesn't seem to do anything anyways. Everything else works except for the accelerators. - // Microsoft Visual C++ generated resource script.
-
//
-
#include "resource.h"
-
-
#define APSTUDIO_READONLY_SYMBOLS
-
/////////////////////////////////////////////////////////////////////////////
-
//
-
// Generated from the TEXTINCLUDE 2 resource.
-
//
-
#include "afxres.h"
-
-
/////////////////////////////////////////////////////////////////////////////
-
#undef APSTUDIO_READONLY_SYMBOLS
-
-
/////////////////////////////////////////////////////////////////////////////
-
// English (U.S.) resources
-
-
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-
#ifdef _WIN32
-
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-
#pragma code_page(1252)
-
#endif //_WIN32
-
-
#ifdef APSTUDIO_INVOKED
-
/////////////////////////////////////////////////////////////////////////////
-
//
-
// TEXTINCLUDE
-
//
-
-
1 TEXTINCLUDE
-
BEGIN
-
"resource.h\0"
-
END
-
-
2 TEXTINCLUDE
-
BEGIN
-
"#include ""afxres.h""\r\n"
-
"\0"
-
END
-
-
3 TEXTINCLUDE
-
BEGIN
-
"\r\n"
-
"\0"
-
END
-
-
#endif // APSTUDIO_INVOKED
-
-
-
/////////////////////////////////////////////////////////////////////////////
-
//
-
// Bitmap
-
//
-
-
IDB_BITMAP1 BITMAP "portscanskin.bmp"
-
-
/////////////////////////////////////////////////////////////////////////////
-
//
-
// Icon
-
//
-
-
// Icon with lowest ID value placed first to ensure application icon
-
// remains consistent on all systems.
-
IDI_ICON1 ICON "icon1.ico"
-
IDI_ICON2 ICON "icon2.ico"
-
-
/////////////////////////////////////////////////////////////////////////////
-
//
-
// Accelerator
-
//
-
-
IDR_ACCELERATOR1 ACCELERATORS
-
BEGIN
-
VK_F4, ID_ACC_F4, VIRTKEY, NOINVERT
-
VK_RETURN, ID_ACC_ENTER, VIRTKEY, NOINVERT
-
END
-
-
#endif // English (U.S.) resources
-
/////////////////////////////////////////////////////////////////////////////
-
-
-
-
#ifndef APSTUDIO_INVOKED
-
/////////////////////////////////////////////////////////////////////////////
-
//
-
// Generated from the TEXTINCLUDE 3 resource.
-
//
-
-
-
/////////////////////////////////////////////////////////////////////////////
-
#endif // not APSTUDIO_INVOKED
-
The only difference between our resource.h files is that the tutorial has the following at the bottom of the file. Again I have no idea as to its function. -
#ifdef APSTUDIO_INVOKED
-
#ifndef APSTUDIO_READONLY_SYMBOLS
-
#define _APS_NEXT_RESOURCE_VALUE 108
-
#define _APS_NEXT_COMMAND_VALUE 40008
-
#define _APS_NEXT_CONTROL_VALUE 1001
-
#define _APS_NEXT_SYMED_VALUE 112
-
#endif
-
#endif
-
Everything I removed already existed long before the tutorial started on Accelerators and I removed them at that time as well to no ill effect.
The tutorial files also have a couple of .ncb, .suo, .sln, and .aps files that I don't know the purpose of.
|  | AdministratorVoR | | Join Date: Feb 2006 Location: South West UK
Posts: 6,167
| | | re: Accelerator Resources Quote:
Originally Posted by Rabbit The only difference between our resource.h files is that the tutorial has the following at the bottom of the file. Again I have no idea as to its function. -
#ifdef APSTUDIO_INVOKED
-
#ifndef APSTUDIO_READONLY_SYMBOLS
-
#define _APS_NEXT_RESOURCE_VALUE 108
-
#define _APS_NEXT_COMMAND_VALUE 40008
-
#define _APS_NEXT_CONTROL_VALUE 1001
-
#define _APS_NEXT_SYMED_VALUE 112
-
#endif
-
#endif
-
Everything I removed already existed long before the tutorial started on Accelerators and I removed them at that time as well to no ill effect.
The tutorial files also have a couple of .ncb, .suo, .sln, and .aps files that I don't know the purpose of. Humpff, I seem to remember talking to you about these #defines before, they should not be the problem.
The .ncb and .aps files are produced by MS DevStudio to hold the state of the project (which files are open, things like that) the .suo and .sln are the files that define the project (a bit like make files) so non of them should be required by Dev C++ which should have its own version of them.
|  | AdministratorVoR | | Join Date: Feb 2006 Location: South West UK
Posts: 6,167
| | | re: Accelerator Resources
Just found this on SourceForge.net (although it is a bit old), seems you are not the only person to have had problems with the resource compiler (assuming you are using windres) Quote:
Email Archive: mingw-users (read-only)
[Mingw-users] [mingw - Windows API] RE: windres can't parse my resource correctly
From: SourceForge.net <noreply@so...> - 2005-08-06 20:45
Read and respond to this message at:
https://sourceforge.net/forum/message.php?msg_id=3283395
By: ross_ridge
> is any windres option to avoid this problem?
Not that I'm aware of. There's a lot of problems with windres and it's
internationalization support seems to be pretty much hopeless. I've had better
luck using Microsoft's resource compiler (included free in the Platform SDK)
and using windres to convert the compiled resource files (.RES) in to COFF object
files that the GNU linker can deal with.
Though that doesn't always work either.
Ross Ridge
|  | Expert | | Join Date: Jan 2007 Location: California
Posts: 3,835
| | | re: Accelerator Resources Quote:
Originally Posted by Banfa Humpff, I seem to remember talking to you about these #defines before, they should not be the problem.
The .ncb and .aps files are produced by MS DevStudio to hold the state of the project (which files are open, things like that) the .suo and .sln are the files that define the project (a bit like make files) so non of them should be required by Dev C++ which should have its own version of them. Right, so everything I removed I had removed way before accelerators came into play. So I can only assume that the problem is either the syntax is different from Visual C++ and DevC++ or DevC++ does not support accelerators but they seem to be such an important part of window's that I can't really believe that's the issue. Maybe I'll have to contact the DevC++ team.
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,419 network members.
|