News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

DrawProgress custctl

Started by Faiseur, June 11, 2005, 02:11:51 PM

Previous topic - Next topic

Faiseur

Hello KetilO,

I work to implement the DrawProgress library in custom control for RadAsm. It is well. If you put the DLL in customcontrol you have the choice of modelcolor and modeltext in properties...

I have only ONE problem :-)  If you look at example 4, DrawProgress show the same position of counter in the 4 cases but is not what I wish.

With parameter DP_INIT the user can send a position for each control.  I make this:


invoke SendMessage,hDP1,DP_INIT,0,MAXI
invoke SendMessage,hDP2,DP_INIT,30,MAXI
invoke SendMessage,hDP3,DP_INIT,60,MAXI
invoke SendMessage,hDP4,DP_INIT,90,MAXI <--- next value, DrawProgress redraw hDP1,hDP2,hDP3,hDP4 with counter 90



But DrawProgress does not make the distinction of hDP1,hDP2,hDP3,hDP4 and redraw all to 90.  If I understand well, I must add a filter in  WM_PAINT.Could you help me to do that?  I do not understand yet how to make.

Sorry for my bad english,

Faiseur




French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/

KetilO

Hi

Nice control.

The problem is that they all share the same data:

count dd 0
maxi dd 100
height dd 150
hFont dd 0
modelcolo dd 0
modeltext dd 0
state dd FALSE


You need to make that data private to each control.

Here is the way I prefer to do it.

1. mov wc.cbWndExtra,4 ;Alocate extra memory to hold a pointer to private data
2. On WM_CREATE allocate the neede memory (HeapAlloc)
3. On WM_DESTROY free the allocated memory.

KetilO

KetilO

Here is the modified control.

There is also a division by zero bug. I did not correct it.

KetilO

[attachment deleted by admin]

Faiseur

Thank you very much KetilO !

I have corrected the bug.

With this work I understood several significant things in programming, and also with your complement. It is exactly what I had need to understand.  Your custom control is really a tutorial for me :-)  I will post soon the final result.
French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/

Faiseur

#4
Hello KetilO,


this version is for me good (Dll and static version with 7 examples and sources).

If you agree, it is a new custom control for RadAsm.

:-)

Faiseur

Note: See readme for special note. The base work (ProgressBar style) is from the author "hinte". I did not succeed in finding the author, but this source was free on the Net. I added several options, modifications, and converted in custom control for RadAsmin in DLL and static version + examples.






French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/

KetilO

Hi

Very nice.

You should check for memory and gdi leaks with memproof


http://www.automatedqa.com/downloads/memproof/


KetilO

Faiseur

#6
Hello KetilO,

Thanks. I discover memproof and I understand memory and gdi leaks better...

I corrected the problems with CreateThread and handles objects in examples, and static lib.  Memproof does not say anything any more to me, except when I use BitmapFromResource (GetDC).

Here the corrected version. 

Faiseur

French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/

KetilO

Hi Faiseur

It all works well now, except for the bug in BitMapFromPicture (does not release the dc).

KetilO

Faiseur

#8
Hello KetilO,

the bug GetDC appears when I use BitmapFromResource and I do not use GetDC.  I tested the demo "LoadPic" found on your site (image example) who uses this library and Memproof detects the same problem (does not release the dc).

It is a problem with the "BitmapFromPicture" library (BitmapFromressource calls it).

I added this line at the end of  "BitmapFromPicture.asm" in masm32lib:

"invoke ReleaseDC,NULL,compDC"

...rebuilded masm32lib and function fine.


Faiseur



French asm Forum: http://www.asmforum.net/   Website: http://www.faiseur.net/