Menu

Manifest? winxp?

2006-06-22
2012-09-26
  • Nobody/Anonymous

    Hello. I have trouble when using "Support WinXP styles". My pushbutton and other controls don't show up at all. I have read some of the 2600 threats about this, but couldn't find an answer. I know it's something with the manifest file, but what? Project's _private.rc file shows that it IS included. What do I then have to do with it? I can't guess it because I don't know what a manifest is, don't know what it does and don't like the fact of including so much generated textual files in my program at all. Anyone know this by heart?

     
    • pronecracker

      pronecracker - 2006-07-23

      Sorry for bringing up such an old thread, but this may be important for answering questions: this
      http://sourceforge.net/forum/message.php?msg_id=3689118 turns out to be the same problm.

       
    • Nobody/Anonymous

      Is there another manifest file included in the resource file? Do the buttons show OK without the manifest file? You don't have to do anything with it except include it in the resources. The standard file generated by dev-cpp shouldn't have that kind of effect.

       
    • Nobody/Anonymous

      Only if I uncheck the WinXP styles option and delete the _private and the manifest, my controls will be there again, but no XP look...

      Dev-Cpp 4.9.9.0
      WinXP

       
    • pronecracker

      pronecracker - 2006-06-23

      Yup, the WinXP styles option brings down almost every program, including the examples distributed with dev. No more msgbox, common dialog, pushbutton or whatever.

       
    • Nobody/Anonymous

      I've used XP style with some of my apps, but I supplied my own manifest file instead of using the Dev option. Here's a copy of it.. hopefully the forum won't muck it up too much

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <assembly
      xmlns="urn:schemas-microsoft-com:asm.v1"
      manifestVersion="1.0">
      <assemblyIdentity
      processorArchitecture="x86"
      version="5.1.0.0"
      type="win32"
      name="app.exe"/>
      <description>Foo program</description>
      <dependency>
      <dependentAssembly>
      <assemblyIdentity
      type="win32"
      name="Microsoft.Windows.Common-Controls"
      version="6.0.0.0"
      publicKeyToken="6595b64144ccf1df"
      language="*"
      processorArchitecture="x86"/>
      </dependentAssembly>
      </dependency>
      </assembly>

      I put this in my resource script:

      ifdef XP_MANIFEST

      1 24 "winxp.manifest"

      endif

      Then I have this line in my resource.h file, and comment it out if I want to turn XP style off.

      define XP_MANIFEST

      Try that and let us know if it works, if not then there's something else at work.. perhaps something in the way the buttons are created or common controls initialized.

      b_a

       
    • Nobody/Anonymous

      Ah.. not mucked up except for indentation.. good

      I should have mentioned that you should save that manifest in a file named winxp.manifest and put it in the directory with your project.

      b_a

       
    • pronecracker

      pronecracker - 2006-06-23

      Thanx man. I will let ya know if it works.

       
    • pronecracker

      pronecracker - 2006-06-23

      Unfortunately it doesn't make any difference. My controls still don't show up,
      GetLastError() still returns 583...

       
    • Nobody/Anonymous

      I think technically you're supposed to change "app.exe" in that to the name of your program, but I didn't and it worked.

      Have you tried linking with -lcomctl32 and calling InitCommonControlsEx?

      There may also be some issue with the style of buttons, are you using flat buttons?
      Perhaps you could post some example code.

      b_a

       
    • pronecracker

      pronecracker - 2006-06-23
      • I changed "app.exe"

      I would enjoy linking comctl, but I ain't using any of the common controls. Only a standard button, as follows:
      hBtn = CreateWindow("button", "Don't click me", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 20, 20, 100, 100, hwnd, NULL, NULL);
      But I will try it.

       
    • pronecracker

      pronecracker - 2006-06-23

      MSDN says that 583 means ERROR_UNDEFINED_CHARACTER.
      Isn't that a bit strange? I'm not using unicode and am almost sure it's not such kind of proble,.

       
    • pronecracker

      pronecracker - 2006-06-24

      Would an install of 4.9.9.2 instead of 4.9.9.0 help?

       
    • pronecracker

      pronecracker - 2006-06-25

      I meant:
      hBtn = CreateWindow("button", "Don't click me", WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 20, 20, 100, 100, hwnd, NULL, _hInst, NULL);

       
    • Edmund Tudor

      Edmund Tudor - 2006-06-25

      Ok, stupid question time.. since you've given us so little information I have to ask.... are you actually running Windows XP?????

       
    • Edmund Tudor

      Edmund Tudor - 2006-06-25

      Ok... nevermind.. I looked again and it's there, didn't see it the first time.

      Well.. try this code, I took your button line and added it to the stock Dev windows app, turned on support xp themes and it works okay here.

      include <windows.h>

      / Declare Windows procedure /
      LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

      / Make the class name into a global variable /
      char szClassName[ ] = "WindowsApp";
      HANDLE hBtn;
      HINSTANCE _hInst;

      int WINAPI WinMain (HINSTANCE hThisInstance,
      HINSTANCE hPrevInstance,
      LPSTR lpszArgument,
      int nFunsterStil)

      {
      HWND hwnd; / This is the handle for our window /
      MSG messages; / Here messages to the application are saved /
      WNDCLASSEX wincl; / Data structure for the windowclass /

      /* The Window structure */
      wincl.hInstance = hThisInstance;
      wincl.lpszClassName = szClassName;
      wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
      wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
      wincl.cbSize = sizeof (WNDCLASSEX);
      
      /* Use default icon and mouse-pointer */
      wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
      wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
      wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
      wincl.lpszMenuName = NULL;                 /* No menu */
      wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
      wincl.cbWndExtra = 0;                      /* structure or the window instance */
      /* Use Windows's default color as the background of the window */
      wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
      
      /* Register the window class, and if it fails quit the program */
      if (!RegisterClassEx (&amp;wincl))
          return 0;
      
      /* The class is registered, let's create the program*/
      hwnd = CreateWindowEx (
             0,                   /* Extended possibilites for variation */
             szClassName,         /* Classname */
             &quot;Windows App&quot;,       /* Title Text */
             WS_OVERLAPPEDWINDOW, /* default window */
             CW_USEDEFAULT,       /* Windows decides the position */
             CW_USEDEFAULT,       /* where the window ends up on the screen */
             544,                 /* The programs width */
             375,                 /* and height in pixels */
             HWND_DESKTOP,        /* The window is a child-window to desktop */
             NULL,                /* No menu */
             hThisInstance,       /* Program Instance handler */
             NULL                 /* No Window Creation data */
             );
      
      /* Make the window visible on the screen */
      _hInst = hThisInstance;
      ShowWindow (hwnd, nFunsterStil);
      
      /* Run the message loop. It will run until GetMessage() returns 0 */
      while (GetMessage (&amp;messages, NULL, 0, 0))
      {
          /* Translate virtual-key messages into character messages */
          TranslateMessage(&amp;messages);
          /* Send message to WindowProcedure */
          DispatchMessage(&amp;messages);
      }
      
      /* The program return-value is 0 - The value that PostQuitMessage() gave */
      return messages.wParam;
      

      }

      / This function is called by the Windows function DispatchMessage() /

      LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
      {
      switch (message) / handle the messages /
      {
      case WM_CREATE:
      hBtn = CreateWindow("button", "Don't click me",
      WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, 20, 20, 100, 100,
      hwnd, NULL, _hInst, NULL);

              break;
          case WM_DESTROY:
              PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
              break;
          default:                      /* for messages that we don't deal with */
              return DefWindowProc (hwnd, message, wParam, lParam);
      }
      
      return 0;
      

      }

       
    • Edmund Tudor

      Edmund Tudor - 2006-06-25

      btw: running WinXP SP2 and dev 4.9.9.2

       
    • pronecracker

      pronecracker - 2006-06-25

      Mysteriously, it doesn't work okay here. GetLastError returns 583.

       
    • pronecracker

      pronecracker - 2006-06-25

      Now I opened an other test project, similar to this, with the xp option unchecked. I checked it, pressed F9 and there I got my XP look.

      (ok, the down button of the UpDown control looked a bit strange, and the Up button makes the value of the buddy decrease, but ok. This project uses commctrl with InitCommonControls() in the WinMain. I don't know if that makes a difference, but my pushbutton looked right as well.

      Oh and even though I linked -lcomctl32, the compiler didn't recognize INITCOMMONCONTROLSEX structure, so I decided to use InitCommonControls(). Don't know if that matters)

       
    • pronecracker

      pronecracker - 2006-06-25

      Oh sorry, 583 - that should be 183.
      My fault. I had converted a DWORD to a string by calling ltoa(), I didn't know how to do that.

      ERROR_ALREADY_EXISTS? That must also be a mistake.

       
    • pronecracker

      pronecracker - 2006-06-25

      It's exactly the same probem as in this threat:
      http://sourceforge.net/forum/message.php?msg_id=2285662

      Sometimes it works but most of the time it doesn't, and with mysterious reasons.

       
    • pronecracker

      pronecracker - 2006-06-25

      And this one:
      http://sourceforge.net/forum/message.php?msg_id=2335184

      There are hundreds of threads about this problem, but none of them seems to have their problem solved. What is this kinda mystery?

       
    • Edmund Tudor

      Edmund Tudor - 2006-06-25

      About InitCommonControlsEx, see this thread, and the thread it has a link to.

      http://sourceforge.net/forum/message.php?msg_id=2486139

      If the app I posted doesn't work I think it's not a problem with dev. You should be able to compile a program without support xp themes enabled, and then add a manifest in the same directory and it should change to xp theme.

      Here's something you can try with the code I posted, make a new folder, and start a new project in it with that code, compile without themes, and run.. you should get a window with a plain button.

      Now take the manifest code I posted earlier and paste it into notepad, then save it in the folder with the name "myapp.exe.manifest" except put the name you used for the exe file instead of "myapp"

      Run the exe file and it should have an xp style button. If it doesn't I would say the problem is in your OS.

      I've taken old apps I compiled under win95 with RapidQ (an old BASIC type language), put them on my XP machine, added that manifest file in the directory with them and got the xp styles, shouldn't have anything to do with the compiler. I've also done this on 3 different machines running XP, both SP1 and SP2, don't recall having a problem with buttons not showing up.

      I'm really interested to find out what's causing this.. tough one...

       
    • pronecracker

      pronecracker - 2006-06-27

      Thanks for the _WIN32_IE 0x0600 tip.
      Almost the same one as WINVER 0x0500 for TransparentBlt().

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.