S: Example for displaying bmp

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
rowkajjh
Junior Member
Junior Member
Posts: 15
Joined: 2003-11-18, 11:30 UTC

S: Example for displaying bmp

Post by *rowkajjh »

Hello,

I want to write a lister plugin for displaying bayer-bmp images in color.

I looked at the listplugsample from ghisler.com. My problem is that I cannot use a registered window class because I want to display the bmp with StretchDIBits(...) So I have to make my own window for using in CreateWindow(); with RegisterClass.

But I do not know how to do this. Has someone an example?

Thanks - Robert
User avatar
tbeu
Power Member
Power Member
Posts: 1354
Joined: 2003-07-04, 07:52 UTC
Location: Germany
Contact:

Post by *tbeu »

Maybe this sample lister plugin is of help. You might need to replace CreateDialog by CreateWindow, however.

tbeu
TC plugins: Autodesk 3ds Max / Inventor / Revit Preview, FileInDir, ImageMetaData (JPG Comment/EXIF/IPTC/XMP), MATLAB MAT-file Viewer, Mover, SetFolderDate, Solid Edge Preview, Zip2Zero and more
User avatar
rowkajjh
Junior Member
Junior Member
Posts: 15
Joined: 2003-11-18, 11:30 UTC

Post by *rowkajjh »

Hello,

thanks. But it flickers. :-( Here is my WndProc:

LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
CSimpleDIB * dib=(CSimpleDIB*)GetWindowLong(hWnd, GWL_USERDATA);

switch (message)
{
case WM_PAINT:

HDC hDC;
PAINTSTRUCT ps;
hDC = BeginPaint(hWnd, &ps);



RECT rc;
GetClientRect(hWnd,&rc);

StretchBlt(hDC,
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
dib->GetHDC(), 0, 0,
dib->GetWidth(), dib->GetHeight(), SRCCOPY);

EndPaint(hWnd, &ps);

// MSDN: An application returns zero if it processes this message.
return 0;


case WM_ERASEBKGND :

// An application should return nonzero if it erases the background;
return 1;
}

return DefWindowProc(hWnd, message, wParam, lParam);
}


Where is the problem?

Thanks - Robert
User avatar
rowkajjh
Junior Member
Junior Member
Posts: 15
Joined: 2003-11-18, 11:30 UTC

Post by *rowkajjh »

I just get the tip:

> Perhaps one of the owner windows does the update?
> You could try the add WS_CLIPCHILDREN to the style of the parent
> window.

I tried

LONG oldStyle = GetWindowLong(ParentWin, GWL_STYLE);
oldStyle &= WS_CLIPCHILDREN;
SetWindowLong(ParentWin, GWL_STYLE, oldStyle);

in the ListLoad function without luck.
:?:
User avatar
rowkajjh
Junior Member
Junior Member
Posts: 15
Joined: 2003-11-18, 11:30 UTC

Post by *rowkajjh »

I just looked with spy++. The lister window has already the WS_CLIPCHILDREN-Style (and some other like WS_CLIPSIBLINGS...)

Hmmmm, any idea?

I just discovered that the lister also flickers when viewing Bitmaps. So it's not only my plugin...
Post Reply