Windows externals and the imagePixmapID

Thierry Arbellot thierry.arbellot at wanadoo.fr
Thu Jan 20 03:57:55 EST 2005


Actually, you know Windows programming better than me.
When needed, I will ask you for help.

Regards.
Thierry

On 2005, Jan 20, , at 1:16, Frank D. Engel, Jr. wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Aha!  Turns out I was asking the wrong question, but that code 
> certainly helped me to find a way to do it.
>
> I ended up using a GDI "DIB Section" object as an intermediary between 
> the screen-level DDB and the printer DC; it went something like this 
> (slightly modified to simplify, though coded in an external I'm 
> working on for Rev):
>
>
> HDC printerDC;    /* provided target DC */
> HBITMAP screenDDB, sect, oldbits;    /* screenDDB is the imagePixmapID 
> from Rev */
> BITMAP bmap;
> int dx, dy, dw, dh;   /* provided position and size on printed page */
>
>
> if (GetObject(screenDDB, sizeof(BITMAP), &bmap) != sizeof(BITMAP)) 
> <failure-exit>;
>
> /* create a DIB Section version of the bitmap */
> sect = CopyImage(screenDDB, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
>
> /* select it into a memory region */
> memDC = CreateCompatibleDC(printerDC);
> oldbits = (HBITMAP)SelectObject(memDC, sect);
>
> /* render onto printer page */
> StretchBlt(printerDC, dx, dy, dw, dh,
>                   memDC, 0, 0, bmap.bmWidth, bmap.bmHeight, SRCCOPY);
>
> /* clean up */
>
> SelectObject(memDC, oldbits);
> DeleteDC(memDC);
> DeleteObject(sect);
>
>
>
> Now I'll be able to sleep tonight (well, at least the chances of it 
> are improved)!
>
> Thank you.
>
> On Jan 19, 2005, at 3:41 PM, Thierry Arbellot wrote:
>
>> I use the following code to create a screen HDC and attach the 
>> imagePixmapID to it.
>>
>> 	long			imagePixmapId;
>> 	HBITMAP 	screenImageBM;
>> 	HDC			theHdc;
>>
>> 	theHdc = CreateCompatibleDC(NULL);		// screen DC
>> 	screenImageBM = (HBITMAP) imagePixmapId;
>> 	SelectObject(theHdc,screenImageBM);
>>
>> I hope it helps
>>
>> Thierry
>>
>> On 2005, Jan 19, , at 21:26, Frank D. Engel, Jr. wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Hmm, anyone know how I can use the Win32 API to obtain a HDC for 
>>> that HBITMAP?  I'm looking for a way to render the bitmap into 
>>> another device context (specifically, a printer device context).  
>>> Using the imagePixmapID seemed to me the easiest way to get the 
>>> image across from a Rev stack to Win32 api code in an external, but 
>>> I am starting to wonder...
>>>
>>> On Jan 19, 2005, at 9:31 AM, Frank D. Engel, Jr. wrote:
>>>
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> Thank you!
>>>>
>>>> On Jan 19, 2005, at 4:47 AM, Thierry Arbellot wrote:
>>>>
>>>>> imagePixmapID is an HBITMAP
>>>>>
>>>>> Thierry.
>>>>>
>>>>> On 2005, Jan 18, , at 19:44, Frank D. Engel, Jr. wrote:
>>>>>
>>>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>>>> Hash: SHA1
>>>>>>
>>>>>> Does anyone know what form the imagePixmapID takes under the 
>>>>>> Windows engine for Rev?  Is it an HBITMAP or an HDC, or something 
>>>>>> else entirely?
>>>>>>
>>>>>> Thank you!
>>>>>>
>>>>>> - - -----------------------------------------------------------
>>>>>> Frank D. Engel, Jr.  <fde101 at fjrhome.net>
>>>>>>
>>>>>> $ ln -s /usr/share/kjvbible /usr/manual
>>>>>> $ true | cat /usr/manual | grep "John 3:16"
>>>>>> John 3:16 For God so loved the world, that he gave his only 
>>>>>> begotten Son, that whosoever believeth in him should not perish, 
>>>>>> but have everlasting life.
>>>>>> -----BEGIN PGP SIGNATURE-----
>>>>>> Version: GnuPG v1.2.4 (Darwin)
>>>>>>
>>>>>> iD8DBQFB7VkN7aqtWrR9cZoRAqMYAJ4ooEuOcblOnUUz2LLwcl7OxvahyQCfaQrX
>>>>>> tHEgStdm/CnD1DLueFNoM2Y=
>>>>>> =wV7X
>>>>>> -----END PGP SIGNATURE-----
>>>>>>
>>>>>>
>>>>>>
>>>>>> ___________________________________________________________
>>>>>> $0 Web Hosting with up to 120MB web space, 1000 MB Transfer
>>>>>> 10 Personalized POP and Web E-mail Accounts, and much more.
>>>>>> Signup at www.doteasy.com
>>>>>>
>>>>>> _______________________________________________
>>>>>> use-revolution mailing list
>>>>>> use-revolution at lists.runrev.com
>>>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> use-revolution mailing list
>>>>> use-revolution at lists.runrev.com
>>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>>>
>>>>>
>>>> - -----------------------------------------------------------
>>>> Frank D. Engel, Jr.  <fde101 at fjrhome.net>
>>>>
>>>> $ ln -s /usr/share/kjvbible /usr/manual
>>>> $ true | cat /usr/manual | grep "John 3:16"
>>>> John 3:16 For God so loved the world, that he gave his only 
>>>> begotten Son, that whosoever believeth in him should not perish, 
>>>> but have everlasting life.
>>>> $
>>>> -----BEGIN PGP SIGNATURE-----
>>>> Version: GnuPG v1.2.4 (Darwin)
>>>>
>>>> iD8DBQFB7m9Y7aqtWrR9cZoRAlT3AJ4qXzEZz8rC3xovVx5tsVeF8uLJfwCffUHH
>>>> Ntbc+NXKQLO4GFuyHWu9URw=
>>>> =SBGG
>>>> -----END PGP SIGNATURE-----
>>>>
>>>>
>>>>
>>>> ___________________________________________________________
>>>> $0 Web Hosting with up to 120MB web space, 1000 MB Transfer
>>>> 10 Personalized POP and Web E-mail Accounts, and much more.
>>>> Signup at www.doteasy.com
>>>>
>>>> _______________________________________________
>>>> use-revolution mailing list
>>>> use-revolution at lists.runrev.com
>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>>
>>>>
>>> - -----------------------------------------------------------
>>> Frank D. Engel, Jr.  <fde101 at fjrhome.net>
>>>
>>> $ ln -s /usr/share/kjvbible /usr/manual
>>> $ true | cat /usr/manual | grep "John 3:16"
>>> John 3:16 For God so loved the world, that he gave his only begotten 
>>> Son, that whosoever believeth in him should not perish, but have 
>>> everlasting life.
>>> $
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.2.4 (Darwin)
>>>
>>> iD8DBQFB7sJk7aqtWrR9cZoRAo9cAJ9yP2YKhPCrO4QZJMZZWX85rJDJJgCfadqz
>>> SWzB05iunT27tCMSBe5rfgo=
>>> =Ue8d
>>> -----END PGP SIGNATURE-----
>>>
>>>
>>>
>>> ___________________________________________________________
>>> $0 Web Hosting with up to 120MB web space, 1000 MB Transfer
>>> 10 Personalized POP and Web E-mail Accounts, and much more.
>>> Signup at www.doteasy.com
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
> - - -----------------------------------------------------------
> Frank D. Engel, Jr.  <fde101 at fjrhome.net>
>
> $ ln -s /usr/share/kjvbible /usr/manual
> $ true | cat /usr/manual | grep "John 3:16"
> John 3:16 For God so loved the world, that he gave his only begotten 
> Son, that whosoever believeth in him should not perish, but have 
> everlasting life.
> $
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (Darwin)
>
> iD8DBQFB7vhD7aqtWrR9cZoRAj6tAJ0eX/gnbU49knqP2IY5p7z+nyNB+gCfWIfH
> Q80mj9iSN3RANbtszgxf1FY=
> =Uuh+
> -----END PGP SIGNATURE-----
>
>
>
> ___________________________________________________________
> $0 Web Hosting with up to 120MB web space, 1000 MB Transfer
> 10 Personalized POP and Web E-mail Accounts, and much more.
> Signup at www.doteasy.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list