943,691 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 2535
  • C++ RSS
Mar 6th, 2009
0

Dev-cpp XP manifest file.

Expand Post »
Hello,
I've started learning how to make simple GUI programs in cpp using theforgers tutorial. However I was going to add XP style to my program and I found a page that showed me exacly how to do it for VC++ 6. The problem when I had added the lines in my resource.h file and my res.rc file was that my program refused to start. The window didn't show up. When I removed the line in the resourcefile it showed up again but with the old 95/98/ME/2000 style. What should i do to make it work.

This is my .rc file:
C++ Syntax (Toggle Plain Text)
  1. //Microsoft Developer Studio generated resource script.
  2. //
  3. #include "resource.h"
  4.  
  5.  
  6. #define APSTUDIO_READONLY_SYMBOLS
  7. /////////////////////////////////////////////////////////////////////////////
  8. //
  9. // Generated from the TEXTINCLUDE 2 resource.
  10. //
  11. #define APSTUDIO_HIDDEN_SYMBOLS
  12. #include "windows.h"
  13. #undef APSTUDIO_HIDDEN_SYMBOLS
  14.  
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. #undef APSTUDIO_READONLY_SYMBOLS
  18.  
  19. /////////////////////////////////////////////////////////////////////////////
  20. // English (U.S.) resources
  21.  
  22. #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
  23. #ifdef _WIN32
  24. LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
  25. #pragma code_page(1252)
  26. #endif //_WIN32
  27.  
  28. #ifdef APSTUDIO_INVOKED
  29. /////////////////////////////////////////////////////////////////////////////
  30. //
  31. // TEXTINCLUDE
  32. //
  33.  
  34. 1 TEXTINCLUDE DISCARDABLE
  35. BEGIN
  36. "resource.h\0"
  37. END
  38.  
  39. 2 TEXTINCLUDE DISCARDABLE
  40. BEGIN
  41. "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
  42. "#include ""windows.h""\r\n"
  43. "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
  44. "\0"
  45. END
  46.  
  47. 3 TEXTINCLUDE DISCARDABLE
  48. BEGIN
  49. "\0"
  50. END
  51.  
  52. #endif // APSTUDIO_INVOKED
  53.  
  54.  
  55. MANIFEST_RESOURCE_ID 24 MOVEABLE PURE "projekt1.exe.manifest"
  56.  
  57. /////////////////////////////////////////////////////////////////////////////
  58. //
  59. // Dialog
  60. //
  61.  
  62. IDD_MAIN DIALOG DISCARDABLE 0, 0, 207, 156
  63. STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
  64. CAPTION "Simply refreshed"
  65. FONT 8, "MS Sans Serif"
  66. BEGIN
  67. LTEXT "Username: ",IDC_STATIC,3,8,140,8
  68. LTEXT "Password: ",IDC_STATIC,3,22,140,8
  69. EDITTEXT IDC_USERNAME,40,7,70,12,ES_AUTOHSCROLL
  70. EDITTEXT IDC_PASSWORD,40,21,70,12,ES_PASSWORD
  71.  
  72.  
  73. PUSHBUTTON "Login",IDC_LOGIN,113,7,50,14
  74. PUSHBUTTON "&Remove",IDC_REMOVE,150,47,50,14
  75. PUSHBUTTON "&Clear",IDC_CLEAR,150,63,50,14
  76. LTEXT "This item was hhghghghghghgghhghgadded\njj",IDC_STATIC,7,141,66,16
  77. CTEXT "-",IDC_SHOWCOUNT,77,141,32,8
  78. LTEXT "times",IDC_STATIC,114,141,17,8
  79. END
  80.  
  81.  
  82. /////////////////////////////////////////////////////////////////////////////
  83. //
  84. // DESIGNINFO
  85. //
  86.  
  87. #ifdef APSTUDIO_INVOKED
  88. GUIDELINES DESIGNINFO DISCARDABLE
  89. BEGIN
  90. IDD_MAIN, DIALOG
  91. BEGIN
  92. LEFTMARGIN, 7
  93. RIGHTMARGIN, 200
  94. VERTGUIDE, 145
  95. VERTGUIDE, 150
  96. TOPMARGIN, 7
  97. BOTTOMMARGIN, 149
  98. END
  99. END
  100. #endif // APSTUDIO_INVOKED
  101.  
  102. #endif // English (U.S.) resources
  103. /////////////////////////////////////////////////////////////////////////////
and my resource.h file:

C++ Syntax (Toggle Plain Text)
  1. //{{NO_DEPENDENCIES}}
  2. // Microsoft Developer Studio generated include file.
  3. // Used by ctl_one.rc
  4. //
  5.  
  6. #define MANIFEST_RESOURCE_ID 1
  7.  
  8. #define IDC_STATIC -1
  9. #define IDD_MAIN 101
  10. #define IDC_TEXT 1000
  11. #define IDC_NUMBER 1001
  12. #define IDC_LIST 1002
  13. #define IDC_LOGIN 1003
  14. #define IDC_CLEAR 1004
  15. #define IDC_REMOVE 1005
  16. #define IDC_SHOWCOUNT 1007
  17. #define IDC_USERNAME 1006
  18. #define IDC_PASSWORD 1008
  19.  
  20.  
  21. // Next default values for new objects
  22. //
  23. #ifdef APSTUDIO_INVOKED
  24. #ifndef APSTUDIO_READONLY_SYMBOLS
  25. #define _APS_NEXT_RESOURCE_VALUE 102
  26. #define _APS_NEXT_COMMAND_VALUE 40001
  27. #define _APS_NEXT_CONTROL_VALUE 1009
  28. #define _APS_NEXT_SYMED_VALUE 101
  29. #endif
  30. #endif

