Click here to Skip to main content
16,011,170 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: code request for sound sampling Pin
Blake Miller19-Jun-00 3:56
Blake Miller19-Jun-00 3:56 
Generaltemplates/exe-size/optimalizations Pin
real name19-Jun-00 1:48
sussreal name19-Jun-00 1:48 
Generalrotation Pin
stanley18-Jun-00 4:27
stanley18-Jun-00 4:27 
GeneralCustomizing the Visual C++ window Pin
Anonymous17-Jun-00 23:52
Anonymous17-Jun-00 23:52 
GeneralNeed an idea please Pin
Salman A Khilji17-Jun-00 12:27
Salman A Khilji17-Jun-00 12:27 
QuestionHow do I resize the printer output ?? Pin
Member 15847217-Jun-00 8:09
Member 15847217-Jun-00 8:09 
Generalusing accelerators Pin
moron16-Jun-00 11:06
moron16-Jun-00 11:06 
GeneralGrouping GDI calls in a Metafile Pin
Chris Paulse16-Jun-00 9:05
Chris Paulse16-Jun-00 9:05 
I have (without success) been trying to use the SDK call GDIComment() (CDC::AddMetaFileComment()) to create groups in a drawing I put on the clipboard as a metafile. I'm sure I'm doing something stupid. Amazingly, there is little or no documentation of this in the Platform SDK.

Here is a simple example of what I'm trying to do (from OnDraw()), :

CPen pen(PS_SOLID, 2, RGB(0,0,0));
CPen* pOldPen = (CPen*)pDC->SelectObject(&pen);

#pragma pack(push, 1)
// byte array for begingroup
struct {
UINT ident;
DWORD iComment;
RECTL rclOutput;
DWORD nDescription;
} beginBuf;
// byte array for endgroup
struct {
UINT ident;
DWORD iComment;
} endBuf;

// if this is a metafile DC, create the first group
if (dynamic_cast<cmetafiledc*> (pDC))
{
beginBuf.ident = GDICOMMENT_IDENTIFIER;
beginBuf.iComment = GDICOMMENT_BEGINGROUP;
beginBuf.rclOutput.top = 0;
beginBuf.rclOutput.bottom = 200;
beginBuf.rclOutput.left = 0;
beginBuf.rclOutput.right = 200;
beginBuf.nDescription = 0;
BOOL bRet = ::GdiComment(pDC->GetSafeHdc(), sizeof(beginBuf), (const unsigned char *)&beginBuf);
if (!bRet)
{
ASSERT(0);
int iRet = GetLastError();
}
}
// draw an X
pDC->MoveTo(0,0);
pDC->LineTo(200,200);
pDC->MoveTo(200,0);
pDC->LineTo(0,200);
// end the first group
if (dynamic_cast<cmetafiledc*> (pDC))
{
endBuf.ident = GDICOMMENT_IDENTIFIER;
endBuf.iComment = GDICOMMENT_ENDGROUP;

BOOL bRet = ::GdiComment(pDC->GetSafeHdc(), sizeof(endBuf), (const unsigned char *)&endBuf);
if (!bRet)
{
ASSERT(0);
int iRet = GetLastError();
}
// begin the second group
beginBuf.ident = GDICOMMENT_IDENTIFIER;
beginBuf.iComment = GDICOMMENT_BEGINGROUP;
beginBuf.rclOutput.top = 205;
beginBuf.rclOutput.bottom = 415;
beginBuf.rclOutput.left = 0;
beginBuf.rclOutput.right = 200;
beginBuf.nDescription = 0;
bRet = ::GdiComment(pDC->GetSafeHdc(), sizeof(beginBuf), (const unsigned char *)&beginBuf);
if (!bRet)
{
ASSERT(0);
int iRet = GetLastError();
}
}
// draw an X further down the screen
pDC->MoveTo(0,210);
pDC->LineTo(200,410);
pDC->MoveTo(200,210);
pDC->LineTo(0,410);
// end the second group for a metafile DC
if (dynamic_cast<cmetafiledc*> (pDC))
{
endBuf.ident = GDICOMMENT_IDENTIFIER;
endBuf.iComment = GDICOMMENT_ENDGROUP;
BOOL bRet = ::GdiComment(pDC->GetSafeHdc(), sizeof(endBuf), (const unsigned char *)&endBuf);
if (!bRet)
{
ASSERT(0);
int iRet = GetLastError();
}
}
pDC->SelectObject(pOldPen);
GeneralDocking dialog bar Pin
Anonymous16-Jun-00 8:23
Anonymous16-Jun-00 8:23 
GeneralRe: Docking dialog bar Pin
Chris Maunder17-Jun-00 4:26
cofounderChris Maunder17-Jun-00 4:26 
GeneralRe: Docking dialog bar Pin
Anonymous17-Jun-00 22:39
Anonymous17-Jun-00 22:39 
GeneralResource ID's Pin
Member 135616-Jun-00 5:29
Member 135616-Jun-00 5:29 
GeneralRe: Resource ID's Pin
Blake Miller16-Jun-00 18:12
Blake Miller16-Jun-00 18:12 
QuestionAnybody seen an ATL/MMC snap in tutorial? Pin
Matthias16-Jun-00 3:32
Matthias16-Jun-00 3:32 
GeneralPassing a function as a variable Pin
Bruce Hearder15-Jun-00 22:49
Bruce Hearder15-Jun-00 22:49 
GeneralRe: Passing a function as a variable Pin
Chris Maunder16-Jun-00 2:48
cofounderChris Maunder16-Jun-00 2:48 
GeneralEnumSystemLocales... Pin
Member 437415-Jun-00 22:00
Member 437415-Jun-00 22:00 
GeneralDrawDragRect Pin
Homber Martinez15-Jun-00 20:57
Homber Martinez15-Jun-00 20:57 
GeneralRe: DrawDragRect Pin
Cristi Posea15-Jun-00 23:47
Cristi Posea15-Jun-00 23:47 
Generalproblem: printing multiple pages Pin
JCpp15-Jun-00 10:17
JCpp15-Jun-00 10:17 
GeneralRe: problem: printing multiple pages Pin
kasreng16-Jun-00 11:28
kasreng16-Jun-00 11:28 
Questionmaximum number of objects? Pin
derhackler15-Jun-00 6:43
derhackler15-Jun-00 6:43 
GeneralOnFileNew: Maximize child window Pin
Christoph Rupp15-Jun-00 4:47
sussChristoph Rupp15-Jun-00 4:47 
GeneralRe: OnFileNew: Maximize child window Pin
Uwe Keim15-Jun-00 8:11
sitebuilderUwe Keim15-Jun-00 8:11 
GeneralRe: OnFileNew: Maximize child window Pin
Petrica15-Jun-00 22:47
Petrica15-Jun-00 22:47 

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.