|
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]
|
|
|
|
|
Nishant S wrote:
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*.
FromHandlePermanent doesn't walk the stack or heap. It just checks the permanent map; permanent map gets new entries when you create objects derived from CWnd. It doesn't get updated when you call methods returning temporary CWnd's (like CWnd::FindWindow).
Nishant S wrote:
It does return a permanent CWnd but it's not matching the original CWnd
Can you check the 'original CWnd' in QuickWatch window? Is it CTempWnd object?
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
Hi Nish,
Note that if you are using different threads then you won't see the CWnd* which is in one threads map in the other. Could this be the problem?
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
I am trying to get into custom controls and one problem is getting into owner draw buttons (derived from CButton).
Can anyone suggest a good tutorial on this as most stuff on owner draw seems quite advanced.
Thanks in advance.
Elaine (fluffy tigress emoticon here)
Would you like to meet my teddy bear ?
|
|
|
|
|
Well, there is a bit in "Programming VC++ 6.0" (Kruglinski, Wingo, Shepherd), Chapter 11, example 11D. In fact, there is an electronic variant of the book but it's a bit too large (about 11 Mb)
Hope this helps.
|
|
|
|
|
There are several nice articles on this site. You probably want to read through a couple of them before you get started, it shouldn't be too bad (most of the pain in doing custom or customized controls is dealing with backwards Windows crap...), so if you hit a specific problem you can always ask here.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
I have a function that return variant.How can I cast it to CString?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
VARIANT v;
CString strValue;
//TCHAR sz[5];
VariantInit(&v);
v.vt = VT_BSTR;
v.bstrVal = strValue.AllocSysString();
//v.bstrVal = SysAllocString(sz);
//do something with variant
SysFreeString(v.bstrVal);
VariantClear(&v);
another way around
Variant v;
//variant gets value
CString strValue(v.bstrVal);
hope it helps
DanielO
|
|
|
|
|
Thats perfect.Thanks a lot.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Can any one tell m how to convert Variant to std::srting and char *
|
|
|
|