Frage bezüglich Marquee Style bei de Progress Bar
-
Hey
ich habe eine Frage bezüglich der Progress Bar mit dem Style PBS_MARQUEE.
Wie macht man das genau? Ich habe alles probiert aber er sagt immer das der Style nicht diffiniert ist. Das gillt auch für die dazu gehörige Message PBM_SETMARQUEE. Ich hab natürlich auch alles eingebunden trozdem geht es nicht. Wäre Top wenn mir das jemand erklären könnte.
mfg
-
#if (_WIN32_WINNT >= 0x0501) #define PBS_MARQUEE 0x08 #endif // _WIN32_WINNT >= 0x0501
-
Mh Okay jetzt schreibt er keine Fehlermeldung mehr aber trozdem geht es nicht hättest du vill einen beispiel Code?
-
hat keiner eine Beisielcode?
-
http://msdn2.microsoft.com/en-us/library/aa383745.aspx
msdn schrieb:
Must set the control style to PBS_MARQUEE prior to attempting to start the animation.
SendMessage(hWnd, PBM_SETMARQUEE, 1, 100)
-
So mach ich das auch aber es geht trozdem nicht^^
-
Sorry für den doppel Post aber ich will euch mal den Code zeigen.
#define PBM_SETMARQUEE (WM_USER+10) #define PBS_MARQUEE 0x08 #include <windows.h> #include <CommCtrl.h> /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "CodeBlocksWindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { InitCommonControls(); HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Code::Blocks Template Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static HWND PB; switch (message) /* handle the messages */ { case WM_CREATE: PB = CreateWindowEx(0, PROGRESS_CLASS,"", WS_CHILD |WS_VISIBLE,15 ,40,160, 15,hwnd, NULL,((LPCREATESTRUCT) lParam) -> hInstance, NULL); long style = GetWindowLong(PB, GWL_STYLE); style = style | PBS_MARQUEE; SetWindowLong(PB, GWL_STYLE, style); SendMessage(PB, PBM_SETMARQUEE,true, 100); break; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; }
-
-
Warum postest du den XP-Style? Hat doch nichts damit zutun, abgesehen davon nutz ich den bereits durch code::blocks.
-
char i[69]; schrieb:
Warum postest du den XP-Style? Hat doch nichts damit zutun.
To use Comctl32.dll version 6, specify it in a manifest.
-
Bei mir funktioniert es übrigens
-
Mh also bei der mainfest Datei sieht auch alles richtig aus.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity name="Win32 Application.default.App" processorArchitecture="x86" version="1.0.0.0" type="win32"/> <description>Executable</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly>
EDIT:
Auch der Code den ich hier angegeben habe?
-
Ja mit deinem Code...
Erstell doch einfach noch ein anderes Control z.B. Button um zu sehen ob der XP-Style benutzt wird.
-
Ja wird ganz normal benutzt. Ich teste es mal auf einem anderem Coputer.
EDIT:
Alles klar das muss an meinem Computer liegen den bei meinem anderem Computer geht es auch.
-
msdn: InitCommonControls schrieb:
[..]This function is obsolete. New applications should use the InitCommonControlsEx function.
Hmm, lol:
msdn: InitCommonControls Remarks schrieb:
Under Comctl32.dll version 6.0 and later, InitCommonControls does nothing. Applications must explicitly register all common controls through InitCommonControlsEx.