|
There is a white strip with a formatted date in a date/time picker. How can I change the background color of that white strip? I tried just about everything I know.
Any response any one can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
Look into SetTextBkColor. I do not know what control you are using or if you built one. But the SetTextBkColor function should be able to help you. It sets the background colour for the text within a control which is different from the background colour of the control it self. Setting the colour to be equal to that of your control will make your text look better. Hope this helps.
|
|
|
|
|
I need to get the exact time in ms. Anyone know how?
Cheers,
Ali
|
|
|
|
|
If you don't mind using 100-ns intervals since 12:00 AM, January 1st, 1601, then GetSystemTimeAsFileTime is the way to go.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
I'm trying to create a custom control which contains a few input fields.
I've read Chris Maunders tutorial courses about 'the art of subclassing' and 'create your own custom control' which are btw great, but still I can't seem to find out where to begin.
Basically I want to create a small control with 2 input fields, some text and a button or 2. Let's say a login control containing username, password and a connect button.
There are a lot of good articles about subclassing for instance a CEdit field, but I can't find one that handles my question.
Does anybody know if it is possible to create this control starting from a dialog? Or should I just sublass a CWnd and add the Edit/static fiels and button myself. How to do this?
I really can't figure out how to start, so it should be great if anyone can point me out how to start.
Thanks in advance
Wim
|
|
|
|
|
You'll need a child dialog. Derive your class from CDialog, create a dialog template with 'child' style set, add controls on the dialog surface and add event handlers. At runtime, you'll need easy method for placing child dialog on the parent. I'm usually using 'dummy' static control which provides the initial position and size and it's replaced with child dialog.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Thanks a lot. That did the trick!
|
|
|
|
|
Hi.
I am trying to create a wizard-style property sheet.
I want to add header & watermark images to it.
The header gets displayed, but the watermark does not appear.
Here is the piece of code.
HBITMAP hbm1, hbm2;
hbm1 = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BMP1));
hbm2 = LoadBitmap(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BMP2));
m_ps.Construct("Options", NULL, 0, hbm1, NULL, hbm2);
m_ps.m_psh.dwFlags |= (PSH_WIZARD97 | PSH_WATERMARK
| PSH_USEHBMWATERMARK | PSH_STRETCHWATERMARK
| PSH_WIZARDCONTEXTHELP | PSH_HASHELP
| PSH_HEADER | PSH_USEHBMHEADER);
I tried various combinations of the flags, but the watermark image is not getting displayed.
Does this require some change to the property pages?
ALso, I am unable to add header title/subtitle.
I use VC++ 6.0
Can somebody guide me?
Thanks.
Logic is a systematic method of coming to the wrong conclusion with
confidence.
|
|
|
|
|
This is a complete mystery to me - ive opened an access database, and its only recognised 1 row:
{
CSoundFile* pSoundFile = new CSoundFile();
pSoundFile->Open();
CString tmp;
tmp.Format("%d - %d ", pSoundFile->GetODBCFieldCount(), pSoundFile->GetRecordCount());
tmp += pSoundFile->GetTableName();
AfxMessageBox(tmp);
}
The messagebox outputs "2 - 1 [soundfilelookup]". However there are loadsa records in the database. Does anyone know what the problem is??
|
|
|
|
|
If my memory serves me correct...
The recordcount may not be accurate until EOF is seen (i.e. you have iterated through all records).
|
|
|
|
|
Cheers mate, i'll give it a try
|
|
|
|
|
Exact ! but i think you have just to move to the last record.
|
|
|
|
|
I've a ReBar in my SDI-Application and an Extended Combo Box in it. With the help of Class Wizard I select an existing class (CMainFrame) to be associated with the IDR_MAINFRAME resource of the rebar. In CMainFrame I create a OnSelChangeComboboxex1() function.
It looks like this:
CComboBoxEx *pCombo = (CComboBoxEx *)GetDlgItem(IDC_COMBOBOXEX1);<br />
int nSel = pCombo->GetCurSel();
etc.
But the program fails because of some unhandled exception. I really don't know what the problem can be. Someone, please, help!
|
|
|
|
|
If this is really urgent, why can't you provide more information on 'some unhandled exception'?
Is your combo a child of mainframe, or rather it's located on rebar?
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Even though CMainFrame may be getting messages sent by it, the combobox is not actually a direct child. So GetDlgItem() is returning NULL , hence your crash. You'll need to obtain a handle to the ReBar window (this should already be a member of CMainFrame ) and use that to obtain the combobox handle.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Thanks, I've got your idea. But how exactly should I obtain a handle to the ReBar window? (sorry, I'm just a beginner)
|
|
|
|
|
It should be a member of your CMainFrame class. Probably it's called m_wndReBar . Note that the ReBar control itself only contains other windows, so it could contain the combo box itself, or the combo box could be on a dialog bar contained by the ReBar; i'm not sure how you set this up, so i can't say for sure. If you *are* using a dialog bar, there'll be another member of CMainFrame for that. Poke around a bit, it should all be clear.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Oh yeah, thanks, that helped, it turned out to be m_wndDlgBar
|
|
|
|
|
|
Hello:
I need help with Combo boxes. I have a combo box in a dialog and I want to fill the combo box with some filenames of a specified directory. Then, after filling the combo box, I'm disabling it (it can be enable by a check box in the same dialog). The program complies and runs, and when I load the dialog with the combo box, when I click the check box to enable the combo box, there is nothing in it. This is the code snipet that I have in the ::OnInitDialog() event:
::SetCurrentDirectory(_T("C:\\sounds"));
m_cbo.ResetContent();
m_cbo.Dir(DDL_DIRECTORY,_T("*.wav"));
m_cbo.EnableWindow(FALSE);
Is there something that I'm missing inthe combo box? What can I do to solve this? Any answer is more than welcome.
Best regards,
Luis E. Cuadrado
)
|
|
|
|
|
Change DDL_DIRECTORY to DDL_READWRITE.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
I've just looked at the sample code in the MSDN documentation, and it looks like you might need the DDL_READWRITE flag as well as the DDL_DIRECTORY flag:
m_cbo.Dir(DDL_READWRITE | DDL_DIRECTORY, _T("*.wav")); I could be wrong though, I've never used CComboBox::Dir .
If it still doesn't work, it might be worth checking the return value of the Dir function - it should be a positive value if everything's worked okay. If it returns zero, that means no files were added. A negative value indicates an error.
"We are the knights who say Ni" (The Knights Who Say Ni)
|
|
|
|
|
Hello again:
I edit the code. I tried using DDL_READWRITE | DDL_DIRECTORY and using just DDL_DIRECTORY and I wasn't able to see any files in the combo box. I click the little arrow of the combo box and nothing comes down. I wonder if is something related with the combo box. Any property that I have to change or something. What do yo guys think?
Thanks for the replies,
Luis E.
Luis E. Cuadrado
)
|
|
|
|
|
Your combo may have very small dropdown area. In the resource editor, click on the combo box arrow, then resize the dropdown rectangle.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
My understanding of CWnd::FromHandlePermanent is this :-
If there is an existing CWnd within the current application's heap/stack that currently holds the window with the passed window handle, then CWnd::FromHandlePermanent will return that CWnd*.
But unfortunately that's not happening. It does return a permanent CWnd but it's not matching the original CWnd
So is my understanding flawed or is this some kinda funny side effect of something else in my code?
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|