I wrote some code for that somewhere around 18 months ago. It uses a bitmap, so you'll need to use the same for this code, or get a library from somewhere to convert the image you use to bitmap form in memory.
Anyway, add the bitmap as a resource to your application - the IDE will set up the resource.h file automatically with a define like so:
Make sure that resource.h file is included within the .cpp file you plan to use to create your image in. In this example, I'm just using the main source file:
#include <DarkGDK.h>
#include "resource.h"
#define IMAGENUM 1
#define MEMBLOCKNUM 1
void DarkGDK(void)
{
HBITMAP hMiniBitmap = LoadBitmap(GetModuleHandle(0), MAKEINTRESOURCE(IDB_BITMAP1));
if (hMiniBitmap)
{
// Get the size of the bitmap
BITMAP bitmap;
::GetObject(hMiniBitmap, sizeof(BITMAP),&bitmap);
int size = bitmap.bmHeight*bitmap.bmWidth*bitmap.bmBitsPixel/8;
// Get the bitmap data from the resource
BYTE *lpBits = new BYTE[ size ];
::GetBitmapBits(hMiniBitmap, size, lpBits);
// Copy the bitmap datato a memory block
dbMakeMemblock(MEMBLOCKNUM, size + 12);
for (int i=0; i<size; i++)
dbWriteMemblockByte(MEMBLOCKNUM, i+12, lpBits[i]);
dbWriteMemblockDWORD(MEMBLOCKNUM, 0, bitmap.bmWidth);
dbWriteMemblockDWORD(MEMBLOCKNUM, 4, bitmap.bmHeight);
dbWriteMemblockDWORD(MEMBLOCKNUM, 8, bitmap.bmBitsPixel);
// Cleanup
delete []lpBits;
dbMakeImageFromMemblock(IMAGENUM, MEMBLOCKNUM);
}
while (LoopGDK() && dbScanCode() == 0)
{
dbPasteImage(IMAGENUM, 0, 0);
dbSync();
}
}
That's how I did it in the past - what I'd do now is use on of the dbMakeImage commands to create a DX texture and put the data directly into the texture rather than via a memblock.
[EDIT]Quick hack of the code to make sure it works with the latest release