Author Topic: Circlebar Control  (Read 4652 times)

fearless

  • Member
  • ***
  • Posts: 281
    • LetTheLightIn
Circlebar Control
« on: March 26, 2014, 02:22:38 AM »
A circular progress bar control with source, 1 example and chm help file.



Playing around with gdi+ stuff recently and for some reason i ended up creating this. I had tried to create a version where the center part was completely transparent, (i did get a gdi version to work with transparentblt but that the gdi version did not have any anti-aliasing, and still looked a bit rough when rendering at a higher image size and stretchblt back to smaller size), and cpu usage goes up a bit when moving mouse over the window (higher cpu usage if you have a gaming mouse with higher polling rate probably due to increased wm_mousemove messages). Also you might have to right click, properties, unblock, on the chm for it to show properly. Another thing that bothered me slightly was the way i created the control - still not sure im doing that right :D

Anyhows here it is, maybe someone will find it, or the code useful.
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI, Samsung 256GB + 1TB SSD, WD Black 2TB x2 + 4TB HDD, Asus 27" LCD

www.LetTheLight.in  My Github

qWord

  • Member
  • *****
  • Posts: 1471
  • The base type of a type is the type itself
    • SmplMath macros
Re: Circlebar Control
« Reply #1 on: March 26, 2014, 03:15:07 AM »
One small issue is that your WndProc does not preserve EBX as required by the WinABI. Otherwise it look goods  :icon14:

BTW: WM_NCCREATE is might not be the first message send to a window (AFAICS this is not a problem for your control). For that reason I prefer the method of a wrapper-WndProc that does manage the memory of the window/control-data and pass the pointer through EBX or an additional parameter to the actual procedure. As long as the private data is not allocated, the wrapper call the default window procedure.
MREAL macros - when you need floating point arithmetic while assembling!

Gunther

  • Member
  • *****
  • Posts: 3518
  • Forgive your enemies, but never forget their names
Re: Circlebar Control
« Reply #2 on: March 26, 2014, 07:29:36 PM »
Hi fearless,

Looks good.  :t

Gunther
Get your facts first, and then you can distort them.

faiseur

  • Regular Member
  • *
  • Posts: 1
Re: Circlebar Control
« Reply #3 on: May 17, 2014, 06:05:43 AM »
Good work Fearless  :t

Biterider

  • Member
  • **
  • Posts: 127
  • ObjAsm32
    • ObjAsm32
Re: Circlebar Control
« Reply #4 on: May 17, 2014, 04:18:27 PM »
Nice stuff  8)
Biterider

guga

  • Member
  • ****
  • Posts: 826
  • Assembly is a state of art.
    • RosAsm
Re: Circlebar Control
« Reply #5 on: August 10, 2014, 02:21:35 AM »
Crashing on winxp SP3

The crash is at CbarGdiDrawDisplayText
in the 1st GdipDrawString here
Code: [Select]
        mov eax, MarkerNo
       
        .IF eax == 0
            Invoke GdipDrawString, pGraphics, Addr szWZero, 0ffffffffh, pFont, Addr gdirect, pFormat, pBrush


http://www.jose.it-berater.org/smfforum/index.php?topic=1826.0
http://www.masmforum.com/board/index.php?PHPSESSID=786dd40408172108b65a5a36b09c88c0&topic=11385.0
http://msdn.microsoft.com/en-us/library/windows/desktop/ms534053%28v=vs.85%29.aspx


http://www.wasm.ru/forum/viewtopic.php?id=45877
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

fearless

  • Member
  • ***
  • Posts: 281
    • LetTheLightIn
Re: Circlebar Control
« Reply #6 on: August 10, 2014, 11:02:05 AM »
I copied the circlebarexample1 to my old asus n10 netbook (winxp pro sp3 with an intel atom cpu), and it runs without crashing, altho the desktop and other screens flicker and the cpu goes mad. I can only think it is something to do with the gdiplus version on xp vs win7 x64 maybe. Tbh i never tested it on the netbook before as i hardly ever use it.
I done a search of gdiplus on my netbook and my main pc (win7 x64) and took screenshots of the files listed, altho im not sure it will help at all, but i suppose its a place to start.




fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI, Samsung 256GB + 1TB SSD, WD Black 2TB x2 + 4TB HDD, Asus 27" LCD

www.LetTheLight.in  My Github

guga

  • Member
  • ****
  • Posts: 826
  • Assembly is a state of art.
    • RosAsm
Re: Circlebar Control
« Reply #7 on: August 10, 2014, 11:21:09 AM »
The problem seems to be that pFont is returning 0-1, causing GdipDrawString to crash

It is retrning 0-1, because at GdipCreateFont it returns 2 (which i suppose is an error case), when it should return 0
http://source.winehq.org/WineAPI/GdipCreateFont.html
http://www.news2news.com/vfp/?function=805

Since GdipCreateFont return error on the 1st time it is being used, i presume the error is at the function CbarGdiInit
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

fearless

  • Member
  • ***
  • Posts: 281
    • LetTheLightIn
Re: Circlebar Control
« Reply #8 on: August 10, 2014, 11:53:19 AM »
Might be coz i have specified Segoe UI as the font to use, which according to the wikipedia entry http://en.wikipedia.org/wiki/Segoe is on windows 7 upwards and can be available on winxp if particular software applications are installed. Might have to set it as arial or something and recompile it.

Change these lines in the source:
Code: [Select]
szDefaultFont           db "Segoe UI",0
szWDefaultFont        db "S",0,"e",0,"g",0,"o",0,"e",0," ",0,"U",0,"I",0,0,0
fearless

CM690II Case, HX1000 PSU, Asus Z97, Intel i7-4790K, Seidon 120v Cooler, 16GB DDR3, MSI GTX 980TI, Samsung 256GB + 1TB SSD, WD Black 2TB x2 + 4TB HDD, Asus 27" LCD

www.LetTheLight.in  My Github

guga

  • Member
  • ****
  • Posts: 826
  • Assembly is a state of art.
    • RosAsm
Re: Circlebar Control
« Reply #9 on: August 10, 2014, 12:17:32 PM »
Indeed

Changing it to times new roman, worked correctly :)

Very nice example of using gdi+, btw  :t
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com