Undetermined Progress bar in Win32 API - winapi

How do I add Undetermined Progress Bar in win32 api?
I just want the animation/progress bar to display as a child to main window when a button is press, continue animation until the the button is again played and then dissapear.

The standard Win32 ProgressBar control has a Marquee mode for that exact purpose.

Perhaps you just wish to show a small dialog containing an animated GIF file. You'll find plenty of example GIFs on the Internet.
http://www.ajaxload.info/ looks good.

Related

Implement custom frame border UI instead of standard UI

I am developing my Python app with PyQt4 and I want to customize my app interface (QMainWindow, QLineEdit and so forth) in windows like
this view (or something else):
Instead of this (default style on Windows 10):
For all styles except the window frame border use Qt stylesheets (QSS) (Documentation).
For the frame borders it's a bit difficult:
See the Qt window flags example to see what Qt can do with the window frame.
Basically you cannot style the window frame (they take the style from the OS), but you can hide/show buttons and you can show the window completely frameless.
On Windows however, some people hacked into the windows frame bar (Tabs in title bar: what's the secret?). This may be possible to do with Python too.
The most universal approach would be (although this is a bit costly) to not using any OS provided frame (Qt::CustomizeWindowHint) and then inside implement your own styled frame implemented drag and drop of the title bar and border and so forth.
With this you can easily achieve every possible frame border including your example, but you have to re-implement the buttons and the dragging behavior and the response might be a bit less quick than usual. Also the look and feel will then not be OS specific out of the box as it is for Qt's own frame borders.
For example in Linux, the title bar is typically shown differently when maximized - you wouldn't have this then.
Example of custom made frame bar: Customize title bar and window

Weird black pixels in the corners of CProgressCtrl controls

I have an MFC dialog (actual a dialog bar with in a dialog) that contains a progress bar with these strange black pixels in the corner. I have tried the following to remove them:
Change most of the border type styles and the transparent style of the control.
Override the OnEraseBkgnd in a class derived a CProgressCtrl.
Setting the background color of the control by PBM_SETBKCOLOR.
I have yet to find a way to remove these black pixel.
Here is an example of what it looks like:
It seems I have found the issue. When the progress bar performs its painting it was sending an WM_ERASEBKGND message to the dialog to get the background with which it would paint. Some how the DC brush origin was being messed up. Using the following code at the start of the function seems to have fixed the issue with no ill effects.
CRect rcClip;
pDC->GetClipBox(rcClip);
pDC->SetBrushOrg(-rcClip.left, -rcClip.top);
I've seen this occur when using ActiveX controls inside control containers that don't have a a window or proper Device Contexts (The VB6 frame control is one of these) but I'm not sure if the same problem applies to MFC windows and controls though.
Try making the control parent a normal static window.

How do I achieve the UI effect of a window pointing to a status bar item?

I've seen this done on a few apps:
Can anyone suggest a starting point on how to do this? I've done some work with the Interface builder and Cocoa, but nothing this fancy. The requirements are to be able to display a window on demand under a particular menubar icon, and have the user be able to interact with it (buttons and text fields). Not asking for a full blown solution (unless one exists), just a friendly push in the right direction...
Get the icons rect from the status bar, then present your window based on that rect. Your example shows an arrow (from a png background image), then they aligned the arrow to be the center of the icons rect in the status bar.
I stumbled upon this: http://mattgemmell.com/2008/03/04/using-maattachedwindow-with-an-nsstatusitem/
Matt Gemmell made a very nice class for these kinds of windows MAAttachedWindow

How do I build a toolbar in my title bar?

I have to implement a custom toolbar for my application, where a button will be placed on the side of exit, maximize and minimize buttons.
I tried to work with the toolbar element on XCode, but it always put elements below these buttons and not on the side.
App Store application implement this feature, like you can see in this image.
One solution is to start with this open source code (https://github.com/indragiek/INAppStoreWindow) to give you the correct title bar style, and then position buttons in the titlebar.

How do you make an infinite scrollbar control with Windows Core API?

How do I make one? I am kind of a newbie in Windows API. Is there some sort of manual for this sort of thing? I am specifically interested in a Core API. Thank you for any help.
There are three ways of doing scroll bars: A window's scroll bar; a scroll bar control; or a custom control.
Windows have scroll bars in the non-client (NC) area. These are part of the window frame, and as such they do not have their own window handle or anything.
Scroll bar controls are child window implementations of a scroll bar. Because they are child windows, they offer you a bit more flexibility. You could subclass or superclass one of these controls to implement "infinite" functionality.
The final option is a custom control: you just create your own scroll bar from scratch. Create a single child window, draw it yourself, handle all the mouse and keyboard input yourself, and implement the scroll bar messages yourself. This isn't actually as hard as it may sound.
I'd probably recommend superclassing a scroll bar control. Process the scroll messages in your own scroll bar wndproc, and fall back to the standard scroll bar wndproc for painting and such.
What do you mean with "infinite"?
If you mean a scroll bar where the user can never scroll to the ends, you have to handle the scroll bar's position change notifications and reset the position to the middle.

Resources