Thanks.
Last edited by freddan007; Mar 6th, 2009 at 1:29 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
freddan007 is offline Offline
7 posts
since Mar 2009
Mar 6th, 2009
0

Re: Dev-cpp XP manifest file.

You haven't posted the manifest file.
Did you InitCommonControlsEx() ?
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008
Mar 6th, 2009
0

Re: Dev-cpp XP manifest file.

My manifest file:
C++ Syntax (Toggle Plain Text)
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  3. <assemblyIdentity
  4. version="1.0.0.0"
  5. processorArchitecture="X86"
  6. name="Zhorn.Styles.Styles"
  7. type="win32"
  8. />
  9. <description>Styles - demonstrate XP styles</description>
  10. <dependency>
  11. <dependentAssembly>
  12. <assemblyIdentity
  13. type="win32"
  14. name="Microsoft.Windows.Common-Controls"
  15. version="6.0.0.0"
  16. processorArchitecture="X86"
  17. publicKeyToken="6595b64144ccf1df"
  18. language="*"
  19. />
  20. </dependentAssembly>
  21. </dependency>
  22. </assembly>
I added InitCommonControlsEx(); at a random location but the compiler said it wasn't defined. What library is InitCommonControlsEx() in?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
freddan007 is offline Offline
7 posts
since Mar 2009
Mar 6th, 2009
0

Re: Dev-cpp XP manifest file.

InitCommonControlsEx (see the table at the bottom)
Try putting it in your WM_CREATE handler.
Reputation Points: 163
Solved Threads: 91
Posting Pro in Training
nucleon is offline Offline
476 posts
since Oct 2008
Mar 6th, 2009
0

Re: Dev-cpp XP manifest file.

I still get an error:
C++ Syntax (Toggle Plain Text)
  1. Main.cpp In function `BOOL DlgProc(HWND__*, UINT, WPARAM, LPARAM)':
  2. Main.cpp `InitCommonControlsEx' undeclared (first use this function)
  3. (Each undeclared identifier is reported only once for each function it appears in.)
  4. Makefile.win [Build Error] [Main.o] Error 1

My includes:
c++ Syntax (Toggle Plain Text)
  1. #include <windows.h>
  2. #include <commctrl.h>
  3. #include "resource.h"
  4. using namespace std;

I added the WM_CREATE in the Message switch

c++ Syntax (Toggle Plain Text)
  1. case WM_CREATE:
  2. InitCommonControlsEx();
  3. break;
Reputation Points: 10
Solved Threads: 0
Newbie Poster
freddan007 is offline Offline
7 posts
since Mar 2009
Mar 6th, 2009
0

Re: Dev-cpp XP manifest file.

Click to Expand / Collapse  Quote originally posted by freddan007 ...
I still get an error:
C++ Syntax (Toggle Plain Text)
  1. Main.cpp In function `BOOL DlgProc(HWND__*, UINT, WPARAM, LPARAM)':
  2. Main.cpp `InitCommonControlsEx' undeclared (first use this function)
  3. (Each undeclared identifier is reported only once for each function it appears in.)
  4. Makefile.win [Build Error] [Main.o] Error 1
In your project, #define _WIN32_IE to at least 0x0300 .

InitCommonControlsEx() takes a pointer to a INITCOMMONCONTROLSEX struct. You are not using the function correctly ...

Quote ...
I added the WM_CREATE in the Message switch
c++ Syntax (Toggle Plain Text)
  1. case WM_CREATE:
  2. InitCommonControlsEx();
  3. break;
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007
Mar 6th, 2009
0

Re: Dev-cpp XP manifest file.

I added
#define _WIN32_IE 0x0301
in resources.h and created the struct
c++ Syntax (Toggle Plain Text)
  1. INITCOMMONCONTROLSEX InitCtrlEx;
  2. InitCtrlEx.dwICC = ICC_STANDARD_CLASSES;
  3. InitCtrlEx.dwSize=sizeof(INITCOMMONCONTROLSEX);
  4. InitCommonControlsEx(&InitCtrlEx);
but the INITCOMMONCONTROLSEX seems to be undeclared:

C++ Syntax (Toggle Plain Text)
  1. Main.cpp `INITCOMMONCONTROLSEX' undeclared (first use this function)
  2.  
Reputation Points: 10
Solved Threads: 0
Newbie Poster
freddan007 is offline Offline
7 posts
since Mar 2009
Mar 6th, 2009
0

Re: Dev-cpp XP manifest file.

resource.h is not the place to define _WIN32_IE. Do it instead above the #includes, i.e.
C++ Syntax (Toggle Plain Text)
  1. #define _WIN32_IE 0x0301
  2. #include <windows.h>
  3. #include <commctrl.h>

Or alternatively in the project's configuration.
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007
Mar 6th, 2009
0

Re: Dev-cpp XP manifest file.

Thank you it works now! : D
Reputation Points: 10
Solved Threads: 0
Newbie Poster
freddan007 is offline Offline
7 posts
since Mar 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: cout did not appear and Nesting IF ELSE
Next Thread in C++ Forum Timeline: Linking static library to C++ DLL





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC