Click here to Skip to main content
15,916,951 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralHelp!! How to change the ListBox and EditBox background & text color without using MFC!! Thanks.. Pin
Jason Hsu10-May-00 1:25
Jason Hsu10-May-00 1:25 
GeneralRe: Help!! How to change the ListBox and EditBox background & text color without using MFC!! Thanks.. Pin
Kurt10-May-00 1:35
Kurt10-May-00 1:35 
GeneralBand Pin
Member 23759-May-00 16:07
Member 23759-May-00 16:07 
GeneralRe: Band Pin
Alex Gorev10-May-00 4:19
Alex Gorev10-May-00 4:19 
QuestionLPCOLESTR? Pin
Alain Royer9-May-00 10:33
Alain Royer9-May-00 10:33 
AnswerRe: LPCOLESTR? Pin
Alex Gorev9-May-00 11:01
Alex Gorev9-May-00 11:01 
AnswerRe: LPCOLESTR? Pin
Dundas TCP/IP Support9-May-00 11:29
Dundas TCP/IP Support9-May-00 11:29 
GeneralMetafile output on Win98 problem Pin
Chris Losinger9-May-00 9:27
professionalChris Losinger9-May-00 9:27 
I'm creating simple WMFs (Aldus and non-Aldus) by doing a simple StretchDIBits with a DIB i've created myself. i know the DIB is valid because a) if i draw it to the screen, it looks fine, and b) the code works on NT, Win2K and, i think, 95.

when i create these metafiles in Win98, however, the image is shifted to the right 20 (i haven't measured) pixels or so - what should be the left edge of the image appears about 20 pixels from the displayed left edge, and, the colors are wrong on the part of the image to the right of the real left edge (the components are swapped, apparently).

it sounds like the DIB is wrong, but i know it's not.

also, i've tried doing this with an HBITMAP and BitBlt, with the same results.

more info....

if i open these WMFs in PSP 6, they look fine. if i view them with ACDSee or the Win98 Explorer, they have the offset problem.

if i read it into PSP6, then resave, the new WMF looks fine in ACDSee, Win98's Explorer and PSP.

i'm stumped.

are there tricks to saving WMFs that aren't documented?????

any info is appreciated.

-c

// use the screen DC
HDC dc = ::GetDC(NULL);
if (dc!=NULL)
{
// calculate output rect....
....

HDC hMetaDC = ::CreateEnhMetaFile(dc, NULL, &rect, "");
if (hMetaDC!=NULL)
{

// map mode junk
SetMapMode(hMetaDC, MM_ANISOTROPIC);
SetWindowExtEx(hMetaDC, iDPIX, iDPIY, NULL);
SetViewportExtEx(hMetaDC, iDPIX, iDPIY, NULL);

BITMAPINFO bmInfo = *(LPBITMAPINFO)pDIB ;

// this function uses generic 24bit DIBs, only. i know this
// because i generate them myself.

LPVOID lpDIBBits = (LPVOID)(pDIB + bmInfo.bmiHeader.biSize);

UINT32 lines = ::StretchDIBits(hMetaDC,
0,0,
width, height,
0,0,
width, height,
lpDIBBits,
&bmInfo,
DIB_RGB_COLORS,
SRCCOPY);

HENHMETAFILE hMeta = ::CloseEnhMetaFile(hMetaDC);


// How big will the metafile bits be?
UINT32 dwSize = GetWinMetaFileBits( hMeta, 0, NULL,
MM_ANISOTROPIC, dc );

if (dwSize!=0)
{
// Allocate that much memory
ISByteArray bitBuf(dwSize);
BYTE *pBits = (BYTE *)bitBuf;

// Let windows convert the enhanced metafile to a 16
windows metafile
GetWinMetaFileBits( hMeta, dwSize, pBits, MM_ANISOTROPIC,
dc );

// Write the metafile bits
io.WriteBuf(pBits, dwSize);
}

::DeleteEnhMetaFile(hMeta);

}

::ReleaseDC(NULL, dc);
}
GeneralRe: Metafile output on Win98 problem Pin
Gert Boddaert10-May-00 3:17
Gert Boddaert10-May-00 3:17 
QuestionHow to call a com object's method that takes VARIANT * parameters? Pin
plu9-May-00 6:55
plu9-May-00 6:55 
AnswerRe: How to call a com object's method that takes VARIANT * parameters? Pin
Member 10549-May-00 8:29
Member 10549-May-00 8:29 
QuestionHow to call other class functions from another class Pin
olive9-May-00 4:14
olive9-May-00 4:14 
GeneralDisplaying the Property Sheet for a file Pin
magesh9-May-00 2:42
magesh9-May-00 2:42 
GeneralRe: Displaying the Property Sheet for a file Pin
Mike Dunn9-May-00 15:51
Mike Dunn9-May-00 15:51 
GeneralRe: Displaying the Property Sheet for a file Pin
magesh9-May-00 19:24
magesh9-May-00 19:24 
GeneralRe: Displaying the Property Sheet for a file Pin
magesh9-May-00 19:25
magesh9-May-00 19:25 
GeneralRe: Displaying the Property Sheet for a file Pin
Brian Hart25-Jun-00 13:37
Brian Hart25-Jun-00 13:37 
GeneralRemoving caption bar in toolbar Pin
Andrebon9-May-00 2:20
Andrebon9-May-00 2:20 
GeneralRe: Removing caption bar in toolbar Pin
Cristi Posea9-May-00 4:38
Cristi Posea9-May-00 4:38 
GeneralControls Pin
Ravi8-May-00 23:25
Ravi8-May-00 23:25 
GeneralRe: Controls Pin
Mike Dunn9-May-00 15:58
Mike Dunn9-May-00 15:58 
QuestionHow to use ActiveX without dialog ? Pin
Member 36018-May-00 15:02
Member 36018-May-00 15:02 
AnswerRe: How to use ActiveX without dialog ? Pin
Hussam Ahmad8-May-00 21:30
Hussam Ahmad8-May-00 21:30 
GeneralRe: How to use ActiveX without dialog ? Pin
Kurt10-May-00 1:48
Kurt10-May-00 1:48 
QuestionIs there any way of printing a pdf file? Pin
Erich J. Ruth8-May-00 14:45
sussErich J. Ruth8-May-00 14:45 

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.