PDA

View Full Version : Fixed sample scripts with dissapearing images



Michael Hartlef
07-04-2008, 20:58
Hi Eros,

I attached 3 sample scripts that suffer from the dissapearing image bug. Actually the bitmap handles were defined wrong. Instead of defining them as DWORD, they have to be LONG. Then it works all the time.

Cheers
Michael

ErosOlmi
07-04-2008, 21:07
:o
thanks so much !! I checked so long to try to find a reason.
Now the problem is WHY?
There must be some crazy bit somewhere

Michael Hartlef
07-04-2008, 21:12
Why? Just a wrong declaration of the image handle, nothing else. Sometimes you get negative handles and with a DWORD the value then is simple wrong. I looked into this after remembering that Zlatko posted the problem again in the Codingmonkeys forum.

ErosOlmi
07-04-2008, 21:25
There is something not clear to me. I was convinced all pointers where DWORDs in 32bit OS
Also LoadImage is declared to return a DWORD also in Power Basic.

In Microsoft documentation LoadImage (http://msdn2.microsoft.com/en-us/library/ms648045(VS.85).aspx) is declared to return a HANDLE
And a HANDLE (http://msdn2.microsoft.com/en-us/library/aa383751(VS.85).aspx) is declared as a pointer to void (means anything) in any case a pointer.

???
mumble mumble
:-\

Petr Schreiber
07-04-2008, 21:28
Well,

I also thought it is no problem using LONGs instead of DWORDs for handles, they have same size, and I thought some sign cannot change anything on it.

Very strange,
but I am happy it works now!,

Petr

ErosOlmi
07-04-2008, 21:34
Yes, exactly.
They have the same size so its "meaning" is assigned by the function that change it or read it.
Maybe we need some assembler man that gives some light.

Michael Clease
07-04-2008, 23:14
I dont know how old this is but it uses DWords http://www.cesis.lv/learn/asm/asm3.html

Some interesting stuff but I think its copyrighted material http://www.cesis.lv/learn/

Eros delete the above link if you think its dodgy.