|
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
|
|
|
|
|
If i remove this Exit from .RC menu editor.When im runnong application it shows Unhandled Exception error.
So what i did,i coded like
pSubMenu->RemoveMenu(0, MF_BYPOSITION);
This will remove the Exit dynamically and then i added my menu by
pSubMenu->AppendMenu(MF_STRING | MF_ENABLED, ID_COMMAND_1, "First Item");
pSubMenu->AppendMenu(MF_STRING | MF_ENABLED, ID_COMMAND_2, "Second Item");
Now i want to rename the main menu text dynamically.
I dont know how can i do that?
Anu
|
|
|
|
|
Anu_Bala wrote: If i remove this Exit from .RC menu editor.When im runnong application it shows Unhandled Exception error.
And that doesn't concern you?
Anu_Bala wrote: pSubMenu->RemoveMenu(0, MF_BYPOSITION);This will remove the Exit dynamically...
Employing a "band-aid" fix is not the right answer.
Anu_Bala wrote: Now i want to rename the main menu text dynamically.
I dont know how can i do that?
How about ModifyMenu() ?
"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
|
|
|
|
|
You can override OnInitMenuPopup() and insert and remove menu items there.
What is happening is that your menu template (in the .rc file) is being loaded automatically. Until it is loaded, trying to insert or append will have no effect. OnInitMenuPopup() gives you a chance to modify the menu before it is displayed.
|
|
|
|
|
Anu_Bala wrote: I tried InsertMenu,Append Menu
but nothing happens.
What do those two functions return? Have you tried calling ::InsertMenu() or ::AppendMenu() instead?
"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
|
|
|
|
|
If the menu is already selected into the mainframe at time of modification, you need to call DrawMenuBar() after updating it for changes to take effect (be shown)
If you vote me down, my score will only get lower
|
|
|
|
|
There is a requirement to hide the vertical scrollbar of listbox .
|
|
|
|
|
There is a requirement to hide the vertical scrollbar of listbox when items exceed the display area. There is no option to hide vertical scrollbar but there is a option for to hide horizontal scroolbar.
|
|
|
|
|
Can't you remove the 'Verical scroll' style from the list box property, or remove WS_VSCROLL window style?
|
|
|
|