|
This is a vague question and I get the impression that if I knew exactly what you're asking:
- I probably wouldn't know the answer.
- An explanation would take more space than available here.
Steve
|
|
|
|
|
Greets,
How can I tell programatically, Is gdi+ already started? Is there a function for this?
Thanks...vmars316
|
|
|
|
|
You could try calling one of the GDI+ functions and checking if it returns GdiplusNotInitialize .
|
|
|
|
|
I have a CButton derived class. I would like this class to handle the click event itself. What should I put in my message map for the button class? ON_BN_CLICKED doesn't work.
|
|
|
|
|
ON_BN_CLICKED just wraps a WM_COMMAND message. You probably want to catch WM_LBUTTONUP messages.
|
|
|
|
|
goorley wrote: I would like this class to handle the click event itself.
use ON_CONTROL_REFLECT() message map.
BEGIN_MESSAGE_MAP(CMyBtn, CButton)
ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)
END_MESSAGE_MAP()
void CMyBtn::OnClicked()
{
}
TN062: Message Reflection for Windows Controls
|
|
|
|
|
Works like a charm!
|
|
|
|
|
Hi . I want to ask you something : how can I catch FindString event on an CComboBox ? I try in some ways but I failed ... I want to give my functionality when I call FindString on that control ... thank you kindly !
|
|
|
|
|
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 ?
|
|
|
|