News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Simple Circular Activity Indicator

Started by Biterider, August 25, 2022, 02:34:24 AM

Previous topic - Next topic

Biterider

Hi
"Simple Circular Activity Indicator" is a long name for something not that complicated. It's an indicator that shows ongoing activity but not progress, it's circular and not linear, and finally it's based on a single image rather than a series of images.
Windows 8 extended WS_EX_LAYERED to work with child windows, which was a big step for animations beyond popup windows. I combined this function (in combination with UpdateLayeredWindow) and created a world transformation to simultaneously rotate and scale a previously loaded .png with transparency. All this together with a variable blend factor gives a nice fade in/out effect. :cool:

All is implemented using the regular GDI API. The only exception is the loading of the .png, which was done using GDI++ for simplicity.

The demo application shows 2 of them overlapping and in different colors to show the transparency and active background change on one of the controls.
The demo runs the controls on the main thread, which can be very easily changed as needed.

Attached is the binary of the demo. The source is available on GitHub.

Biterider

fearless

Looks good, I like the exit transitions as they fade and shrink.

NoCforMe

Trying to run it under Windows 7-64; click on either "Start" and it hangs ("not responding"), Olly Debug opens with a blank window. ???
Assembly language programming should be fun. That's why I do it.

Biterider

Hi NoCforMe
Thank you for your feedback signal.
As mentioned in the first post, this control uses a feature introduced with Windows 8. All previous operating systems will not work.
Of course, it would be better if the demo application warned you about an old, unsupported operating system. Maybe I'll add this code too.

Biterider

jj2007

Quote from: Biterider on August 26, 2022, 05:07:55 PMOf course, it would be better if the demo application warned you about an old, unsupported operating system.

For inspiration ;-)

MbWinVersion MACRO arg
  ifndef NTDLL_INC
  uselib ntdll
  endif
  push eax
  mov eax, esp
  push eax
  mov edx, esp
  push eax
  invoke RtlGetNtVersionNumbers, edx, eax, esp
  pop edx ; build in dx
  pop eax ; major
  pop ecx ; minor
  ifidn <arg>, <b>
EXITM <al>
  elseifidn <arg>, <build>
EXITM <dx>
  else
EXITM <eax>
  endif
ENDM

Biterider


Biterider

Hi
I updated the application to show a warning if the OS Version is below Windows 8.
Binary can be downloaded from the first post.


Biterider

NoCforMe

So what exactly does Windows 7 not support here? And why is it that instead of just rendering incorrectly it hangs? Failure mode doesn't seem too elegant here ...
Assembly language programming should be fun. That's why I do it.

LiaoMi

 :tongue:
WS_EX_LAYERED
0x00080000
The window is a layered window. This style cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC.
Windows 8: The WS_EX_LAYERED style is supported for top-level windows and child windows. Previous Windows versions support WS_EX_LAYERED only for top-level windows.

A window that has no parent, or whose parent is the desktop window, is called a top-level window.
https://docs.microsoft.com/en-us/windows/win32/winmsg/about-windows#parent-or-owner-window-handle
A window can be created as a child window (WS_CHILD set) or a top-level window (WS_CHILD not set).
https://devblogs.microsoft.com/oldnewthing/20100315-00/?p=14613