progressbar erstellen u verwenden....
-
hi leute!
ich der search hier hab ich zu progressbar nix gescheides gefunden;-(ich möchte einfach ne progressbar erstellen, für meinen filetransfer mit winsock verwenden!
halt so ne progressbar wie beim icq filetransfer...
muss man da max u min einstellen...ich sende pakete zu 1024...
wenn man filesize/1024 macht dann hab ich den maximalwert der progressbar...cu
-
-
guckst du hier: http://www.functionx.com/win32/ProgressBars.htm
-
hi!
ich hab eine win32 konsolenanwendung...und kann mit ressourcen dann ja net arbeiten, deshalb erstell ich so eine progressbar so:CreateWindowEx(0, PROGRESS_CLASS, NULL, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, 20, 20, 260, 17, hWndDlg, NULL, hInst, NULL);
wie kann ich da jetzt bei der progressbar den wert des balkens verändern?
cu
-
send message alle mit PBM_xxxx
PBM_SETPOS Message -------------------------------------------------------------------------------- Sets the current position for a progress bar and redraws the bar to reflect the new position. Syntax To send this message, call the SendMessage function as follows. lResult = SendMessage( // returns LRESULT in lResult (HWND) hWndControl, // handle to destination control (UINT) PBM_SETPOS, // message ID (WPARAM) wParam, // = (WPARAM) (int) nNewPos; (LPARAM) lParam // = 0; not used, must be zero ); Parameters nNewPos Signed integer that becomes the new position. lParam Must be zero. Return Value Returns the previous position. Message Information Minimum DLL Version comctl32.dll version 4.00 or later Header commctrl.h Minimum operating systems Windows NT 4.0, Windows 95
-
1.) Warum kannst du bei Konsolen-Anwendungen keine Ressourcen verwenden?
2.) Worauf willst du die Progressbar überhaupt anzeigen?
-
#include <commctrl.h> #pragma comment(lib,"Comctl32.lib") int main() { HWND hProgress; // ProgressBar erzeugen //InitCommonControls(); INITCOMMONCONTROLSEX InitCtrlEx; InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); InitCtrlEx.dwICC = ICC_PROGRESS_CLASS; InitCommonControlsEx(&InitCtrlEx); hProgress = CreateWindowEx(0, PROGRESS_CLASS, NULL, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, 20, 20, 260, 17, NULL, NULL, NULL, NULL); // Schrittläge einstellen SendMessage(hProgress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); SendMessage(hProgress, PBM_SETSTEP, (WPARAM) 10, 0); // mit jedem Schritt 10% weiter SendMessage(hProgress, PBM_STEPIT, 0, 0); // Befehl um einen Schritt zu machen
irgendwie tut sich da nix;-(
hmmcu
-
Wird überhaupt eine Progress-Bar angezeigt?
-
nö
-
lol dann sag das doch gleich. du folltrottel.
das liegt daran das du WS_CHILD angibst, aber kein Parent hast. Nimm z.B. WS_POPUP anstatt WS_CHILD
-
ltd. documentation sollte gehen
PBM_SETPOS mal probieren
-
vdittrich schrieb:
ltd. documentation sollte gehen
PBM_SETPOS mal probieren
hab keien ressource hinzugefügt muss man auch noch erwähnen! wohin mit PBM_SETPOS ?
cu
-
danke! schaut aber ne grad schön aus so eine progressbar alleine ohne window;-(
cu
-
hProgress = CreateWindowEx(0, PROGRESS_CLASS, NULL,
WS_CHILD | WS_VISIBLE | PBS_SMOOTH,
20, 20, 260, 17,
NULL, NULL, NULL, NULL);erst mal hProgress != 0 damit es auch erstllt wurde
-
vdittrich schrieb:
hProgress = CreateWindowEx(0, PROGRESS_CLASS, NULL,
WS_CHILD | WS_VISIBLE | PBS_SMOOTH,
20, 20, 260, 17,
NULL, NULL, NULL, NULL);erst mal hProgress != 0 damit es auch erstllt wurde
hab ein handle hProgress auf createWindowEx!!!
wie kann ich ein fenster erstellen wo die progressbar drinnen ist?cu
-
so soll die progressbar in dem fenster sein...
http://www.functionx.com/win32/images/progressbar1.gifbrauch i da ne dialogbox noch? nun is halt die frage wie tut man die progressbar da rein..
cu
-
ich würde sagen dem surf sollte man nicht helfen. der rafft eh nichts.
-
haha
-
wie wärs erstmal mit nem normalen window über createWindow und dann die progressbar da als child rein(auch wieder über createWindow)...
-
////////////////////// Hautfenster erstellen //////////////////////////////// HWND hWndMain; /* Handle auf unser Hauptfenster */ WNDCLASS wc; /* Struktur zum Fensterklassen bescheiben */ wc.style = CS_HREDRAW | CS_VREDRAW; /* Repaint bei Fenstergößenänderung */ wc.lpfnWndProc = WndProc; /* Nachrichtenbearbeitungs Funktion */ wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; /* Programm ID (Parameter von WinMain)*/ wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszClassName = szAppName; /* Klassenname (bei uns = Programmname) */ wc.lpszMenuName = NULL; RegisterClass(&wc); /* Fensterklasse anmelden */ hWnd = CreateWindow(szAppName, /* Fenster erstellen */ "Titelleiste", WS_OVERLAPPEDWINDOW, /* Fensterstil */ CW_USEDEFAULT, /* X-Position */ CW_USEDEFAULT, /* Y-Position */ CW_USEDEFAULT, /* Breite */ CW_USEDEFAULT, /* Höhe */ NULL, NULL, hInstance, /* Programm ID */ NULL); ShowWindow(hWnd, iCmdShow); /* Fenster anzeigen */ UpdateWindow(hWnd); /* Und ein Repaint */ /////////////////////// Progressbar im Hauptfenster erstellen //////////////// HWND hProgress; // ProgressBar erzeugen //InitCommonControls(); INITCOMMONCONTROLSEX InitCtrlEx; InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); InitCtrlEx.dwICC = ICC_PROGRESS_CLASS; InitCommonControlsEx(&InitCtrlEx); hProgress = CreateWindowEx(0, PROGRESS_CLASS, NULL, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, 20, 20, 260, 17, NULL, NULL, NULL, NULL); // Schrittläge einstellen SendMessage(hProgress, PBM_SETRANGE, 0, MAKELPARAM (0, 100)); SendMessage(hProgress, PBM_SETSTEP, (WPARAM) 10, 0); // mit jedem Schritt 10% weiter SendMessage(hProgress, PBM_STEPIT, 0, 0); // Befehl um einen Schritt zu machen
hab bei der progressbar den parameter: WS_CHILD drinn! müsste passen? wie soll ich den balken verändern mit: PBM_SETPOS oder PBM_STEPIT ?