|
This is possible. One of the early editions of Petzold's Windows books - "Programming Windows 95" gives an example of the BitBlt() which does exactly this. This is done in raw Windows API. You can, of course, redo it in C# or your favorite language.
|
|
|
|
|
yes, i know BitBlt(), but how can i get the handle of the window that mouse over?how can i select, with mouse, a rectangle of the screen?
|
|
|
|
|
Member 2965471 wrote: but how can i get the handle of the window that mouse over?how can i select, with mouse, a rectangle of the screen?
This is relatively simple if you know anything about Win32 UI/graphics programming. Since you seem to want to skip that part, why not just search for examples?
Binging "win32 draw selection rectangle on desktop" finds many examples, including this...
Screen Capture (Simple Win32 Dialog Based)[^]
Mark Salsbery
Microsoft MVP - Visual C++
modified on Saturday, May 14, 2011 12:44 PM
|
|
|
|
|
Hi
Does anyone know how to get/use the red squiggly line used in Ms word for spelling mistakes
thanks
simon
|
|
|
|
|
This is not the proper forum for this question... this is "Forum: C / C++ / MFC"
|
|
|
|
|
How do you know the OP is not asking about how to implement spell check in CRichEditCtrl?
|
|
|
|
|
|
How does anyone know...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: How does anyone know... You really never do. That's why God made else .
|
|
|
|
|
you will have to draw it yourself, if you want such a thing.
|
|
|
|
|
As in link: http://msdn.microsoft.com/en-us/library/e5ewb1h3%28v=VS.80%29.aspx[^]
I defined
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
and call _CrtDumpMemoryLeaks() in 2 places:
place 1. from a menu Item.
in this case, I see leaking info as:
Detected memory leaks!
Dumping objects ->
{3443} normal block at 0x02EE9BF8, 373376 bytes long.
Data: < > C0 C0 C0 C0 C0 C0 00 00 00 00 00 00 00 00 00 00
afxtempl.h(330) : {3273} normal block at 0x01DCD530, 4 bytes long.
Data: <( > 28 10 07 02
strcore.cpp(118) : {3272} normal block at 0x01DCF2A0, 22 bytes long.
Data: < H a > 01 00 00 00 04 00 00 00 04 00 00 00 48 00 61 00
E:\Develops\MyProgram\MyUser.cpp(101) : {3258} client block at 0x01DCF890, subtype 0, 152 bytes long.
a CWnd object at $01DCF890, 152 bytes long
strcore.cpp(118) : {3256} normal block at 0x01DCE130, 22 bytes long.
Data: < N e > 01 00 00 00 04 00 00 00 04 00 00 00 4E 00 65 00
I think info above is not meaningful because app has not exited and many operator "new"s have not been deleted.
place 2. at exit point (MFC - destructor of CWinApp's subclass)
this time, I still see
Detected memory leaks!
Dumping objects ->
{3473} normal block at 0x01DA20C0, 28 bytes long.
Data: < !Ce > BC DF AF AB 21 43 65 87 83 00 00 00 00 00 00 00
{3443} normal block at 0x02EE9BF8, 373376 bytes long.
Data: < > C0 C0 C0 C0 C0 C0 00 00 00 00 00 00 00 00 00 00
But, this time, there is no any info about my program files, such as in case 1:
E:\Develops\MyProgram\MyUser.cpp(101) : {3258} client block at 0x01DCF890, subtype 0, 152 bytes long.
a CWnd object at $01DCF890, 152 bytes long
strcore.cpp(118) : {3256} normal block at 0x01DCE130, 22 bytes long.
Data: < N e > 01 00 00 00 04 00 00 00 04 00 00 00 4E 00 65 00
My Q is:
Does info in place 2 mean that my program has no memory leaks because there are no my files there?
Or how to find solution without my files related info?
|
|
|
|
|
includeh10 wrote: Does info in place 2 mean that my program has no memory leaks because there are no my files there?
No, it means that whatever section of the code is causing the leak, didn't provide the expanded information. Usually you have to set certain flags to get the expanded information. Look that up in MSDN.
includeh10 wrote: Or how to find solution without my files related info?
If you can't figure out how to activate the proper flags for the section of code doing this (to get expanded info), you can still find the leaking data by doing a bit of detective work. You can look for allocations of that size, look for for all allocations without matching deallocations (new/delete as well as malloc/dealloc), look at whether the content (labeled "Data:") provides any clue as to what it may be, and look at memory allocations within the program, usually heap is allocated in chunks and you get allocations in memory that are next to one another (don't know if that makes a lot of sense, but what I mean is if there are two allocations in calls next to one another, they are likely to have addresses in memory that are close to one another, so you can use this to narrow the location of the leak).
|
|
|
|
|
I use a global object of a class that wraps the memory state functions. Easier than trying to find a place in running code to call the functions.
Here's an example:
#ifdef _DEBUG
class _MemStateCheck
{
public:
CMemoryState oldMemState, newMemState, diffMemState;
_MemStateCheck();
~_MemStateCheck();
};
_MemStateCheck::_MemStateCheck()
{
oldMemState.Checkpoint();
}
_MemStateCheck::~_MemStateCheck()
{
newMemState.Checkpoint();
if( diffMemState.Difference( oldMemState, newMemState ) )
{
TRACE( "************************\n" );
TRACE( "Memory leaks Detected\n" );
TRACE( "************************\n" );
diffMemState.DumpStatistics();
diffMemState.DumpAllObjectsSince();
}
else
{
TRACE( "************************\n" );
TRACE( "No memory leaks Detected\n" );
TRACE( "************************\n" );
}
}
_MemStateCheck MemCheckObj;
#endif //#ifdef _DEBUG
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi
I am using
m_richEditCtrl.SetSel(s,e);
sel = m_richEditCtrl.GetSelText();
to get the text of a selected item in a RichEdit Control
I having problems detecting if the selected text contains a line break or carriage return
can anyone help
thanks
Simon
|
|
|
|
|
hi
please ignore this, i have worked it out noe
|
|
|
|
|
How can i make a GUI (screen capture mechanism) like that?
|
|
|
|
|
i want to built MenuBar on right click of list control item
Rajesh
|
|
|
|
|
You probably need to start with this[^].
The best things in life are not things.
|
|
|
|
|
Hi,
How to merge cells using msflexgrid vc++ application. Trying to merge two adjacent cells when they are having same value.
m_Grid.SetMergeCells(1) is not working. Any idea?
|
|
|
|
|
|
Thanks for your reply.
But the link explains the merging entire row values and i need to merge only the 2 adjacent cells not entire row.
Please advice.
|
|
|
|
|
i wanna create a project like MSPAINT using MFC..
is there a exsitting project ? where can i get the sourcecode of it?
|
|
|
|
|
You can Google it to find samples.
|
|
|
|
|