|
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 !
|
|
|
|
|
Hi
I have an application where a user types a message into an edit control, after they have exceeded a certain number of characters they are shown a warning. ie AfxMessageBox("you have exceeded X number of characters");
it seems that if the user is typing fast by pressing return of the space bar this is calling the OnOK and quickly turning off the message box so the users are not seeing the warning.
Does anyone know if there is a way you can disable the return key and the space key on Afxmessagebox ? i could create a custom dialog to do this but that seems a long way round
can anyone help
thanks
Simon
|
|
|
|
|
You could try a few things.
1. Add MB_NOFOCUS to the flags. In theory this will not give focus to the message box, and so keyboard events will not get sent to it. There is no documentation that I could find on this, so behaviour might be a bit sketchy.
2. Try setting the default button to one that doesn't exist with MB_DEFBUTTON4 .
If neither of these work, then all I can think of is:
1. Make a dialog box that looks like a message box and don't set a default button in it
2. If you want the message to have Vista/7 styles on Vista/7, use XMessageBox - A reverse-engineered MessageBox()[^] and don't set a default button.
3. Hooks. Either keyboard or API. This is a rather big way of doing it, so you would want to try this as a last resort.
I wish that more people think like you. While typing this message an update box popped up as I hit the space bar.
|
|
|
|
|
si_69 wrote: I have an application where a user types a message into an edit control, after they have exceeded a certain number of characters they are shown a warning. ie AfxMessageBox("you have exceeded X number of characters");
This sounds messy. Why not just send the edit control a EM_LIMITTEXT message?
si_69 wrote: it seems that if the user is typing fast by pressing return of the space bar this is calling the OnOK and quickly turning off the message box so the users are not seeing the warning.
You should initially disable the OK button and only enable it if all of the criteria have been met.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I am working in (Windows Presentation Foundation)WPF with C# environment.
I have created simple DLL for C# with WPF.
but how to call C# DLL from VC++ win32?.
Following code of DLL:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Test
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
textBox1.Text = "Welcome to Tessolve";
}
}
}
Actually how to call C# dll function in Vc++ environment?
Please share ur ideas or urls
Regards,
M.Mathivanan
|
|
|
|
|
There is an option to expose C# classes/methods to COM, so you would access them from C++ in that way. Take a look at some of the articles here on CodeProject: try a search for "C# COM".
I must get a clever new signature for 2011.
|
|
|
|
|
|
|
One simple solution is to create a CLI/Interop DLL compiled with /clr, this DLL can export standard C function, which the C++ code can call.
When implementing the standard C functions in the CLI/Interop DLL , then one is able to call standard .NET code, and it is possible for the CLI/Interop DLL to have references to other standard .NET assemblies.
This example hosts a WinForms control in a MFC application, but one could just aswell host a WPF control:
WinFormIntegration Sample: Demonstrates Hosting a WinForms User Control in an MFC Application [^]
modified on Friday, February 25, 2011 10:47 AM
|
|
|
|
|
i want to change quick launch path and start menu shortcut path for existing shortcuts.... also rollback to original path..
|
|
|
|
|
Is this a C++ question?
I must get a clever new signature for 2011.
|
|
|
|
|
There are some articles on CodeProject that will help you get started: here, here, and here.
|
|
|
|
|
In my application initailly i set menu in resource file as
File Display Help Exit
Like this i added first main menu.But dynamically i want to add submenus for Display and Exit.
Under Display,four of five menus should be display.I will add this dynamically by reading it from seperate file.
I tried InsertMenu,Append Menu
but nothing happens.
Pls help me..
Anu
|
|
|
|
|
Anu_Bala wrote: I tried InsertMenu,Append Menu
but nothing happens.
Then you must be doing something wrong, but we cannot guess what happens in your code without seeing some of it.
I must get a clever new signature for 2011.
|
|
|
|
|
Actually i tried
CMenu *pMenuBar = this->GetMenu();
ASSERT_VALID(pMenuBar);
CMenu *pSubMenu = pMenuBar->GetSubMenu(0);
pSubMenu->AppendMenu(MF_STRING | MF_ENABLED, ID_COMMAND_1, "First Item");
pSubMenu->AppendMenu(MF_STRING | MF_ENABLED, ID_COMMAND_2, "Second Item");
By this i can add.but in the mainmenu already one Exit submenu is there.But i dont want that.
So i deleted that sub menu in resource file itself.And when i gave this code it shows assert error.
If i didnot delete Exit menu ,then after running application my FILE menu shows
FILE
Exit
FirstItem
Second Item
Anu
|
|
|
|
|
Anu_Bala wrote: Exit //Actually i dont want this
So can you not just remove it from the .rc file?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|