Progressbar - Subclassing



  • Hi.

    Ist echt nen super Forum hier mit hilfreichen Themen. Hab leider trotzdem noch leichte Probleme mit Subclassing. Möchte gern eine per Maus kontrollierbare Progressbar mit Prozentanzeige basteln. Ähnlich wie eine Volumebar. Kann mir bitte einer helfen?



  • Wie weit bist du denn? Was hast du denn schon? Woran happerts noch? Am Subclassing?
    So ist leider bissel schwer dir zu helfen weil ich nicht weis was dein Problem ist 😉

    MfG schirrmie





  • um erlich zu sein noch nicht sehr weit...

    Ich habs mal einfach mit einem lehren Fenster probiert. Aber leider reagiert die Progressbar noch nicht mal auf linksklick.

    #include <windows.h>
    #include <commctrl.h>
    #pragma comment(lib,"Comctl32.lib")
    
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    LRESULT CALLBACK ChildProc(HWND, UINT, WPARAM, LPARAM);
    
    const char szChildName[] = "Farbtabelle";
    const UINT PM_COLORCHANGED = WM_APP + 1;
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                       PSTR szCmdLine, int iCmdShow)
    {
       InitCommonControls();
    
       MSG        msg;
       HWND       hWnd;
       WNDCLASS   wc;
    
       char       szAppName[] = "Das Child Window";
    
       wc.cbClsExtra          = 0;
       wc.cbWndExtra          = 0;
       wc.hbrBackground       = (HBRUSH) GetStockObject(WHITE_BRUSH);
       wc.hCursor             = LoadCursor(NULL, IDC_ARROW);
       wc.hIcon               = LoadIcon(NULL, IDI_APPLICATION);
       wc.hInstance           = hInstance;
       wc.lpfnWndProc         = WndProc;
       wc.lpszClassName       = szAppName;
       wc.lpszMenuName        = NULL;
       wc.style               = CS_HREDRAW | CS_VREDRAW;
    
       RegisterClass(&wc);
    
       wc.hbrBackground       = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
       wc.hIcon               = NULL;
       wc.lpfnWndProc         = ChildProc;
       wc.lpszClassName       = szChildName;
    
       RegisterClass(&wc);
    
       hWnd = CreateWindow(   szAppName,
                              szAppName,
                              WS_OVERLAPPEDWINDOW,
                              CW_USEDEFAULT,
                              CW_USEDEFAULT,
                              CW_USEDEFAULT,
                              CW_USEDEFAULT,
                              NULL,
                              NULL,
                              hInstance,
                              NULL);
    
       ShowWindow(hWnd, iCmdShow);
       UpdateWindow(hWnd);
    
       while (GetMessage(&msg, NULL, 0, 0))
       {
          TranslateMessage(&msg);
          DispatchMessage(&msg);
       }
    
       return msg.wParam;
    }
    
    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    
       InitCommonControls();
    
       static HWND    hChild;
       static RECT    rect;
       static int     iColor = RGB(255, 255, 255);
    
       switch (message)
       {
       case WM_CREATE:
          {
             GetClientRect(hWnd, &rect);
    
    		InitCommonControls();
    
    		hChild = CreateWindowEx(0, PROGRESS_CLASS,
                               "", WS_CHILD | PBS_SMOOTH | WS_VISIBLE,
                               0, 0,
                               10, 10,
                               hWnd, NULL,
                               ((LPCREATESTRUCT) lParam)->hInstance, NULL);
    
             return 0;
          }
       case WM_SIZE:
          {
    
             rect.right  = LOWORD(lParam);
             rect.bottom = HIWORD(lParam);
    
             MoveWindow(hChild, 5, rect.bottom - 25, rect.right - 10, 20, TRUE);
    
             return 0;
          }
    
       case PM_COLORCHANGED:
          {
             iColor = wParam;
             InvalidateRect(hWnd, NULL, FALSE);
             return 0;
          }
    
       case WM_PAINT:
          {
             PAINTSTRUCT    ps;
             HDC            hDC;
    
             hDC = BeginPaint(hWnd, &ps);
             {
                HBRUSH hOldBrush = (HBRUSH) SelectObject(hDC, 
                                                  CreateSolidBrush(iColor));
    
                Rectangle(hDC, 0, 0, rect.right, rect.bottom);
    
                DeleteObject(SelectObject(hDC, hOldBrush));
             }
             EndPaint(hWnd, &ps);
             return 0;
          }
       case WM_DESTROY:
          {
             PostQuitMessage(0);
             return 0;
          }
       }
    
       return DefWindowProc(hWnd, message, wParam, lParam);
    }
    
    LRESULT CALLBACK ChildProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
       switch (message)
       {
    	   case WM_LBUTTONDOWN:
          {
    		 MessageBox (NULL, TEXT ("test"),
                             0, MB_ICONERROR) ;
    		  return 0;
    	  }
       }
    
       return DefWindowProc(hWnd, message, wParam, lParam);
    }
    


  • Hä da subclassed Du doch gar nix ? Guck Dir mal den Beispiel-Link an, den ich gepostet hab.

    PS: Man muss InitCommonControls nur einmal aufrufen!



  • Danke für den Link. Habs jetzt mal komplett so übernommen und abgeändert. Wie bastell ich jetzt am besten noch eine Prozentanzeige in die Progressbar. Am besten welche sich per klick auf die Progressbar ändert?



  • So hier noch die änderung:

    #include <windows.h>
    #include <commctrl.h> 
    #pragma comment(lib,"Comctl32.lib")
    
    static PrevWndProcEdit;
    
    LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM);
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    HWND hwnd, hwndEditAlt;
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance,
                       PSTR szCmdLine, int iCmdShow)
    {
       InitCommonControls();
       static TCHAR szAppName[] = TEXT("Progress Bar");
       MSG msg;
    
       WNDCLASS wndclass;
    
       wndclass.style = CS_HREDRAW | CS_VREDRAW;
       wndclass.lpfnWndProc = WndProc;
       wndclass.cbClsExtra = 0;
       wndclass.cbWndExtra = 0;
       wndclass.hInstance = hInstance;
       wndclass.hIcon = 0;
       wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
       wndclass.hbrBackground = (HBRUSH)COLOR_WINDOW;
       wndclass.lpszClassName = szAppName;
       wndclass.lpszMenuName = NULL;
    
    RegisterClass(&wndclass);
    
    wndclass.lpfnWndProc         = EditWndProc;
    
    RegisterClass(&wndclass);
    
       hwnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,szAppName, TEXT("LeWi-"), WS_OVERLAPPEDWINDOW,
                         CW_USEDEFAULT, CW_USEDEFAULT,
                         300, 300,
                         NULL, NULL, hInstance, NULL);
    
       ShowWindow(hwnd, iCmdShow);
       UpdateWindow(hwnd);
    
       while(GetMessage(&msg, NULL, 0, 0))
       {
          TranslateMessage(&msg);
          DispatchMessage(&msg);
       }
    
       return msg.lParam;
    }
    
    // Hauptnachrichtenschleife
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
       //static HWND hwndEditAlt;
    
       switch (message)
       {
       case WM_CREATE:
    // Editfeld erzeugen
          hwndEditAlt = CreateWindowEx(0, PROGRESS_CLASS, 
                               "", WS_CHILD | PBS_SMOOTH | WS_VISIBLE, 
                               10, 10, 
                               265, 20, 
                               hwnd, NULL, 
                               ((LPCREATESTRUCT) lParam)->hInstance, NULL);
    // Den ursprünglichen WND-PROC Pointer sichern und durch den eigenen ersetzen.
          PrevWndProcEdit = SetWindowLong (hwndEditAlt, GWL_WNDPROC, (LONG)EditWndProc);
          return 0;
    
       case WM_DESTROY:
    // Den ursprünglichen Pointer wieder einsetzen
          SetWindowLong (hwndEditAlt, GWL_WNDPROC, PrevWndProcEdit);
          PostQuitMessage (0);
          return 0;
       }
    
    return DefWindowProc (hwnd, message, wParam, lParam);
    }
    
    // Die neue WND-PROC für das Editfeld
    LRESULT CALLBACK EditWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
       switch (message)
       {
          case WM_LBUTTONDOWN:
    		  case WM_MOUSEMOVE:
    		{ 
             RECT    r;
                    int     width;
                    int     xPos    = LOWORD(lParam);  
    
                    GetWindowRect(hwndEditAlt, &r);
    
                    width = r.right - r.left;
    
    //BASS_SetVolume((int)((float)100 / (float)width * (float)xPos));
    
    SendMessage(hwndEditAlt, PBM_SETRANGE, 0, MAKELPARAM(0, 100) );
    SendMessage(hwndEditAlt, PBM_SETPOS, ((int)((float)100 / (float)width * (float)xPos)) + 1, 0);
    		}
       }
    
    return CallWindowProc ((WNDPROC) PrevWndProcEdit, hwnd, message, wParam, lParam);
    }
    


  • Hi...ich bins mal wieder...hab noch ein wenig daran herum gewerkelt. Bekomme es trotzdem nicht gebacken die Prozentanzeige in die Progressbar zu integrieren. Kann mit vieleicht doch noch mal einer helfen.

    Hier der aktuelle Code:

    #include <Windows.h>
    #include <StdIO.h>
    #include <commctrl.h>
    #pragma comment(lib,"Comctl32.lib")
    
    static PrevWndProcEdit;
    int i = 50;
    LRESULT CALLBACK EditWndProc(HWND, UINT, WPARAM, LPARAM);
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    HWND hwnd, hText, hwndEditAlt, g_hText;
    
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance,
                       PSTR szCmdLine, int iCmdShow)
    {
    	InitCommonControls();
    	static TCHAR szAppName[] = TEXT("Progress Bar");
    	MSG msg;
    
    	WNDCLASS wndclass;
    
    	wndclass.style = CS_HREDRAW | CS_VREDRAW;
    	wndclass.lpfnWndProc = WndProc;
    	wndclass.cbClsExtra = 0;
    	wndclass.cbWndExtra = 0;
    	wndclass.hInstance = hInstance;
    	wndclass.hIcon = 0;
    	wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    	wndclass.hbrBackground = (HBRUSH)COLOR_WINDOW;
    	wndclass.lpszClassName = szAppName;
    	wndclass.lpszMenuName = NULL;
    
    RegisterClass(&wndclass);
    
    wndclass.lpfnWndProc = EditWndProc;
    
    RegisterClass(&wndclass);
    
    	hwnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,szAppName, TEXT("LeWi-"), WS_OVERLAPPEDWINDOW,
    						CW_USEDEFAULT, CW_USEDEFAULT,
    						350, 300,
    						NULL, NULL, hInstance, NULL);
    
    	ShowWindow(hwnd, iCmdShow);
    	UpdateWindow(hwnd);
    
    	while(GetMessage(&msg, NULL, 0, 0))
    	{
    	TranslateMessage(&msg);
    	DispatchMessage(&msg);
    	}
    
    	return msg.lParam;
    }
    
    //  Hauptnachrichtenschleife
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	//static HWND hwndEditAlt;
    
    	switch (message)
    	{
    	case WM_CREATE:
    //  Editfeld erzeugen
    	hwndEditAlt = CreateWindowEx(0, PROGRESS_CLASS, 
    								"", WS_CHILD | PBS_SMOOTH | WS_VISIBLE, 
    								10, 20, 
    								300, 20, 
    								hwnd, NULL, 
                               ((LPCREATESTRUCT) lParam)->hInstance, NULL);
    //  Den ursprünglichen WND-PROC Pointer sichern und durch den eigenen ersetzen.
    	PrevWndProcEdit = SetWindowLong (hwndEditAlt, GWL_WNDPROC, (LONG)EditWndProc);
    
    	hText = CreateWindow("STATIC",
                              "Prozent",
                              WS_CHILD | WS_VISIBLE,    // Nicht vergessen!
                              50, 0,
                              200, 20,
                              hwnd,
                              NULL,
                              ((LPCREATESTRUCT) lParam)->hInstance,
                              NULL);
    g_hText = hText;
    
    		SendMessage(hwndEditAlt, PBM_SETRANGE, 0, MAKELPARAM(0, 1000));
    	SendMessage(hwndEditAlt, PBM_SETPOS, 500, 0);
    
    	return 0;
    
    	case WM_DESTROY:
    //  Den ursprünglichen Pointer wieder einsetzen
    	SetWindowLong (hwndEditAlt, GWL_WNDPROC, PrevWndProcEdit);
    	PostQuitMessage (0);
    	return 0;
    	}
    
    return DefWindowProc (hwnd, message, wParam, lParam);
    }
    
    //  Die neue WND-PROC für das Editfeld
    LRESULT CALLBACK EditWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	switch (message)
    	{
    		case WM_CREATE:
    			{
     return 0;
    			}
    
    	case WM_LBUTTONDOWN:
    	  case WM_MOUSEMOVE:
    		{ 
    
    if (message == WM_MOUSEMOVE && wParam != MK_LBUTTON)
                {
                    break;
                }
    
    POINT Cursor = { LOWORD(lParam), HIWORD(lParam) };
    RECT Size; GetClientRect(hwnd, &Size);
    char acTemp[64];
    sprintf(acTemp, "Progressbar ist bei %.0f Prozent", ((float)(Cursor.x+1)) / 300.0f * 100.0f);
    SendMessage(g_hText, WM_SETTEXT, 0, (LPARAM)acTemp);
    SendMessage(hwndEditAlt, PBM_SETPOS, (int)(((float)(Cursor.x+1)) / 300.0f * 1000.0f), 0);
    //MessageBox (NULL, TEXT (acTemp), 0, MB_ICONERROR);
    		 return 0;
    		}
    	}
    
    return CallWindowProc ((WNDPROC) PrevWndProcEdit, hwnd, message, wParam, lParam);
    return DefWindowProc(hwnd, message, wParam, lParam);
    }
    


  • Hi,
    Also erstmal ist dein Quelltext sehr unübersichtlich und schwer sich rein zu finden 😉 Man merkt das du die copy & paste Methode benutzt 😃
    Also du versuchst es ja nen Static über die Progressbar rüberzupacken. Ka was da jetzt nicht funktioniert oder so. Aber Versuch dochmal mit GDI einen Text rüber zu zeichnen? (So würde ich es zumindest machen)
    das machst du so ungefähr

    HDC hdc = GetDC(hwnd);
        char buff[15];
        sprintf(buff, "20 Prozent", day);
        TextOut(hdc, 50, 50, buff, strlen(buff));
        ReleaseDC(hwnd, hdc);
    

    Musst natürlich noch bissel anpassen. Musst dir dann mittels GetWindowRect(); die Positionen holen usw. Sollte aber kein problem sein.

    MfG schirmie


  • Mod

    joes schrieb:

    Hi.

    Ist echt nen super Forum hier mit hilfreichen Themen. Hab leider trotzdem noch leichte Probleme mit Subclassing. Möchte gern eine per Maus kontrollierbare Progressbar mit Prozentanzeige basteln. Ähnlich wie eine Volumebar. Kann mir bitte einer helfen?

    Und was spricht gegen einen Trackbar Control?
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/trackbar/trackbar.asp



  • Hi. Danke für eure Hilfe. Besonders an schirrmie. War echt ein super Tip. Hab nun aber auch schon des nächste Problem. Und zwar werden einige Zahlen fehlerhaft angezeigt. Hier meine Änderung:

    LRESULT CALLBACK EditWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	switch (message)
    	{
    		case WM_CREATE:
    			{
     return 0;
    			}
    
    	case WM_LBUTTONDOWN:
    	  case WM_MOUSEMOVE:
    		{ 
    
    if (message == WM_MOUSEMOVE && wParam != MK_LBUTTON)
                {
                    break;
                }
    
    POINT Cursor = { LOWORD(lParam), HIWORD(lParam) };
    RECT Size; GetClientRect(hwnd, &Size);
    SendMessage(hwndEditAlt, PBM_SETPOS, (int)(((float)(Cursor.x+1)) / 300.0f * 1000.0f), 0);
    HDC hdc = GetDC(hwnd); 
    char buff[9]; 
    sprintf(buff, "%.0f Prozent", ((float)(Cursor.x+1)) / 300.0f * 100.0f); 
    SetBkMode(hdc,TRANSPARENT);
    TextOut(hdc, 50, 0, buff, strlen(buff)); 
    ReleaseDC(hwnd, hdc);
    
    		 return 0;
    		}
    	}
    
    return CallWindowProc ((WNDPROC) PrevWndProcEdit, hwnd, message, wParam, lParam);
    }
    


  • hm...ich habe da gerade noch herausgefunden...wenn ich den SetBkMode ausschalte dann läuft es wunderbar....aber eigentlich wollte ich es schon Transparent haben. Kann mir einer helfen?



  • Is Zwar n Bissle Spät aber vieleicht hilft dir das funcs momentan Mitn Timer musts noch anpassen

    [code]
    #include <windows.h> 
    #include <StdIO.h> 
    #include <commctrl.h> 
    #include "resource.h"
    #pragma comment(lib,"Comctl32.lib") 
    #define INCTIMERID1 1
    
    static int PrevWndProcProzess;
    
    int progress=0;
    char status[10];
    
    LRESULT CALLBACK ProgressWndProc(HWND, UINT, WPARAM, LPARAM); 
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 
    
    HWND	hwnd, 
    		hText, 
    		hwndProgress, 
    		g_hText; 
    
    void Init (HWND hwnd)
    {
    	SendMessage(hwndProgress, PBM_SETPOS,(WPARAM)progress,0);
    }
    
    void CALLBACK IncTimer1 (HWND hwnd, UINT iMsg, UINT iTimer, DWORD dwTime)
    {
    	progress++;
    	if(progress < 100)
    	{
    		Init(hwnd);
    	}
    	if(progress >=100)
    	{
    		progress=0;
    		Init(hwnd);
    		//KillTimer(hwnd, INCTIMERID1);
    		//PostQuitMessage(0); //Programm nach ablauf beenden
    	}
    }
    
    int WINAPI WinMain(HINSTANCE hInstance, 
    				   HINSTANCE prevInstance, 
                       PSTR szCmdLine, 
    				   int iCmdShow) 
    { 
        InitCommonControls(); 
    
        static TCHAR szAppName[] = TEXT("Progress Bar"); 
    
        MSG msg; 
    
        WNDCLASS wndclass; 
    
        wndclass.style = CS_HREDRAW | CS_VREDRAW; 
        wndclass.lpfnWndProc = WndProc; 
        wndclass.cbClsExtra = 0; 
        wndclass.cbWndExtra = 0; 
        wndclass.hInstance = hInstance; 
        wndclass.hIcon = 0; 
        wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); 
        wndclass.hbrBackground = (HBRUSH) CreateSolidBrush (RGB ( 0, 0, 0)); 
        wndclass.lpszClassName = szAppName; 
        wndclass.lpszMenuName = NULL; 
    
    	RegisterClass(&wndclass); 
    
    	wndclass.lpfnWndProc = ProgressWndProc; 
    
    	RegisterClass(&wndclass); 
    
        hwnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
    						  szAppName, 
    						  TEXT("Progress Test"), 
    						  WS_OVERLAPPEDWINDOW, 
    						  CW_USEDEFAULT, CW_USEDEFAULT, 
    						  350, 100, 
                              NULL, 
    						  NULL, 
    						  hInstance, NULL); 
    
        ShowWindow(hwnd, iCmdShow); 
        UpdateWindow(hwnd); 
    
        while(GetMessage(&msg, NULL, 0, 0)) 
        { 
    		TranslateMessage(&msg); 
    		DispatchMessage(&msg); 
        } 
        return msg.lParam; 
    } 
    
    //  Hauptnachrichtenschleife 
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
    { 
    	switch (message) 
        { 
    		case WM_CREATE: 
    
    			// ProgressBar erzeugen 
    			hwndProgress = CreateWindowEx(0, PROGRESS_CLASS, "", 
    										 WS_CHILD | PBS_SMOOTH | WS_VISIBLE, 
    										 10, 20, 310, 20,  hwnd, NULL, ((LPCREATESTRUCT) lParam)->hInstance, NULL); 
    
    			//  Den ursprünglichen WND-PROC Pointer sichern und durch den eigenen ersetzen. 
    			PrevWndProcProzess = SetWindowLong (hwndProgress, GWL_WNDPROC, (LONG)ProgressWndProc); 
    
    			SendMessage(hwndProgress, PBM_SETRANGE, 0, MAKELPARAM(0, 1000)); 
    			SendMessage(hwndProgress, PBM_SETPOS, 500, 0); 
    
    			SetTimer(hwnd, INCTIMERID1, 100, (TIMERPROC) IncTimer1);
    
    		return 0; 
    
    		case WM_DESTROY: 
    			//  Den ursprünglichen Pointer wieder einsetzen 
    			SetWindowLong (hwndProgress, GWL_WNDPROC, PrevWndProcProzess); 
    			PostQuitMessage (0); 
    		return 0; 
        } 
    return DefWindowProc (hwnd, message, wParam, lParam); 
    } 
    
    //  Die neue WND-PROC für das ProgressBar 
    LRESULT CALLBACK ProgressWndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 
    { 
    	static RECT  Rect;
        HDC          hdc;
        PAINTSTRUCT  ps;
        static TCHAR szStr[50];
        HRGN         hRgn;
    	COLORREF     BarFore    = RGB(0,128,0),		// Farbe Fortschritts Anzeige
                     BarBk      = RGB(255,0,0),		// Hintergrund Farbe
    	             TextFore	= RGB(0,0,0),		// Text Farbe Auf Hintergrund
    	             TextBk		= RGB(255,255,255); // Text Farbe Auf Fortschritts Anzeige
        HBRUSH       hBrush1,hBrush2;
    
        switch (message) 
        { 
    		case WM_LBUTTONDOWN: 
    		case WM_PAINT:
    		   {
    				wsprintf(szStr,"Test %d %%",progress);
    
    				hdc=BeginPaint(hwnd,&ps);
    				GetClientRect(hwnd,&Rect);
    
    				hBrush1=CreateSolidBrush(BarFore); 
    				hBrush2=CreateSolidBrush(BarBk); 
    
    				//drawing left part of bar
    				hRgn=CreateRectRgn(0,0,progress*Rect.right/100,Rect.bottom); 
    				FillRgn(hdc,hRgn,(HBRUSH)hBrush1);
    
    				SetBkMode(hdc,TRANSPARENT);
    
    				SelectClipRgn(hdc,hRgn);
    				SetTextColor(hdc,TextBk);
    				DrawText (hdc, szStr, lstrlen(szStr), &Rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE) ;
    				SelectClipRgn(hdc,NULL);                                   
    				DeleteObject(hRgn);
    
    				//drawing right part of bar
    				hRgn=CreateRectRgn((progress*Rect.right/100),0,Rect.right,Rect.bottom); 
    				FillRgn(hdc,hRgn,(HBRUSH)hBrush2);
    
    				SelectClipRgn(hdc,hRgn);
    				SetTextColor(hdc,TextFore);
    
    				DrawText (hdc, szStr, lstrlen(szStr), &Rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE) ;
    				SelectClipRgn(hdc,NULL);
    				DeleteObject(hRgn);                                               
    
    				DeleteObject(hBrush1);
    				DeleteObject(hBrush2);
    				EndPaint(hwnd,&ps);
    			}
    		return 0;
        } 
    return CallWindowProc ((WNDPROC) PrevWndProcProzess, hwnd, message, wParam, lParam); 
    return DefWindowProc(hwnd, message, wParam, lParam); 
    }
    [/code]
    

    😃


Anmelden zum Antworten