|
Hi,
Usually the color of the dialog box by default is grey, how do i change the color. How can i make the dialog box change its color as soon as i clickon a button.
Thanks and regards
Deepak Samuel
|
|
|
|
|
Hi,
there are several ways to change the dialog bk color:
1) use SetDialogBKColor() method in the InitInstance()
2) use OnColorCtl() Message handler
3) draw a rectangle that will cover the entire dialog
i prefer to use the second method
here is an example code on how to use it:
in the *.h file write down:
protected:<br />
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
in the *.cpp file write an entry in the message map:
BEGIN_MESSAGE_MAP(CYourDlg, CDialog)<br />
ON_WM_CTLCOLOR()<br />
END_MESSAGE_MAP()
implenent the OnColorCtl , write down:
HBRUSH CGUIBaseDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
if (CTLCOLOR_DLG == nCtlColor)<br />
hbr = m_brushDlgBk;<br />
<br />
<br />
return hbr;<br />
}
notice the use of brushDlgBk.
in the *.h file define the brush:
CBrush m_brushDlgBk;
in the *.cpp file in the constructor of the dialog
create the brush:
m_brushDlgBk.CreateSolidBrush(RGB(200,200,200))// the color you chose place here
that should do the trick....
to switch the colors on a click just use 2 brushes and return the proper one in the OnCtlColor method according to a flag indicating the click
hope i helped ya
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi,
Could someone please give me some tips - or even better, link ot some examples - on how to create an EditStreamCallback function? I have searched the net and several coding forums, but can't find any solid information, even MSDN.
I have a Rich Edit text box, and whilst I can currently save to a .txt file using GetDlgItemText() and WriteFile(), this method is very limited and I really want to save as an RTF file. I have read the info on EM_STREAMOUT and EditStreamCallback, and it seems that these are the functions I need to use in order to save as an RTF file.
If anyone can tell me how to write a callback function that will write an .rtf file, link to some more comprehensive info, or just give me some general tips, I would be really grateful.
Incidentally, I am using the straight Win API SDK with _no_ MFC.
Many thanks!
KB
|
|
|
|
|
Hi,
I have a MFC applivcation which has around 5 dialog boxes. I also have another real time application . I want to make one of the dialog boxes to pop up as soon as receives a event from this real time process. How do I proceed ?
Thanks and regards,
Deepak Samuel
|
|
|
|
|
Hi i just tested my program on windows xp and its got the old style buttons how do i change them to xp style buttons? im using msvc 6.0
|
|
|
|
|
|
Hi!
In some class, the adress of "this" change from method to other method of the same class.
For example,
void X::doNothing()
{
doNothing2(); // adress of "this" = 0x053014e4
}
void X::doNothing2()
{
// adress of "this" = 0x053014f0
}
This happen only in some class of my project.
The "this" adress is essential for me because I use it to do object research by comparing adress.
Do someone have an idea why in some class this will happen and other not?
|
|
|
|
|
Multiple base clases with virtual methods?
Poor pointer casting? (don't use (X *), use static_cast <x *=""> ())
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi!
I don`t use poor pointer casting. In fact, I often use dynamic_cast on object having multiple base class (and the basic base class is inherited virtually).
Can it cause a problem?
I`m stocking "this" adress in a vector to do futur search base on adress difference.
Thanks
Chris
|
|
|
|
|
Perhaps an implicit copy is being made somewhere? You can try explicitly specifying the copy constructor and setting a breakpoint inside it.
- Mike
|
|
|
|
|
Hi all,
I am deriving a class from CWnd , I just want to display images from a CListImage . What I really need is to display images like Emoticon Window in messenger like applications.
I saw an article in C# which creates an emoticon window, I tried myself but were unable to do in VC++/MFC
Please anybody help me to create a window like the one I need.
Thanks.
The Phantom
|
|
|
|
|
PLEASE DISREGARD THIS POST - I WAS ONLY JOKING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
Hmm
Whois Server Version 1.3
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http:
for detailed information.
No match for "PROGRAMMINGHOMEWORK.COM".
It might just work. A mate of mine from university set up www.cheathouse.com[^]. Makes a packet out of it too.
Ryan
"Everybody has a right to be stupid, but
some people abuse the privilege."
Uncle Joe Stalin
|
|
|
|
|
I was just kidding. Maybe someone would be willing to put something together to make some $$$.
|
|
|
|
|
Ok, I'll take you up on it. I've *very* new at this and assume the question is trivial, but can't seem to figure out how to get the documentation to tell me what I want to know.
I need to read a string and, if it's a number, convert it to double. How do I tell whether the string (input via the Console::ReadLine() method) contains only numeric characters (and can therefor be correctly converted to double via the Convert::ToDouble() method) or not?
If this turns out not to be trivial, just let me know and I'll think of something else. Maybe get a stream of chars or something (yuck!)
|
|
|
|
|
Your question sounds like a sincere request for advice - and I would gladly answer it if I could - but I am only familiar with MFC and C++ - I think your question is either .NET, JAVA or C# (I have no idea).
|
|
|
|
|
Terry O`Nolley wrote:
but I am only familiar with MFC and C++ - I think your question is either .NET, JAVA or C# (I have no idea).
No...it's C++ with managed extensions
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
Even though this isn't C/C++ like Terry said, you can still use this same method that I'd use.
Write a function that checks each character to see if it is a number or not. Return true if its a number and false if not. If it reaches the end of the string without returning false, then it converts it double, else it fails.
Two ways I can think of to do this. One is just check the char is equal to any number 0-9 (this probably isn't the most effective way) or convert to ascii and check if it is within the ascii range for a number.
Mike
|
|
|
|
|
You could look at the System::Text::RegularExpressions namespace and create a regular expression that would match the characters 0-9...then check to see if the thing is a match. You could also use the Microsoft::VisualBasic namespace and the IsNumeric() function.
Also, I think the Convert::ToDouble() throws an exception if the input string is not in a proper format. (Actually I know so, I just did this the other day in C#). You could wrap the call to ToDouble() in a try catch block and handle the error whichever way you want.
Hope that helps...
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
If you wish to buy some advertising then please contact marketing@codeproject.com. Advertising in this way is, unfortunately, unacceptable.
cheers,
Chris Maunder
|
|
|
|
|
Code-Project would accept sponsors whose product was selling homework completion for students?!?!?!?!?
I guess so, or you wouldn't have referred my joke to your ad dept - or was that in itself a joke??!??!
I am so confused!
Anyways, I was just joking.
Have a cheerful day!
|
|
|
|
|
What fun!!!
|
|
|
|
|
Is there a way to detect if a UNC path is actually a folder on the local machine that is being shared?
|
|
|
|
|
The function WNetGetUniversalName may be of help.
--
Joel Lucsy
|
|
|
|
|
Hello,
I have this code
COleVariant vtOpenMethod((short)1);
LPDISPATCH pDisp;
pDisp = CRApplication.OpenReport((_bstr_t)"Grafic de ocupare pe zile.rpt", vtOpenMethod);
CRReport.AttachDispatch(pDisp);
ICRParameterFieldDefinitions apParam= CRReport.GetParameterFields();
long lCount = apParam.GetCount();
for(int i = 1; i <= lCount; i++)
{
COleVariant vtIndex ((long)i, VT_I4);
COleVariant vtReport("");
_variant_t vCurVal;
vCurVal = COleVariant(_T(m_data));
ICRParameterFieldDefinition yy = apParam.GetItem(vtIndex,vtReport);
....
}
What I want to do is to pass to my report 2-3 parameters.
If i use
yy.SetCurrentValue(vCurVal);
I get this error :
Unable to write read-only property.
Please can somebody tell me how to pass these parameters?
Thanks!
|
|
|
|