Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Save hBitmap as an image

Author
Message
N3wton
10
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 20th Oct 2009 01:15
Hiya,

I'm working on a plugin which basically takes a screen shot then saves it...

here's my code so far



as you can see, it takes a screen shot and gets the hBitmap from the clipboard, But i have no idea on how to save it, or better yet, return it to DBPro as an image...

any ideas?

Yours
N3wton

Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 20th Oct 2009 14:13
You could make a memblock, and then copy the data from the hBitmap into the memblock, and then use 'make image from memblock'.

A faster but more complicated way would be to look at the internal commands of the ImageDebug dll. There is a command to create a new image. You can then use another function to get a pointer to the IDirect3DTexture9 interface. From there you need to get the first surface level using 'GetSurfaceLevel'. Once you have the surface, you can call 'GetDC' on the surface, and then use GDI to copy the data from the hBitmap to the hDC.

chunks chunks
12
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 22nd Oct 2009 20:32
have a look here http://forum.thegamecreators.com/?m=forum_view&t=119287&b=22 it shows how to copy a bitmap into a memblock in the gdk ,a plugin is basically the same just sub the gdks memblock commands for your called plugin ones .

an easy way to save a full dbpro snapshot is to grab the dbpro`s d3d device pointer and then grab the backbuffer surface and use d3dxsavesurfacetofile function in the dx sdk , i did this a while back will post the code when i find it.

chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
Sven B
14
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 25th Oct 2009 18:37
Quote: "A faster but more complicated way would be to look at the internal commands of the ImageDebug dll. There is a command to create a new image. You can then use another function to get a pointer to the IDirect3DTexture9 interface."


All you need is load the procedure of the image DLL, decorated as ?Make@@YAPAUIDirect3DTexture9@@HHH@Z
It takes 3 parameters: Image Number, Width, Height and it returns a pointer to the newly created IDirect3DTexture9 structure.

Sven B

Login to post a reply

Server time is: 2019-10-19 08:05:19
Your offset time is: 2019-10-19 08:05:19