|
How did you try? What did you do?
|
|
|
|
|
I think you may have to derive your own class from CComboBox [^] and add your functionality the derived class.
I must get a clever new signature for 2011.
|
|
|
|
|
After all , I did it in follow way :
BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
and
BOOL CComboBoxExt::OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if(message == CB_FINDSTRING)TRACE("\n bingo \n");
return CComboBox::OnWndMsg(message, wParam, lParam, pResult);
}
|
|
|
|
|
i want to change the width of verticalscrollbar of list box using mfc
|
|
|
|
|
Step 1: Remove style WS_VSCROLL from listbox
Step 2: Create your own listbox object, derived from CListBox, and in the Create() function create your own CScrollBar object, whose width you can then set.
Step 3: Hook up all the scroll messages.
|
|
|
|
|
Hi,
I create one WPF window using in C# code. How to this window use in Vc++ win32 GUI?
actually i want how to integrate WPF window designs in vc++ win32/mfc environment?
How to add WPF files(like C# and xaml) in Vc++ win32/mfc project?
Pls share ur ideas or urls?
Regards,
M.Mathivanan
|
|
|
|
|
|
I have already answered this question here[^]. Try doing some research for yourself on how to expose the COM interfaces from a C# program. You could start by looking at the articles here on CodeProject.
I must get a clever new signature for 2011.
|
|
|
|
|
Hi,
I want to be able to convert a double to an integer. Say the double variable is a decimal, like 1.732. If I use int() to convert it, I will get 2. I just want the whole number of the double variable, 1, without any rounding. How do I do this in C++?
modified 21-Dec-20 21:02pm.
|
|
|
|
|
I would try a simple cast.
Warning: whatever you end up with, make sure it works the way you want it for negative numbers too!
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Don't typecasts round the decimal to a whole number when going from double to integer? And isn't int() a typecast?
BTW thanks for the help...
modified 21-Dec-20 21:02pm.
|
|
|
|
|
did you try anything? did you look it up in your C++ book? did you google it?
see, asking questions is the easy part.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Casting and assigning to an integer will not do any rounding.
The integer will only store what it can accommodate, which is the integer part of the decimal number.
|
|
|
|
|
What about using floor or ceil before casting to int? Actually, the return value of those function is double again, but I do not know how bad the consequences could be - maybe round after those functions...
|
|
|
|
|
I thought it was a standard thing, but when I do int(1.732) I get 1 and int(-1.732) I get -1.
A look at the disassembly shows that a function from the CRT (_ftol2 in my case) is used, so it could be implementation specific.
If this is the case then you should use something like floor/ceil as Bernhard Hiller suggested.
This function will result in the behaviour described above, where numbers round towards 0.
It includes epsilon rounding to account for epsilon errors.
In some cases 3 = 2.99999999999 (or something similar) due to rounding errors in previous operations.
See http://en.wikipedia.org/wiki/Double_precision[^] for more details
int DoubleToInt(double nDouble) {
if (nDouble >= 0) {
retrun (int)floor(nDouble + DBL_EPSILON);
} else {
retrun (int)ceil(nDouble - DBL_EPSILON);
}
}
|
|
|
|
|
Thanks.
I thought I read somewhere that int() rounded down when converting from double, though it didn't seem so when I tested it. I think the whole thing that brought up this issue was the fact that int() doesn't handle decimals like 1.99999... correctly. Therefore it was throwing off everything when it rounded 1.999... to 2.
The above function works perfectly, so long as you make sure to include both float.h and cmath.
Thanks again!
modified 21-Dec-20 21:02pm.
|
|
|
|
|
How can I retrieve a handle to an dropdown list box from CComboBox ? I try with COMBOBOXINFO but I gat this error :
error C2501: 'COMBOBOXINFO' : missing storage-class or type specifiers
when I try to use it ... I want to reproduce this solution :
this[^]
but I failed ... can you help me ?
|
|
|
|
|
You should define _WIN32_WINNT to be 0x0501 or greater.
|
|
|
|
|
I defined like :
#define _WIN32_WINNT 0x0501
in stdafx.h file , but in vain ...
|
|
|
|
|
Try (also) defining WINVER to be at least or greater than 0x0500
#define WINVER 0x0500
Check in stdafx.h , it's probably defined in there already but with 0x0400 or somesuch.
Does that help?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Great .. I think that it works ! I will come back tomrow with news ! Thanks !
|
|
|
|
|
Yourwelcome.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Seem I not put statment in the right place for the first time ...
|
|
|
|
|
Is it OK now?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
Yes, it's OK . Thank you very much !
|
|
|
|