|
Sorry, html formatting of CodeProject removed the interesting part of my former posting (the file name)
Do you include the <lm.h> file?
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
I have a map in which I want to remove certain elements. So I iterate through the map, starting with
KeyOptMap::iterator keyIt0 = keyOptMap.begin();
If the maps value satisfies a certain criterion, I want to erase that element from the map for which I'm using
for (; keyIt0 != keyOptMap.end() ; ++keyIt0)
{
if (nPopOffKeyFlag) keyOptMap.erase((*keyIt0).first);
}
Getting a crash. is it legal to erase like this? I might be erasing the very first key where the iterator started.....
Any sugggestions?
Thanks,
ns
|
|
|
|
|
You're invalidating the iterator when erasing the element it points to. This can be worked around like this:
for (;keyIt0 != keyOptMap.end();)
{
if (nPopOffKeyFlag) keyIt0=keyOptMap.erase(keyIt0);
else ++keyIt0;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Precisely what I realised when I stepped along! Thanks so much for pointing it out too. I feel pretty goofy for that slipup!!!
ns
|
|
|
|
|
I'm implementing a group object selection tool much like the Power Point and Word's drawing tools where you can draw a box around items you want to select and it will select them all. Anyway, I'm using the DrawDragRect function and when I draw a selection box that I drag towards the bottom right of the screen from my starting point, it works fine. When I drag towards the top left of the screen from my start point though, the inside of the rectangle is drawn in a grey kind of shadowy color. I want it to be transparent like when drawing from top-left to bottom-right. Anybody have any experience with this?
|
|
|
|
|
help! I have been trying to populate a cRIchEdit control with a smal paragraph in vain for the last two days. I used an article from CP.
http://www.codeproject.com/richedit/richeg.asp but have had no luck! Any input would be greatly appreciated> I've already wasted a day and a half on this....and am no nearer to seeing my editbox being filled....
thanks,
ns
|
|
|
|
|
Would a simple static text control work for you? That's the easiest way to just display a bunch of text. You can select the "Sunken" look if you want the text to appear as if it's in an edit control. And you can just use "\n" to delimit paragraphs.
If you want the user to be able to channge the text, you'd of course need to use an edit control. A straight CEdit should do the job.
It seems you're having problems - post the offending code snippet (not an entire method, please) and we'll see what's wrong with it. Remember to surround your code with <pre> and </pre> .
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
DArn! The label idea wont work. Too bad. The code I used for the richedit doesnt crash but doesnt populate the box and I dont know why. Its got callbacks and stuff. I'll post it if you'd like to take a look at it.
|
|
|
|
|
A static text control works fine for me. I'm emailing you a sample project @ work/home.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
WoW! I'm going to try it right now. A million thanks!
|
|
|
|
|
I feel sheepish. I got so carried away with callback functions and streamIn etc, and all I needed was SetWindowText() ...
|
|
|
|
|
i'm using GetWindowDC(NULL) to retrieve the device context for the entire screen,
is there any way to retrieve the device context for the entire screen without my dialog in it ?
thanx
|
|
|
|
|
if your doing it from within your app use the ShowWindow() first to hide it ... then do the grabscreen thing ... then reshow ur app
if ur doing it manually of course just minimize ur app before u grab the screen
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Thanx,but my app must be visible all the time..
any other ideas??
|
|
|
|
|
I don't think there is an actually a way to do that. Once your app is drawn to the screen your app will be in that DC. Other than what Lauren suggested is what I would of done but I don't know exactly what you want. If you find a way I like to know how you did it.
|
|
|
|
|
if your app must be visible at all times how can u grab the screen without it? sounds a bit impossible to me philisophically speaking ... however ...
all i can think of is then that you grab the screen then get ur apps window co-ordinates and fill the screen area in with a best guess of what it contains (wallpaper, color, etc)
otherwise im at a loss
sorry
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Thanx ,i will try to find another way to do it
|
|
|
|
|
Exactly what are you trying to do?
...just curious.
/M
- Don't sweat the petty things, and don't pet the sweaty things.
|
|
|
|
|
How to change font in CRichEditCtrl, please help me
thanks
|
|
|
|
|
I've never used CRichEditCtrl, but have you tried SetFont (inherited from CWnd)?
"Human imagination has been sculpted by the universe within which it was born" Hmmmm...
|
|
|
|
|
Hi All !
One problem pursues me for a few years already:
all my Win32 apps, written in VC++ (5.0-6.0),
crash on the second run under debugger.
Toolbar code in comctl32.dll causes access violation.
In more details:
1)The crap arises only when the app
is run 2 times successively from the VC++ IDE.
When running my app standalone, all's ok.
2)The program crashes when a mouse is moved
over the toolbar. WM_MOUSEMOVE is finally
dispatched to DefWindowProc() in comctl32.dll,
and there fails.
The mouse coordinates seem to be correct.
3)If toolbar is hidden, it's allright.
4)This bug seems to be not accidental
concatenation of circumstances:
this happened on different Windows versions,
under both VC5 and VC6, after many reinstallations
of the VC++ and OS etc,
and, finally, with all my Win32 GUI apps -
independently of tyhe architecture of the app,
and of the way I use tollbars
(containing ReBar, different styles, etc.)
5) The bug arises and disappears from time to time,
during the course of program development.
It seems that it depends somehow
on the size of the .exe or something like that.
Anyone ever faced this problem ?
Any help or hint would be appreciated !
Thanks in advance !
|
|
|
|
|
Solution is not into diferent systems or VC++. Try to find bug into your project. I had never this or similar problem and it is imposible to tell you something else.
|
|
|
|
|
I'm trying to create a dialog window, that becomes opaque when a mouse hovers over it and when
the mouse leaves the window, it should become transparent again.
My problem here is that when a mouse is over a control in the dialog window, it doesn't work the
way I want - the dialog does not recognize that the mouse is hovering over it.
What should I do?
And my second question is: Do you have any how to do the same UI as in Real Player One. I mean:
when a mouse is moved over the display window three zoom buttons appear. I actually would like
to do it a little bit more different: when I move the mouse over the upper-left corner of the
client area of a window the buttons should appear.
I'm doing Win32 programming in my spare time for a few months now and I'm nothing but a beginner
yet. Sorry if my questions are too stupid.
Regards,
Z.
|
|
|
|
|
check out the SetCapture() and ReleaseCapture() stuff
the second point i would solve by putting a static control on the dialog box and make it invisible but use it to capture the mouse and do your button / control thing there
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
Anonymous wrote:
I'm trying to create a dialog window, that becomes opaque when a mouse hovers over it and when
the mouse leaves the window, it should become transparent again.
My problem here is that when a mouse is over a control in the dialog window, it doesn't work the
way I want - the dialog does not recognize that the mouse is hovering over it.
What should I do?
You should check for the mouse hover in the controls also. Derive a class fromm your controls and override the mouse events you need to.
Anonymous wrote:
I actually would like
to do it a little bit more different: when I move the mouse over the upper-left corner of the
client area of a window the buttons should appear.
Define a rectangle with in your view in the upper-left corner of the client area and use that rectangle to test if the mouse is over it and act accordingly. Off the top of my head I can't remember the mouse event, on mouse move? Use the point you get to see if that point is in your rectangle and if so, draw your controls.
|
|
|
|