|
At one point in my app, I have a bitmap and an enhanced meta DC I want to copy the bitmap into the meta Dc so that I can copy to the clipboard.
I can't seem to get this to work.
here is my code
if ( OpenClipboard(hdc) )
{
EmptyClipboard();
//create the metafile DC
CMetaFileDC * cDC = new CMetaFileDC();
cDC->CreateEnhanced(GetDC(),NULL,NULL,NULL);
//call draw routine here that makes GDI calls int cDC
// my bitmap is here!!
//close meta CMetafileDC and get its handle
HENHMETAFILE handle = cDC->CloseEnhanced();
//place it on the clipboard
SetClipboardData(CF_ENHMETAFILE,handle);
CloseClipboard();
//delete the dc
delete cDC;
}
I am stumped, any help appreciated
IGeorgeI
George W
|
|
|
|
|
I think you might need to detach the metafile before deleting it:
cDC->Detach();
delete cDC;
BTW: you might as well create the CMetaFileDC on the stack instead of using new .
Also BTW: It is possible to put bitmaps on the clipboard directly.
--------
I'm not sick, but i'm not well
And i'm so hot, 'cause i'm in hell... Harvey Danger, Flagpole Sitta
|
|
|
|
|
Thanks for reply but that didn't work.
I have captured one of my components and saved it in memory as a bitmap. The class that I am using to capture, saves it as a bitmap so I have no choice but to work with bitmaps.
I can already copy it as a bitmap to the clipboard and paste into other applications. That works great.
I want to now copy it into the clipboard as an enhaced meta file.
I have been trying to stretchBlt the bitmap to the EMF but that seems to work sort of but there is offsets and distortion that occurs.
I just want to know if there is a propper way to copy the bitmap to an Enhanced meta file.
I am really stumped here.
IGeorgeI
George W
|
|
|
|
|
Are you asking how to do it?
If so, this is what you need to do:
cDC->CreateEnhanced(hdc,NULL,NULL,NULL);
...
CDC dcMem;
CBitmap *bmpOld;
dcMem.CreateCompatibleDC(hdc);
bmpOld = dcMem.SelectObject(&cBitmap);
BITMAP bm;
cBitmap.GetBitmap(&bm);
cDC.BitBlt(x, y, bm.bmWidth, bm.bmHeight, dcMem, 0,0, SRCCOPY);
dcMem.SelectObject(bmpOld);
...
GoodLuck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I have need to add a simple splitter between two controls (could be a CTreeCtrl and a CListCtrl, 2 ListCtrl's, etc) in a dialog box. They need to be both side by side, and one on top of the other (depeding on the dialog).
Is there an existing class that I can use that I am unaware of? If not, does someone have an example of how to get started on this?
Any help is appreciated.
: Karnatos
|
|
|
|
|
Have you checked any of these babies out yet?
Mike Mullikin
Our lager, Who art in barrels, Hallowed be thy drink, Thy will be drunk, (I will be drunk) At home as I am in the tavern, Give us this day our foamy head, And forgive us our spillages, As we forgive those who spill against us, And lead us not to incarceration, But deliver us from hangovers, For thine is beer, The bitter and the lager, Forever and ever, Barmen.
|
|
|
|
|
I'm partial to this one.
--------
I'm not sick, but i'm not well
And i'm so hot, 'cause i'm in hell... Harvey Danger, Flagpole Sitta
|
|
|
|
|
Sounds like it fits the bill - I'll be trying it out!
Thanks for the lead, much appreciated.
: Dean
|
|
|
|
|
It occurs to me, now that i look at it, that the version i'm using has been hacked to allow opaque sizing; if this is something you'd want, mail me & i'll send you a copy.
--------
I'm not sick, but i'm not well
And i'm so hot, 'cause i'm in hell... Harvey Danger, Flagpole Sitta
|
|
|
|
|
Many programs add according shell items for convenience,and then can execute
the corresponding task provieded by the program,this is great.but i am not
sure how to do this,who can help me?
|
|
|
|
|
Check out the articles in this index to see if they can help you:
|
|
|
|
|
Hi
i have a file where each line contains a decimal number (between 0 and 4) and a hexadecimal number between (0 and FFFFFFFF).
what is the best way to read this file and convert the hexadecimal number into a binary number.
thanks
Mohe
|
|
|
|
|
Read my article on ostringstream - it will do this conversion for you. If you're doing file i/o ifstream/ofstream will work in exactly the same way as ostringstring does.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
Does anyone know the minimum requirements for the .NET framework? CPU, RAM, OS, etc. Thanks
Chris Hafey
|
|
|
|
|
Nevermind, I found it at the download site for the framework redistributable:
Typical Installation Requirements
The .NET Framework runs on:
Microsoft Windows® 98
Microsoft Windows NT® 4.0 (SP 6a required)
Microsoft Windows Millennium Edition (Windows Me)
Microsoft Windows 2000 (SP2 Recommended)
Microsoft Windows XP Professional
Microsoft Windows XP Home Edition
Software Requirements:
Microsoft Internet Explorer 5.01 or later (install Internet Explorer 6.0)
|
|
|
|
|
Unfortunately VS.NET won't install on Win98
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
Is this just your experience, or is it wide spread?
Chris
|
|
|
|
|
Does anyone know the minimum requirements for GDI+? Can it run on windows 98? Does it require a minimum version of DirectX? Thanks
Chris Hafey
|
|
|
|
|
It does not require DirectX, although it can use it for creating some things, I dunno what the minimum version is to do that. It will work with Windows 98, but is not supported for W95. You might want to read my Starting with GDI+ article for more info.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
Code:
#include "dao.h"
void main()
{
COleVariant m_var;
LPCSTR m_str;
try
{
CDaoDatabase *base = new CDaoDatabase;
base->Open("c:\\biblio.mdb");
CDaoRecordset *rst = new CDaoRecordset(base);
rst->Open(dbOpenDynaset, "select * from authors");
for(int i=0; i<3; i++)
{
m_var = rst->GetFieldValue("Author");
m_str = (LPCSTR) m_var.bstrVal;
printf("%d, %s\n", i+1, m_str);
rst->MoveNext();
}
rst->Close();
base->Close();
}
catch(CDaoException e)
{
}
}
the header file includes stdio.h and afxdao.h.
Everthing is ok but after print out the first three records in the database, a dialog box appeared with the following message:
Debug Assertion Failed!
Program: C:\WINDOWS\DESKTOP\DATABASE\0041\DEBUG\DAO.EXE
File: daocore.cpp
Line: 39
What's wrong?
|
|
|
|
|
What does line 39 in daocore.cpp look like? Usually from that you can tell what the problem is.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I couldn't find the file 'daocore.cpp', somebody knows what or where it is?
|
|
|
|
|
MFC source
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Could someone gimme some direction on how to create a specialized menu for each view in a splitter window? I want the menu to be drawn inside each of the CViews inside the splitter wnd.
-JT
|
|
|
|
|
you mean like dropping down from the splitter bar at the top of each splitter view? hmmm ... would a right-click pop-up menu for each pane not be good enough? i know it would sure be a lot easier to code
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
|
|
|
|