The MASM Forum

General => The Workshop => Topic started by: TouEnMasm on October 22, 2012, 05:38:03 AM

Title: region maker
Post by: TouEnMasm on October 22, 2012, 05:38:03 AM
Hello,
I search for a regionmaker with his source code.
I have found this one in the old forum 3922_RegionMaker122.zip
But he had no source code,an idea ?.
Title: Re: region maker
Post by: ragdog on October 25, 2012, 03:06:13 AM
Hi ToutEnMasm

Here is a nice source  Smart Screen Capt 1.4
With region maker from Rudy Rooroh

Have fun :biggrin:

Title: Re: region maker
Post by: TouEnMasm on October 25, 2012, 07:05:38 AM
Thanks,
I am working on my own.
He is in mixed language (c++ do the region).
much faster than the other,he use also further formats BMP GIF JPG CUR ICO WMF.
The window take the same size as the image.
As he is much faster,he need just to change the image and no more code.
Try it when he is unpacked,he load the image from a subdirectory,but can also load a ressource with no more code.

Later,For a better look modifie this:
mov wc.hbrBackground,  0 ; avoid the background to be redrawn
This one had no effect,but style are useless
mov wc.style,0




Title: Re: region maker
Post by: TouEnMasm on October 29, 2012, 05:48:12 PM
And now how to animate:
add all the images in the resource.
Quote
500 IMAGE "titi\\titi1.gif"
501 IMAGE "titi\\titi2.gif"
502 IMAGE "titi\\titi3.gif"
503 IMAGE "titi\\titi4.gif"
create the bmp and put them in an array (WM_CREATE):
Quote
      mov dword ptr [TabTitibmp],1 ;TabTitibmp dd 5 dup (0)
      mov ecx,1
      mov titiindice,500
      ;sauvegarde first region
      saveBmp:
      mov ecx,dword ptr [TabTitibmp]
      mov eax,Hbmp
      mov dword ptr [TabTitibmp+ecx*4],eax
      inc titiindice
      .if titiindice < 504
         invoke Load_IMAGE,titiindice ;addr modulepath            
         mov Hbmp,eax
         inc dword ptr [TabTitibmp]
         jmp saveBmp
      .endif
      ;
      mov ecx,1
      mov [TabTitibmp],ecx
      push dword ptr [TabTitibmp+4]
      pop Hbmp
      
      ;create timer
      invoke SetTimer,hwnd,500,100,NULL

and now add the WM_TIMER message
Quote
.elseif uMsg == WM_TIMER
   mov ecx,dword ptr [TabTitibmp]
   .if ecx < 4
          inc ecx      ;1
   .else
   mov ecx,1
   .endif
   mov dword ptr [TabTitibmp],ecx
   mov eax,dword ptr [TabTitibmp+ecx*4]
   mov Hbmp,eax
invoke BmpToRgn,Hbmp,TransparantColor ;only one use
   mov Hrgn,eax
   invoke GetClientRect,hwnd,ADDR rect            
   invoke RedrawWindow,hwnd,addr rect,Hrgn,RDW_INTERNALPAINT
NOTE:
   invoke SetWindowRgn,hwnd,Hrgn,TRUE   
   ;After a successful call to SetWindowRgn, the system owns the region
   ;specified by the region handle hRgn. The system does not make a copy of the
   ; region. Thus, you should not make any further function calls with this region
   ; handle. In particular, do not delete this region handle. The system deletes
   ; the region handle when it no longer needed         
Title: Re: region maker
Post by: ragdog on December 13, 2012, 07:00:46 PM
In the old Masm32 backup give a other example

10487_MakeRegion_-_GDI_region_generating_tool_Version_1_04.zip