XP Style - Funktioniert nicht -.-



  • 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