• Welcome to Powerbasic Museum 2020-B.
 

News:

Forum in repository mode. No new members allowed.

Main Menu

XP AERO, i get it to work!

Started by Patrice Terrier, September 30, 2008, 09:06:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrice Terrier

I have challenged myself to enable the drawing of child controls hover a layered window, something normaly impossible, but as we say here "the word impossible is not french"  ;D

This is draft code, but it works not only on VISTA (where it flys) but also on XP !!!

I though first to create a hook trampolin on the BeginPaint EndPaint API, when it comes to my mind that WM_PRINT could do it just fine, because the wParam is able to use a private memory DC, and ... that does the trick.

I have attached the source code to this post, again it is not polished, but i wanted to let you try it on XP, because i know most of you are reluctant to move ahead to VISTA.

8)

Added:


'   // I get it to work
    lParam& = %PRF_CLIENT OR %PRF_CHILDREN OR %PRF_NONCLIENT OR %PRF_ERASEBKGND
    CALL SendMessage(hWnd, %WM_PRINT, hMemDC, lParam&)



Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Petr Schreiber

Hi Patrice,

thanks for this new sample, looks good as usual :)
I tested it on Windows XP SP2 and all worked fine, CPU usage about 40% on single core processor.


Petr

AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Patrice Terrier

#2
Petr

If interrested i could post the code to take over the BeginPaint EndPaint and let the child controls to be drawn to the memory DC instead of the classic window DC, and this without using the WM_PRINT message.

But this would require the use of a DLL because of the "detour hook" technic being used.
And it would make possible to suppress the timer, freeing up CPU resources.

Note-1: with WM_PRINT if you remove the timer then you won't see anymore the child controls.

Note-2: You can reduce drasticaly the CPU usage if you use a TIMER value of 100 instead of 50 and remove the flare animation (and or suppress zooming)

Try first to remove the zooming like this:

       '// Draw layer 4 with respect of the z-order
       IF ImageArray(4) = 0 THEN ImageArray(4) = zLoadImageFromFile((EXE.Path$ + "LensFlare.png"), imgW, imgH, 0)
       Img = ImageArray(4)
       IF Img THEN
          CALL GetImageSize(Img, imgW, imgH)
          IF FlipMove3 = 0 THEN
             xMove3 = xMove3 + 2
             IF xMove3 > 260 THEN FlipMove3 = -1
          ELSE
             xMove3 = xMove3 - 2
             IF xMove3 < 0 THEN FlipMove3 = 0
          END IF
'          CALL GdipDrawImageRectRectI(graphics, Img, 103 + xMove3, 50 + (xMove3 \ 2), imgW - (xMove3\4), imgH - (xMove3\4), 0, 0, imgW, imgH, 2, ImgAttr)
          CALL GdipDrawImageRectRectI(graphics, Img, 103 + xMove3, 50 + (xMove3 \ 2), imgW, imgH, 0, 0, imgW, imgH, 2, ImgAttr)
       END IF

and you will see that the CPU usage would be only 3%

Try also to play with the timer delay in the range 0-100 to adjust the smooth moving of the flare.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

I forget to say that when using a layered window with the alpha channel (using variable opacity), you don't need to manage the region yourself, everything is done by the OS.  :)

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Patrice Terrier

#4
The first post of this thread has been updated, to fix the ZIP file corruption caused by the "Server Collapse".

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com