|
that might be true..
i only metion that becaseu i find that doing something like this:
CDC memDC;
memDC.CreateCompatibleDC(pRealDC);
CBitmap memBMP;
memBMP.CreateCompatibleBitmap(memDC, ...);
will often fail (i get a monochrome bitmap or something equally perverse). To make it work I have to use pRealDC in the CreateCompatibleBitmap call. using the 'compatible' DC screws things up.
so, as a rule, i always use a real DC (from GetDC(NULL), or a paint DC or a CClientDC) in these functions.
just a thought.
also, when i copy DIBs to the clipboard, i do it like this:
HGLOBAL CISImage::MakeClipboardDIB()
{
HGLOBAL hDIB = MakeDIB();
HGLOBAL hCBDIB = NULL;
if (hDIB)
{
DWORD dwSize = GlobalSize(hDIB);
hCBDIB = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, dwSize);
if (hCBDIB)
{
BYTE *pCBDIB = (BYTE *)GlobalLock(hCBDIB);
memcpy(pCBDIB, (BYTE *)hDIB, dwSize);
GlobalUnlock(hCBDIB);
}
GlobalFree(hDIB);
}
return hCBDIB;
}
...
if (OpenClipboard(AfxGetMainWnd()->m_hWnd))
{
CISImage img;
...put something in img...etc.
HGLOBAL hDib = img.MakeClipboardDIB();
HANDLE res = SetClipboardData(CF_DIB, hDib);
ASSERT(res);
CloseClipboard();
}
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I can't find any reference to MakeDIB except for a MSDN sample app, and it requires parameters.
|
|
|
|
|
yeah. that's my own function. it just creates a typical BITMAPINFOHEADER and image data DIB. i'm assuming you already have a DIB floating around somewhere.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Wel, I have a populated BITMAPINFOHEADER and a shitload of captured bytes...
I've been trying to make a DIB that can be stored to the clipboard. Trouble is, I don't know what I've done right, and what I've done wrong.
Why does something like this have to be so hard in a *graphical* operating system?
|
|
|
|
|
sounds like you've got a DIB. have you tried displaying it (with something like StretchDIBits), just to be sure?
BITMAPINFO *pBMInfo = (LPBITMAPINFO)pDIB ;
LPVOID lpDIBBits = (LPVOID)(pDIB + pBMInfo->bmiHeader.biSize);
UINT32 lines = StretchDIBits(outHDC,
xPos, yPos,
outWidth, outHeight,
0,0,
inWidth,
inHeight,
lpDIBBits,
pBMInfo,
DIB_RGB_COLORS,
SRCCOPY);
that's the easiest way to tell if your DIB is correct/well-formed.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Yup, when I do a StrechDIBits, lines is equal to bmiHeader.biHeight.
|
|
|
|
|
hmmm.. have you tried the clipboard code i posted above?
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
not yet - in the process tho...
|
|
|
|
|
You can't just pass a dib handle to SetClipboardData - that would be too easy. You have to copy the contents into a global memory block and pass the handle of this memory block to SetClipboardData. DIBLOOK sample may be helpful; have a look at CopyHandle helper.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I've already tried the CopyHandle() method, and I get the same results.
|
|
|
|
|
|
Hi,
I have an MCI application that reads/catalogs audio CD's using the CDDB Interface.
There are two things I would like to get it to do that it currently does not;
1) Recognise that a CD has been loaded into the drive, so that I do not need to have a menu item to add a new CD.
2) Eject the drive after the information has been cataloged.
I know that for 2) there are a couple of KB Articles, Q165721 and Q168180, but I would like a simpler, more universal method, if possible.
Many Thanks in advance for any info.
Bryan Anslow.
|
|
|
|
|
Ejecting with MCI is easy. Assuming that you know the drive letter, send the following strings:
"open f: type cdaudio alias cdx0"
"set cdx0 door open"
cdx0 is just a sample alias. Any identifier should work.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks Tomasz,
I use mciSendCommand() everywhere in this prog, so I found this worked;
mciSendCommand(_mciDevice, // Eject the CD
MCI_SET,
MCI_SET_DOOR_OPEN,
(DWORD)(LPVOID)&mciSet);
also, for finding out when a CD is inserted, I just added a line to my mainframe module (it's an MFC App)like;
ON_WM_DEVICECHANGE()
and the OnDeviceChange() function can find which device etc., by examining the passed parm,
Bryan.
|
|
|
|
|
I cannot find any useful functions from neither the MSDN nor the MFC source code. What can I do now? Please help me!
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
Have a look on this site PJ Naughter has written a class that does the job!
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
I'm sorry to waste your time. But I don't know which article you refered to. Did you mean the FTPTransferDlg class?
Looking forward to your reply. Thank you.
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
Can anyone tell me how to delete a file to the recycle bin programatically.
I can use CFile.Delete(), but this appears to delete the file completely, but what I would like to do is move the file into the recycle bin.
Thanks in advance for your help
|
|
|
|
|
|
|
Thanks, That's just what I needed
|
|
|
|
|
Hi @ all
I hope that somebody can tell me how I can create a makefile from the command-line (not from VC++ with project/export_makefile) from .dsp or .dsw files.
Thanks a lot
|
|
|
|
|
Why don't use the VC++'s project/export_makefile? It's very convinent.
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
Is it possible or isn't it possible? I found a perl-script programm on the internet that can convert a .dsp-file to a makefile, but I don't wanna start learning perl now just because of this one 'problem' (I'm getting strange error messages while compiling this script...).
So I just wanna get a makefile without always being forced to open VC++.
I wanna use this command in another makefile (with recursive use of make) to make sure to be always up to date with the dependencies.
|
|
|
|
|
Hi,
I am wondering if it's possible for my MDI Child window to have only max in min buttons, with no "X" for close?
Is the only was to achieve this with WM_NCPAINT?
Thanks
|
|
|
|