|
Is it possible to change colors of system brushes (COLOR_WINDOW,COLOR_3DFACE and so on) for current task only? SetSysColors() makes it for whole system.
|
|
|
|
|
i don't think you can do that. If you are coding a project and you want to isolate the colors that i would suggest you use a global function that does something like.
COLORREF MyGetSysColor( int nIndex )
{
COLORREF clr = 0;
switch( nIndex )
{
case COLOR_WINDOW:
clr = RGB( 255,0,255 );
break;
case COLOR_3DFACE:
clr = RGB( 239, 130, 0 );
break;
default:
clr = ::GetSysColor( nIndex );
break;
};
return clr;
}
Thats probably the best you're going to get away with, that is without changing the entire system's color scheme.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
I have a dialog based application and when I click a button a modeless dialog appears (Well, it just doesn't appear, I create it). The parent of the modeless dialog is the main dialog. Let's call this modeless dialog Child1. Then I create another modeless dialog Child2 and its parent is Child1. If I close Child2 and then Child1 and if I have other windows on the desktop (other applications running) the main dialog window looses focus and hides behind the other applications' windows. However, if I don't create Child2 and I close Child1 the main Dialog remains on top of the other windows. Yes I could try to use BringWindowToTop or set the z order, but I would like to understand this behaviour.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Toni78 wrote:
If I close Child2 and then Child1 and if I have other windows on the desktop (other applications running) the main dialog window looses focus and hides behind the other applications' windows.
Does this happen even if no other windows are open?
|
|
|
|
|
DavidCrow wrote:
Toni78 wrote:
If I close Child2 and then Child1 and if I have other windows on the desktop (other applications running) the main dialog window looses focus and hides behind the other applications' windows.
Does this happen even if no other windows are open?
Yes it does. I mean it just looses focus but it can't hide anywhere.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
This is a MFC Bug. Check out Nish article here on CP about that (look for Nishant S).
What happens is that the dialog looses modality, and therefor its "stay on top" feature.
~RaGE();
|
|
|
|
|
|
Thank you RaGE for your help. I looked at the article and it seems to talk about modal dialogs and mine are modeless but nevertheless I didn't really read it carefully so I will have to go back and read it for real this time. Anyways, it is a great help and I am sure that that if I use my brain more efficiently I will find the answer in the article.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I"m wondering if anyone knows how to make it so VC++ will read in a text document, then create a check box off of Keywords in that document.
Then when the check boxes are checked it will output another text document with the corralating data to that keyword.
any suggestions??
Thanks
James
|
|
|
|
|
You want the VC++ IDE to do this, or you want a program written in VC++ to do this? Big difference! If the former, I have no idea. If the latter, can you provide some more details (e.g., what design you currently have, what you've tried so far)?
|
|
|
|
|
David,
I'm trying to do this in just plain VC++, I"m currently using version 6.0,
only because this is all I've been supplied with so far. As for what I've
done already, I can honestly say nothing that has produced any successful
results. I'm basically just learning how to use VC++ right now. Any help
would be great. Thanks
James
|
|
|
|
|
You successfully danced around my questions! What exactly are you trying to accomplish?
|
|
|
|
|
Sorry about that. What I'm trying to accomplish is taking a text document, importing it into VC++ then based off of key words create check boxes that will pull data corralated with that word. For example, if I take the speed of a processor chip at 1.8volts and 2.0V, the the text it might say something like
Fmax @ 1.8V 800mhz
Fmax @ 2.0V 1000mhz
I want two check boxes to show up that say Fmax @1.8V and Fmax@ 2.0V, then if I click both of these boxes, I get a new text document that says 1.8v 800, 2.0v 1000.
|
|
|
|
|
Based on that description, you can create the checkboxes at design-time, and simply change their labels once the necessary data has been read from the file. To change a control's caption, use SetWindowText().
|
|
|
|
|
Create a CCheckListBox control and add the items as they appear in the text file. That way, you never need more space than the listbox initially occupies, no matter how many items you add to the list.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
Yes it is the correct place to ask this question. I'm sorry I am too busy to provide an answer though.
John
|
|
|
|
|
Why don't you start here:
http://www.codeproject.com/file/CDataFile.asp[^]
jhaga
CodeProject House, Paul Watson wrote:
...and the roar of John Simmons own personal Nascar in the garage. Meg flitting about taking photos.Chris having an heated arguement with Colin Davies and .S.Rod. over egian values. Nish manically typing *censur*. Duncan racing around after his pet *c.* Michael Martin and Bryce loudly yelling *c.* C.G. having a fit as Roger Wright loads up *c.* . Anna waving her *c.* and Deb scoffing chocolates in the corner.
...Good heavens!
|
|
|
|
|
Hi,
What should I do if I want to prevent my mainframe to become too small when I'm resizing so that it could not be smaller than 600x400 for exemple?
I tried it by catching WM_SIZE and WN_SIZING but I cannot use to make it work.
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
if(cx < 600) cx = 600;
if(cy < 400) cy = 400;
CMDIFrameWnd::OnSize(nType, cx, cy);
}
Any Ideas?
thanks
Everything's beautiful if you look at it long enough...
|
|
|
|
|
void CMainFrame::OnGetMinMaxInfo( MINMAXINFO FAR *lpMMI )
{
lpMMI->ptMaxSize.x = 640;
lpMMI->ptMaxSize.y = 480;
lpMMI->ptMinTrackSize.x = 640;
lpMMI->ptMinTrackSize.y = 480;
CFrameWnd::OnGetMinMaxInfo(lpMMI);
}
|
|
|
|
|
just call the base class before doing your adjustments...
(WM_GETMINMAXINFO is called to retrieve the limits)
void CMainFrame::OnGetMinMaxInfo( MINMAXINFO FAR *lpMMI )
{
CFrameWnd::OnGetMinMaxInfo(lpMMI);
lpMMI->ptMaxSize.x = 640;
lpMMI->ptMaxSize.y = 480;
lpMMI->ptMinTrackSize.x = 640;
lpMMI->ptMinTrackSize.y = 480;
}
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Calling the base class actually has no value in this case as it will just use the parameters originally passed with the (WM_GETMINMAXINFO) message and not the parameters you supply to the base-class function.
|
|
|
|
|
Yep, but if you move the sample code to a CMainFrame dereived from CMyFrameWndClass, which *does* something to the parameters, my one is better
I just think it's cleaner this way.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Hi,
is it guaranteed in an STL map that references to an pair<const key,="" value=""> remain valid even if new items are inserted, or other items are removed?
i.e.
tMyMap::iterator it = map.find( ... );
tMyMap::value_type & pPair = *it;
map.insert( ... );
map.erase( some other element );
Background:
I need a map<string, somestruct> for lookups, but also need to be able to iterate in the original insertion order. (deletes ar rare, they can be O(nn) and I wouldn't care).
I thought keeping the map around as usual, and having a separate list<tmyMap::value_type *> heeping references to the map items in original insertion order would give me fast lookup as desired.
TIA
Peter
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Take w/ grain of salt:
I am not 100% about this but i wouldn't think that your reference is going to hold all the time. Some % of the time it may be valid but others it wouldn't. I would have to look at the stl implementation but i am guessing that if you insert an element and the map object has to rehash to fit the element in the pair reference is going to be invalidated. However if the map does not have to be rehashed than there is a chance that the reference remains valid. When i have to do something like what you are doing i ususally use pointers to my structures so that you can do:
somestruct* p = map.find( .. ).second;
One issue you are going to have though as far as reading back map elements is that a map doesn't promise to maintain your insertion order whatsoever ( in most cases anyway. I don't think std::map does either, though it could be forced somehow by providing a sort function ).
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
From the SGI documentation on map http://www.sgi.com/tech/stl/Map.html
Map has the important property that inserting a new element into a map does not invalidate iterators that point to existing elements. Erasing an element from a map also does not invalidate any iterators, except, of course, for iterators that actually point to the element that is being erased.
Best regards,
John
|
|
|
|