|
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?"
|
|
|
|
|
The problem here is that menus are attached to frames. The views in a splitter windows share the same frame so I don't see how you can do this without an awful lot of work.
IDEAS)
1) I did something similar to what you need to do except that I used a dialog bar on one side that contained a tree view and I didn't allow the dialog bar to be undocked. The view on the right side was then a listview. This enabled me to define an CMDIChildWnd-derived frame window and attach a toolbar to it. That frame was then used in the creation of the view's doctemplate.
2) About 15 years ago, I wrote a similar thing in OS/2. This was long before the days of having classes to do the work for you. What I did was to create 3 MDI windows. The first two were my views. The third was a "splitter window". It was simply a window that was defined as being so narrow that only its borders were viewable. Therefore, it looked just like today's splitter. I then handled that window's WM_MOVE message and resized the other windows accordingly. The overall impression to the user was that of using a splitter to view different amounts of each window. This *might* do what you want as with each view you could create your own frame and attach a menu to it.
I know these aren't the answers you were looking for. However, sometimes if someone talks about similar problems/solutions, it can jog ideas of your own that will solve your particular problem.
Cheers,
Tom Archer
Author, Inside C#
Please note that the opinions expressed in this correspondence do not necessarily reflect the views of the author.
|
|
|
|