Quantcast
Results 1 to 3 of 3

Win32 API Dev Visual Styles difficulty

  1. #1
    Silberling is offline Junior Member
    Enjoys Windows 7 Forums
     
    Join Date
    Sep 2012
    Posts
    2
    Windows 7/Server 2008 R2 Chrome 22.0.1229.79

    Win32 API Dev Visual Styles difficulty

    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
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Gnarr_2012-09-28_16-57-18.png 
Views:	39 
Size:	21.7 KB 
ID:	21279  
    Last edited by Silberling; 09-29-2012 at 01:21 PM.

    Reply With Quote Reply With Quote

  2. #2
    Silberling is offline Junior Member Thread Starter Thread Starter
    Enjoys Windows 7 Forums
     
    Join Date
    Sep 2012
    Posts
    2
    Windows 7/Server 2008 R2 Chrome 22.0.1229.79

    Re: Win32 API Dev Visual Styles difficulty

    MVP in MSDN and a german forum helped:

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

    Code:
    HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); 
    SendMessage(hwnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(TRUE, 0));
    This helped.

    Reply With Quote Reply With Quote

  3. #3
    AceInfinity's Avatar
    AceInfinity is offline Member
    Computer Mainstream Pro
     
    Join Date
    Aug 2011
    Posts
    46
    Windows 8 Firefox 17.0

    Re: Win32 API Dev Visual Styles difficulty

    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

    VB/C# Programming - (2012 - Present)
    ®Crestron - DMC-T Certified Programmer


    ~ "The universe is an intelligence test." - Timothy Leary ~

    Reply With Quote Reply With Quote

Similar Threads

  1. Replies: 0
    Last Post: 06-30-2012, 05:44 AM
  2. Replies: 0
    Last Post: 04-05-2012, 06:33 AM
  3. In the dating game, speaking styles count: study
    By cybercore in forum The Water Cooler
    Replies: 0
    Last Post: 02-02-2011, 02:43 AM
  4. 3rd party software installation difficulty
    By Asker24 in forum Windows 7 Support
    Replies: 2
    Last Post: 07-20-2010, 12:11 AM
  5. Upgrade to RC version difficulty rumours
    By merlinau in forum Windows 7 Rumors and News
    Replies: 6
    Last Post: 04-08-2009, 04:17 PM

Visitors found this page by searching for:

Search engine data is still being processed!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •