Click here to Skip to main content
16,006,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog Based & Menu Update :: MFC Pin
valikac5-Sep-02 13:55
valikac5-Sep-02 13:55 
Questionhow to check that a certain table exists in the db? Pin
ns5-Sep-02 10:18
ns5-Sep-02 10:18 
AnswerRe: how to check that a certain table exists in the db? Pin
Carlos Antollini5-Sep-02 10:28
Carlos Antollini5-Sep-02 10:28 
GeneralRe: how to check that a certain table exists in the db? Pin
ns5-Sep-02 10:45
ns5-Sep-02 10:45 
GeneralRe: how to check that a certain table exists in the db? Pin
ns5-Sep-02 10:50
ns5-Sep-02 10:50 
GeneralSendMessage returns LB_ERR when sending LB_SETITEMDATA message. Pin
5-Sep-02 10:03
suss5-Sep-02 10:03 
GeneralRe: SendMessage returns LB_ERR when sending LB_SETITEMDATA message. Pin
Joaquín M López Muñoz5-Sep-02 12:31
Joaquín M López Muñoz5-Sep-02 12:31 
QuestionHow can I use LPBITMAPINFOHEADER to store and redisplay view contents? Pin
Ted Christiansen5-Sep-02 8:50
Ted Christiansen5-Sep-02 8:50 
Hello,

This is code from an OnEditCopy handler of the Visualization Toolkit. I am trying to add animations to my application by generating the frames (as bitmaps) and then redisplaying them. I have tried using the CPicture class here and the vtk offscreen rendering (using a bitmap writer object), but it is unreliable, crashing the program.

Another solution would be to adapt this code to store the contents. I have never used LPBITMAPINFOHEADER. Can anyone point me in the right direction on how to copy this bitmap data onto the view, thus displaying it? Thanks.

Ted


LPBITMAPINFOHEADER lpbi; // pointer to BITMAPINFOHEADER
DWORD dwLen; // size of memory block
HANDLE hDIB = NULL; // handle to DIB, temp handle

vtkWindow *vtkWin = pView->GetVTKWindow();
int *size = vtkWin->GetSize();
int dataWidth = ((size[0]*3+3)/4)*4;

dwLen = sizeof(BITMAPINFOHEADER) + dataWidth*size[1];

// allocate memory for the bitmap
hDIB = ::GlobalAlloc(GHND, dwLen);

// setup bitmap info header
lpbi = (LPBITMAPINFOHEADER) ::GlobalLock(hDIB);
lpbi->biSize = sizeof(BITMAPINFOHEADER);
lpbi->biWidth = size[0];
lpbi->biHeight = size[1];
lpbi->biPlanes = 1;
lpbi->biBitCount = 24;
lpbi->biCompression = BI_RGB;
lpbi->biClrUsed = 0;
lpbi->biClrImportant = 0;
lpbi->biSizeImage = dataWidth*size[1];

// start memory rendering
pView->SetupMemoryRendering(size[0],size[1], pView->GetDC()->GetSafeHdc());
vtkWin->Render();

// copy the bitmap data into the bitmap
memcpy((LPSTR)lpbi + lpbi->biSize, pView->GetMemoryData(), dataWidth*size[1]);

::GlobalUnlock(hDIB);

// turn screen rendering back on
pView->ResumeScreenRendering();

// now how can we draw this bitmap on the view (CDC)?

AnswerRe: How can I use LPBITMAPINFOHEADER to store and redisplay view contents? Pin
Chris Losinger5-Sep-02 9:21
professionalChris Losinger5-Sep-02 9:21 
GeneralRe: How can I use LPBITMAPINFOHEADER to store and redisplay view contents? Pin
Ted Christiansen7-Sep-02 2:49
Ted Christiansen7-Sep-02 2:49 
GeneralRe: How can I use LPBITMAPINFOHEADER to store and redisplay view contents? Pin
Chris Losinger7-Sep-02 5:35
professionalChris Losinger7-Sep-02 5:35 
GeneralPostQuitMessage(0) wont quit the app Pin
ns5-Sep-02 8:25
ns5-Sep-02 8:25 
GeneralRe: PostQuitMessage(0) wont quit the app Pin
ns5-Sep-02 8:31
ns5-Sep-02 8:31 
GeneralRe: PostQuitMessage(0) wont quit the app Pin
dazinith5-Sep-02 9:22
dazinith5-Sep-02 9:22 
GeneralRe: PostQuitMessage(0) wont quit the app Pin
ns5-Sep-02 10:09
ns5-Sep-02 10:09 
GeneralRe: PostQuitMessage(0) wont quit the app Pin
Joaquín M López Muñoz5-Sep-02 12:03
Joaquín M López Muñoz5-Sep-02 12:03 
Generalreverse read Pin
Shotgun5-Sep-02 8:16
Shotgun5-Sep-02 8:16 
Questioncan i make activex of my application?? Pin
aashu5-Sep-02 7:02
aashu5-Sep-02 7:02 
QuestionIs There a way to get notified when network is done or up in VC++? Pin
Anonymous5-Sep-02 6:35
Anonymous5-Sep-02 6:35 
AnswerRe: Is There a way to get notified when network is done or up in VC++? Pin
Joaquín M López Muñoz5-Sep-02 7:46
Joaquín M López Muñoz5-Sep-02 7:46 
GeneralRe: Is There a way to get notified when network is done or up in VC++? Pin
Anonymous5-Sep-02 8:42
Anonymous5-Sep-02 8:42 
GeneralSource Control Pin
Bugra Barin5-Sep-02 6:25
Bugra Barin5-Sep-02 6:25 
GeneralRe: Source Control Pin
Pavel Klocek5-Sep-02 6:32
Pavel Klocek5-Sep-02 6:32 
GeneralRe: Source Control Pin
Daniel Turini5-Sep-02 10:22
Daniel Turini5-Sep-02 10:22 
GeneralRe: Source Control Pin
Bugra Barin5-Sep-02 11:42
Bugra Barin5-Sep-02 11:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.