XP Style - Funktioniert nicht -.-



  • Ka.
    mit #ifdef _UNICODE hats bei mir auch net geklappt

    vieleicht kennt jochen ne antwort der kennt sich mit unicode Progs aus



  • Ascharan schrieb:

    Ka.
    mit #ifdef _UNICODE hats bei mir auch net geklappt

    Ich bin zwar nicht jochen, aber damit die Anweisungen vom Präprozessor dann auch abgearbeitet (und implementiert) werden, muss natürlich vorher auch ein

    #define _UNICODE
    

    rein.

    Und wenn das Prog schon Unicode unterstützen soll, noch zusätzlich

    #define UNICODE
    


  • nur funktioniert der code ja nich wie er ihn verwendete



  • Wenn er zuerst auch nicht gegen die comctl32.lib gelinkt hat und auch keinen Funktionsaufruf InitCommonControls verwendet hat wird das ganze auch nicht funktionieren.



  • Hallo,

    @Analog Bit

    Bei einen Freund funktioniert es nur mit den Zeilen:

    #ifdef _UNICODE
    #if defined _M_IX86
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #elif defined _M_IA64
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #elif defined _M_X64
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #else
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #endif
    #endif
    

    Ohne das er irgend wo:

    #include <commctrl.h>
    
    #pragma comment(lib,"Comctl32.lib")
    ...
    InitCommonControls(); 
    ...
    

    Defeniert ist! Das ist ja das was mich verwundert. Warum ist das bei Ihm so einfach und bei mir etwas komplizierter?!

    Gruß Funjoy


  • Mod

    Das geht bei mir genauso. Alerdings muss Dein Projektein UNICODE Projekt sein. das machen die äußeren ifdef's!



  • Hallo

    Also ich bin der Freund/Kumpel.

    Wir haben beide zum gleichen Zeitpunkt VC 2005 Exp. Edition installiert mit SP1 und PDSK.
    Keiner hat was an die Einstellungen geändert. Bei mir funktioniert der Code anstandslos bei ihn nicht. Komisch 🙂

    Naja jetzt funz es ja.

    BTW: Tolles Forum 👍



  • Ich habe es bei mir auch probiert, allerdings ohne VC, dafür mit [guck unten in die sigi^^]. Einmal habe ich es mit der resourcen-variante probiert, und dann mit den InitCommonControls ()-blabla. Es hat beides nicht geklappt. Liegt das daran, dass ich kein VC benutze oder woran liegt das?

    Mfg Ominion



  • Der Compiler spielt keine Rolle. Das OS schaut ja nicht, mit welchem Compiler was erstellt wurde.
    Du musst nur das Manifest einbetten (ist nicht zwigend nötig, geht auch mit externem Manifest) und die passende Resource-Typ/ID vergeben.



  • na gut, dann probiere ich das nochmal...mal sehen, aber erstmal danke 🙂

    Mfg Ominion



  • funktioniert auch nicht...hier mal der code:

    main.cpp

    #include <windows.h>
    #include <commctrl.h>
    
    #pragma comment (lib, "libs/cw32mt.lib")
    #pragma comment (lib, "libs/comctl32.lib")
    
    #if defined _M_IX86
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #elif defined _M_IA64
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #elif defined _M_X64
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #else
    #pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
    #endif
    
    #include "header/resource.h"
    
    HWND hMain;
    
    HINSTANCE g_hInst;
    LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
    
    int WINAPI WinMain (HINSTANCE hI, HINSTANCE hPrI, LPSTR szCmdLine, int iCmdShow)
    {
        InitCommonControls();
    
    	char MainWin[] = "Hauptfenster";
    
    	UNREFERENCED_PARAMETER (hPrI);
    	UNREFERENCED_PARAMETER (szCmdLine);
    
    	g_hInst = hI;
    	WNDCLASS wc;
    
    	wc.style = CS_HREDRAW | CS_VREDRAW;
    	wc.lpfnWndProc = WndProc;
    	wc.cbClsExtra = 0;
    	wc.cbWndExtra = 0;
    	wc.hInstance = hI;
    	wc.hIcon = LoadIcon (hI, MAKEINTRESOURCE (MAIN_ICON));
    	wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    	wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
    	wc.lpszMenuName = NULL;
    	wc.lpszClassName = MainWin;
    
    	RegisterClass (&wc);
    
    	int x = 410;
    	x += GetSystemMetrics (SM_CXDLGFRAME) * 2;	 //Breite des Rahmens * 2 (Links/Rechts)
    
    	int y = 250;
    	y += GetSystemMetrics (SM_CYCAPTION);		  //Höhe der Titelleiste
    	//y += GetSystemMetrics (SM_CYMENU);			//Höhe der Menu-Bar
    	y += GetSystemMetrics (SM_CYDLGFRAME) * 2;	 //Höhe des Rahmens * 2 (Oben/Unten)
    
    	int xPos = (GetSystemMetrics (SM_CXSCREEN) / 2) - (x / 2);
    	int yPos = (GetSystemMetrics (SM_CYSCREEN) / 2) - (y / 2);
    
    	hMain = CreateWindow (MainWin, "testfenster", WS_OVERLAPPEDWINDOW, xPos, yPos, x, y, NULL, NULL, hI, NULL);
    	ShowWindow (hMain, iCmdShow);
    	UpdateWindow (hMain);
    
    	MSG msg;
    	while (GetMessage (&msg, NULL, 0, 0))
    	{
    		TranslateMessage (&msg);
    		DispatchMessage (&msg);
    	}
    	return msg.wParam;
    }
    
    LRESULT CALLBACK WndProc (HWND hMain, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	PAINTSTRUCT ps;
    	HDC hDC;
    	HWND hBtn;
    
    	switch (message)
    	{
    		case WM_CREATE:
                hBtn = CreateWindow ("Button", "XP-STYLE", WS_CHILD | WS_VISIBLE, 5, 5, 123, 50, hMain, 0, g_hInst, NULL);
    		return 0;
    
            ...
    
    	}
    
    	return DefWindowProc (hMain, message, wParam, lParam);
    }
    

    res.rc

    #include "header/resource.h"
    
    MAIN_ICON ICON DISCARDABLE "images/icon.ico"
    
    ACCS ACCELERATORS DISCARDABLE
    BEGIN
        VK_ESCAPE,		ID_ACCEXIT		VIRTKEY,	NOINVERT
    END
    
    IDR_XPSTYLE            24      DISCARDABLE     "winxpstyle.bin"
    

    resource.h

    #define MAIN_ICON						100
    
    #define IDR_XPSTYLE                     101
    
    #define ID_ACCEXIT						2001
    

    hoffe es kann jemand helfen

    Mfg Ominion



  • Das
    #pragma comment(linker,"/manifestdependency: ....
    versteht nur der MS Compiler!
    Verwende das XML-Manifest und binde es als Resource ein!



  • habe ich doch eigentlich gemacht! das ist das hier:
    res.rc

    IDR_XPSTYLE            24      DISCARDABLE     "winxpstyle.bin"
    

    und darin steht:

    winxpstyle.bin

    <?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="ss"/>
     <description>sss</description>
     <dependency>
      <dependentAssembly>
        <assemblyIdentity
             type="win32"
             name="Microsoft.Windows.Common-Controls"
             version="6.0.0.0"
             publicKeyToken="6595b64144ccf1df"
             language="*"
             processorArchitecture="x86"/>
      </dependentAssembly>
     </dependency>
    </assembly>
    

    Mfg Ominion



  • *push* - weil es relativ dringend ist...brauch das für ne facharbeit, di muss im feb fertig sein

    Mfg Ominion


  • Mod

    Und IDR_XPSTYLE hat hoffentlich die ID 1?



  • *hust* ist das bescheuert, ja jetzt schon. danke an alle und an dich

    Mfg Ominion


Anmelden zum Antworten