Using MFC built resources in VC++ code
Hi all,
I want to use MFC to build my gui interface for a map editor I''m creating, but I don''t want to write the functionality of it using MFC. Is it possible to use the resource file from the MFC built editor in my non-MFC code using strictly VC++(no MFC code)and the WinMain etc.
Thanks
--Casper )
...for over a thousand years the Jedi Knights have been the guardians of peace and justice..before the dark times..before the EmpireCasper..
Sure. The VC++ resource editor is just a regular resource editor at its heart, and you don''t need to use MFC to use it. When you create a resource script to add to your project, just select it and press Alt+Enter, to open its properties dialog box, and just uncheck "Enable MFC Features."
I think that should do it!
------------------------------
Jonathan Little
invader@hushmail.com
[link]http://www.crosswinds.net/~uselessknowledge[/link]
I think that should do it!
------------------------------
Jonathan Little
invader@hushmail.com
[link]http://www.crosswinds.net/~uselessknowledge[/link]
Hello,
I''m working on the same sort of issues as casper, it seems. I''ve added a resource.h file and a Resource.rc file to my Win32 project in VC++ 5.0, and I''m getting dthe following error:
cpp(403) : error C2664: ''LoadCursorA'' : cannot convert parameter 2 from ''const int'' to ''const char *''
when I try to use this chunk of code...
WNDCLASS wc;
HRESULT ddrval;
LPDIRECTDRAW pDD;
// Set up and register window class
wc.style = CS_HREDRAW / CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = sizeof(DWORD);
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_CURSOR1);
wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
...etc, etc...
The problem is in trying to set my cursor up with a macro to tell windows to use the cursor in the project. By reading the error message, it seems windows is trying to replace IDC_CURSOR1 with it''s numeral value from resource.h. I''m trying to get all the resources embedded in the .exe file. Judging from the size of the .exe, I''ve been able to do that. (the .exe is about 750kb) Now the problem is, how do I get windows to understand those handy little macros, like IDC_ARROW? I went and made sure that the MFC issue is o.k., as suggested in the previous post. Any suggestions are welcome.
Thanks,
Rog
I''m working on the same sort of issues as casper, it seems. I''ve added a resource.h file and a Resource.rc file to my Win32 project in VC++ 5.0, and I''m getting dthe following error:
cpp(403) : error C2664: ''LoadCursorA'' : cannot convert parameter 2 from ''const int'' to ''const char *''
when I try to use this chunk of code...
WNDCLASS wc;
HRESULT ddrval;
LPDIRECTDRAW pDD;
// Set up and register window class
wc.style = CS_HREDRAW / CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC) WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = sizeof(DWORD);
wc.hInstance = hInstance;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_CURSOR1);
wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL;
...etc, etc...
The problem is in trying to set my cursor up with a macro to tell windows to use the cursor in the project. By reading the error message, it seems windows is trying to replace IDC_CURSOR1 with it''s numeral value from resource.h. I''m trying to get all the resources embedded in the .exe file. Judging from the size of the .exe, I''ve been able to do that. (the .exe is about 750kb) Now the problem is, how do I get windows to understand those handy little macros, like IDC_ARROW? I went and made sure that the MFC issue is o.k., as suggested in the previous post. Any suggestions are welcome.
Thanks,
Rog
R.HillTigger@Bung.Org"Wasting Bandwidth since 1980"
Roger Hill: All the resource symbols (IDC_CURSOR1, IDD_DIALOG1, etc.) are just macros that VC++ uses to map to the integer IDs of the resources. Just cast the ID to an LPCSTR and it should work fine. In code, it would look like this:
Good Luck!
- null_pointer
wc.hInstance = LoadCursor(NULL, (LPCSTR) IDC_CURSOR1);
Good Luck!
- null_pointer
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement