Silberling

New Member
Joined
Sep 29, 2012
Messages
4
Hi.

I am working on a small and fast GUI wrapper for game and tool development. It has been a while that i worked with the win32 api.

Everything works fine except of the displayed window elements. As you can see in the attached picture, the text looks like Win 3.x ^^.

I applied a manifest like this one:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><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="amd64" publicKeyToken="6595b64144ccf1df" language="*"/>
    </dependentAssembly>
  </dependency>
</assembly>

And included it in the RC file
Code:
...
#include <windows.h>
#include <commctrl.h>
#include <winuser.h>

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "Window.exe.manifest"
...

Added the following code (part) to the core ui-element class:
Code:
class UIElement {
...

protected:
    static INITCOMMONCONTROLSEX icc;


public:
    UIElement() {
        ...
        // FIXME: Better way for that :-S
        if (! (UIElement::icc.dwSize > 0)) {
            UIElement::icc.dwSize = sizeof(UIElement::icc);
            UIElement::icc.dwICC = ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES | ICC_COOL_CLASSES;
            if (! InitCommonControlsEx(&UIElement::icc)) {
                MessageBox(NULL, TEXT("InitCommonControlsEx failed."), TEXT("Error"), MB_OK | MB_ICONINFORMATION);
            }
        }
        ...
    }

...
}

I really don't know how to get a nice Win7 UI, but this Win 3.x like style ^^.

Help is appreciated.

Thanx

Silberling

EDIT:
Oh i forgot:
TDM-GCC 4.7.1-tdm64-1, not Visual Studio
 

Attachments

  • Gnarr_2012-09-28_16-57-18.webp
    Gnarr_2012-09-28_16-57-18.webp
    2.7 KB · Views: 533
Last edited:
Solution
MVP in MSDN and a german forum helped:

I was told i have to specify fonts always on my own.

Code:
[FONT=Courier New]HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); [/FONT]
[FONT=Courier New]SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));[/FONT]

This helped.

Silberling

New Member
Joined
Sep 29, 2012
Messages
4
MVP in MSDN and a german forum helped:

I was told i have to specify fonts always on my own.

Code:
[FONT=Courier New]HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); [/FONT]
[FONT=Courier New]SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));[/FONT]

This helped.
 

Solution

AceInfinity

Senior Member
Microsoft MVP
Joined
Aug 12, 2011
Messages
161
I'm assuming what is happening is that it's taking fonts based on system default, so yes, then you'd have to specify your own.

EDIT:
Oh i forgot:
TDM-GCC 4.7.1-tdm64-1, not Visual Studio

TDM-GCC is a compiler suite, Visual Studio is an IDE, there can't be a comparison :topsy_turvy: