|
How would you compare the contents of one CDC with the the contents of a selected area in another CDC? I'm looking for the fastest way to do this.
Thanks!
Nathan
|
|
|
|
|
The fastest way to do it is to use a DIBSECTION instead of a CBitmap, so that you can access the bits directly. Otherwise you're in GetPixel/SetPixel hell - read VERY slow.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I can't seem to get my code to work. It should display pRightDC as all black shouldn't it?, instead it draws what i've already placed in pRightDC.
CDC* pRightDC = pBitmap->GetCurrentBitmap();
CSize s = pBitmap->GetBitmapDimension();
int nSize = pRect.Width() * pRect.Height();
CBitmap *pBitmap = pRightDC->GetCurrentBitmap();
char* hBytes = new char[nSize];
memset(hBytes, 0, nSize);
pBitmap->SetBitmapBits(nSize, hBytes);
(CDC *pDraw = handle to desktop area)
pDraw->BitBlt(10, 10, 5, pRect.Height(), pRightDC, 0, 0, SRCCOPY);
Nathan
|
|
|
|
|
According to MSDN GetCurrentBitmap can return a temporary object, which I presume means a copy.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi,
How can I get the disabled buttons of a 256-color toolbar to look good?
Thanks in advance,
Erik Hammar
|
|
|
|
|
I banged them into a paint program, made them greyscale, then turned the contrast down and messed with the curves.
--
Andrew.
|
|
|
|
|
Use Hot and Cold bitmaps
See sample here
http://www.codeproject.com/docking/toolbar_hotbuttons.asp
|
|
|
|
|
Hi all (again), I`m stuck (again). I just can`t figure out how to copy a HBITMAP to a completely new HBITMAP (i.e. I don`t want them handling the same image, rather I want a new image which contains the same colours). Anyone know? I`ve tried copying the handle but that doesn`t do what I want it to do (rather obviously) since when I try modifying the new image the old one gets modified too, this is what i *don't* want. I have heard something about memcopy, but haven`t got a clue how I`d use it in conjunction with the HBITMAP and "the bits" of the DIBSection. Any help, or links or ideas or anything = very many thanks.
Cheers guys (and gals)
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
You need to create the second HBITMAP to be the same size, copy them both into DC's and then do a BitBlt between them. If they are both DIBSections, I'd presume you can create the second one the same size as the first and memcpy the bits from one to the other.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Thanks for the response Christian, I would love to be able to memcpy the bits from the one HBITMAP to the other (they will both be DIBSections and they will both be the same size). But how does it work, do I have to create a new HBITMAP first using CreateDIBSection and then use memcpy? If this is correct, how do I use memcpy in that situation, without creating a memory leak from losing the pointers to the original "bits". I would very much like it if you could elaborate a little bit on this direction of solution,
Many thanks, again
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
memcpy copies the contents of the memory, so what happens is this:
1/ You create a new DIBSECTION the same size and bit depth as the first.
2/ You now have two DIBSECTIONs and two pointers to byte arrays, which are the same size. You use memcpy, which copies the contents of one byte array into the other. You're not allocating memory, you're copying the values of the pixels into the location that already holds the values of the bitmap as it was created, making them identical to the first.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Many thanks Christian, I`m off to implement your suggestion, I`ll get back to you and amend this message with the results.
Thanking you lots,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
No worries - glad to help.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I'm trying to figure out how to receive/send data of different types (including standard types AND my own objects) not using MFC CSocket-CSocketFile-CArchive trio. I've got the socket part already, now I want to use << >>
to actually start transferring data. I'm new to STL but have a feeling
that's the way to go. Right? How? Or no?
|
|
|
|
|
I don't quite catch your point, but if what you're looking for is iostream-like classes for data communication thru sockets, then please note that the C++ standard does not cover this issue. Nevertheless, iostream was designed with such kind of extensions in mind, and there are a number of libraries out there to do socket communications à la iostream. To name a few:
- Socket++ is probably the most popular library in this area. Originally written by Gnanasekaran Swaminathan for UNIX environments, it's been later ported to Win32 by Greg Lavender.
- Maciej Sobczak releases an iostream-compatible socket wrapper along with his article on the current (December 2001) C/C++ Users Journal issue, which in addition features other articles about C++ and sockets you might find interesting to look at.
- socketstream library, written by a Korean guy whose name I haven't been able to decipher Haven't tested myself, nor do I have any reference about it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi, everybody
I'm using CArchive constructed on CSocketFile and i'm
trying to serialize CMsg objects like this :
(note : ar is my archive and msg my message to serialize)
ar.WriteClass(msg.GetRuntimeClass()); //it works fine
ar.WriteObject(&msg); //works fine
and at the other side of the network i have :
CRuntimeClass * pClass = ar.ReadClass(); //this throw me an error CArchiveExceptionError::badIndex
Any ideas about this ?
|
|
|
|
|
hai all,
i am a new person who is working in vc++ fro 2 month
i am facing some problem in starting the dialog box in windows machine. whila compilng it's giving this messages is any thing missing.
Loaded 'D:\etnnew\ethnew\Release\ethnew.exe', no matching symbolic information found.
Loaded 'C:\WINNT\System32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\MtoMLAN.dll', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\KERNEL32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\USER32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\GDI32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\ADVAPI32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\RPCRT4.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\WINSPOOL.DRV', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\COMCTL32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\WSOCK32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\WS2_32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\WS2HELP.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\mfc42.dll', no matching symbolic information found.
LDR: Automatic DLL Relocation in ethnew.exe
LDR: Dll qaphooks.dll base 10000000 relocated due to collision with C:\WINNT\System32\MTOMLAN.dll
Loaded 'C:\WINNT\SYSTEM32\qaphooks.dll', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\RNR20.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\RPCLTC1.DLL', no matching symbolic information found.
First-chance exception in ethnew.exe (NTDLL.DLL): 0xC0000005: Access Violation.
Loaded 'C:\MOUSE\SYSTEM\ccmsghk.dll', no matching symbolic information found.
Loaded 'C:\WINNT\SYSTEM32\msidle.dll', no matching symbolic information found.
The thread 0x201 has exited with code 120 (0x78).
The program 'D:\etnnew\ethnew\Release\ethnew.exe' has exited with code 120 (0x78).
Suleman
|
|
|
|
|
Are you sure it is compiling. It looks more like it is debugging and can't find debug info.
-Matt Newman
-Matt Newman
|
|
|
|
|
How do you mean W95 only ? The system dll's being loaded are under c:\WinNT, and 'no mayching symbolic information found' is not unusual or broken.
You need to post some code. What are the details of your project ? How was it created ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I have a class that implements the thread operation(not
inherited from MFC)-"MyCDialogThread" - that open a CDialog on it's run method with either DoModal or create.
I create that threat from another thread and i need to kill
my "MyCDialogThread". How can that be done?
|
|
|
|
|
Can you send a WM_CLOSE message to that CDialog ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
No. in my case - i open the dialog with DoModal and that thread donot response to any sendmessage.
The other thread that should send the SendMessage to my thread could not be proccessed until my thread(that own the CDialog)could execute, but it couldn't because my thread is blocked until it will be finished.
I read about it in Josheph M.Newcomer article "Using Worker Threads" here in the Code Project.
|
|
|
|
|
Try with TerminateThread
best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Can you use a UI thread instead of a worker thread for the owner of the CDialog (and proceed then with sending WM_CLOSE )?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi, All!
=======
What is IDISPATCH ?
What should I do with it?
How to use it?
10x
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|