3

I can create button with CreateWindow function like

    CreateWindow(L"BUTTON", "Button label", WS_VISIBLE | WS_CHILD, 0, 0, 100, 25, parentWnd, ID, NULL, NULL);

It works perfect, but button has no glossy effects, font has no anti-aliasing.

I also compiled manifest:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="Win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
                        processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
    </dependentAssembly>
  </dependency>
</assembly>

Not sure, which token I must use, I got sample from some site. Then, I created resource list:

   CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "manifest.xml"

Compiled with:

   i686-w64-mingw32-windres -i resources.txt -OCOFF resources.res

And finally linked with resources.res, but with no any result.

When I created manifest and place it near my exe file - all works fine. But when I try to compile manifest into resources, I have no effect.

How to fix it? I prefer not to use any libs, especially large as Qt.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
bukkojot
  • 1,526
  • 1
  • 11
  • 16
  • 1
    You don't link the .rc file, you link the .res file – David Heffernan Sep 13 '17 at 08:24
  • Aero effect or do you have want your app to use new Windows XP/Vista/7 style theme? if yes then you will have to use create application manifest and initialize common controls – Asesh Sep 13 '17 at 09:02
  • When I created manifest and placed it near my exe file all works fine. But when I try to compile manifest into resources, I have no effect. – bukkojot Sep 13 '17 at 09:30
  • You are doing that wrong. You didn't provide full details, so we can't tell you what you did wrong. – David Heffernan Sep 13 '17 at 10:19
  • @bukkojot did you link to comctl32 and call InitCommonControls? Refer to this page: https://msdn.microsoft.com/en-us/library/windows/desktop/bb773175(v=vs.85).aspx – Asesh Sep 13 '17 at 11:20

1 Answers1

1

Edit:
Make sure CREATEPROCESS_MANIFEST_RESOURCE_ID is defined as 1

Or replace the manifest line with the following:

1 RT_MANIFEST "manifest.xml"

or

1 24 "manifest.xml"
Barmak Shemirani
  • 30,904
  • 6
  • 40
  • 77
  • 2
    @bukkojot: that means your dev environment is not defining the `CREATEPROCESS_MANIFEST_RESOURCE_ID` and/or `RT_MANIFEST` constants, thus you would end up creating a resource with an actual name of `"CREATEPROCESS_MANIFEST_RESOURCE_ID"` instead of an ID of 1, and/or a resource type with an actual name of `"RT_MANIFEST"` instead of a type of 24. Use a resource editor/viewer to verify – Remy Lebeau Sep 13 '17 at 18:37
  • Wrong solution. Best to embed resource. – David Heffernan Sep 13 '17 at 19:54
  • 1
    @DavidHeffernan What do you mean? This is supposed to be "embedded resource" solution. It should work without a separate "MYAPPNAME.exe.manifest" file present in the distribution package. Unless OP says otherwise. – Barmak Shemirani Sep 13 '17 at 20:35
  • No, user has put that xml file alongside the exe – David Heffernan Sep 13 '17 at 20:39
  • 1
    @DavidHeffernan Asker is already aware of non-embedded solution. See the original post where it says *"When I created manifest and place it near my exe file - all works fine. But when I try to compile manifest into resources, I have no effect"* The whole question is about embedded solution. – Barmak Shemirani Sep 13 '17 at 21:23
  • So can you explain what was was wrong and how your answer fixes it. – David Heffernan Sep 13 '17 at 21:25
  • 1
    @DavidHeffernan I think the only problem was that `CREATEPROCESS_MANIFEST_RESOURCE_ID` was not declared as `1`. I tried that on CodeBlock with MinGW, it works. Sometimes I add superstition to my post which don't really make sense. I deleted that part. – Barmak Shemirani Sep 13 '17 at 21:48