|
What I did to solve this problem was put all the strings in a *.ini file (you could also use a *.xml file as suggested by V). By using this method, other people can add as many translations as they want, without you having to recompile your app or any extraneous dlls.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
hi CPians,
i have a strange fact. I'd like to add to my program a set of shortcuts (like Ctrl+O to open documents for example). i created the accelerator table and associated each shortcut with a menu item ; without effect.
What did i forget to allow my shortcuts to work ?
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Did you try calling LoadAccelTable on the CMainFrame class?
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
i use a dialog based app, and i think i already used LoadAccelTable(), without success.
do you have a piece of code to show me how to use it ?
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Ah, I thought you had built your own frame-oriented app.
For a dialog, see:
http://msdn.microsoft.com/msdnmag/issues/0700/c/default.aspx
About two-thirds of the way down the page...
Not to worry. You can easily add accelerators to any dialog just by mimicking CFrameWnd...
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
sorry but, can't find what i need...
i have a dialog box with a menu. in this menu, an item like this :
File > Open...
this item called ID_FILE_OPEN_MENUITEM should be associated with the combination of the Ctrl+O keys.
is there an easy way to do this ?
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Click on the Figure 2 link on the page I posted, it has the code for the CDlgWithAccelerators class.
Here's the direct link:
http://msdn.microsoft.com/msdnmag/issues/0700/c/figures.asp#fig2
All you need to do in your project is...
1) Add a new accelerator resource to your project. (let's say it's given the id IDR_ACCELERATOR1)
2) Add an accelerator shortcut in IDR_ACCELERATOR1 for ID_FILE_OPEN_MENUITEM that maps to Ctrl + O
3) Create an ACCEL variable in your dialog to store the accelerators when loaded (m_hAccel in his example)
4) In the OnInitDialog function in your dialog, load the accelerator table you created in 1).
i.e.
m_hAccel = ::LoadAccelerators(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDR_ACCELERATOR1));
5) Create a handler for PreTranslateMessage in your dialog, and copy the PreTranslateMessage code from the DlgAccel.cpp sample to your dialog.
Works fine, I just tried it.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
thak you very much, that's much helpful now
cheers
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
Hi all
I have a modeless dialogbox which is created in a SDI applic on which i have few ownerdraw buttons on one button i have written F4 and my requirement is when ever i click alt key on the keyboard along woth F4 button on the dialog About dialog box of EditView should open , what all messages do i need to send to my application to gennerate this event, i am making use of pretranslate message to check if the alt key is pressed on the key board
void MyDialog::OnButtonF4()
{
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
if(0x8000 ==(0x8000 & GetKeyState(18)))
{
pView->SendMessage(WM_SYSKEYDOWN, 18, 1);
pView->SendMessage(WM_SYSKEYDOWN, 115, 1);
pView->SendMessage(WM_SYSKEYUP, 115, 1);
pView->SendMessage(WM_KEYUP, 18, 1);
}
}
BOOL MyDialog::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == 18)
{
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
pView->SendMessage(WM_SYSKEYDOWN,18,0);
}
if( pMsg->message == WM_SYSKEYUP && pMsg->wParam == 18)
{
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
pView->SendMessage(WM_KEYUP,18,0);
}
return CDialog::PreTranslateMessage(pMsg);
}
can any one help me what to write in Alt key fuction or F4 func or in PreTranslte message
Request to all to continue this
|
|
|
|
|
Hello friends,
how can I know the height of a row in the listview and how can i set the height of the row at the runtime dependign upon the text.
Please help me regarding the above problem.
Thank you in advance.
Neelesh K J Jain.
|
|
|
|
|
Hi,
I replied to your other post about this a few days ago. Have a look at this article.
http://www.codeproject.com/combobox/listboxex.asp[^]
This is basically about making your own version of a control. It uses a listbox as an example, but its the same general idea with any control. The author works with height and width in it so that should help you out.
Getting back to your original problem, I think that there may be an easier way to get it to display. Either there is a property in the list control that controls this or there is a function that allows the text to display. If you click on a file you'll notice that it seems to toggle the text to on, and then when you switch to another file it goes back to the "...". So I think there's a function that you can use. However, if you have a lot of text, it will overlap with images below it, so you would have to adjust the row height as well if that's the case.
|
|
|
|
|
Can anyone please tell me .... how the m_pPushRoutingFrame member of CThreadState be NULL.
i mean i have an application when i close the ChidlFrame in it... i get an execption the reason is that the m_pPushRoutingFrame member of CThreadState in the destructor of CFrameWnd is NULL....
if anyone know anything about it please help... thankx in advance.
P.S there are no threading in my application.
shoaib.
|
|
|
|
|
Probably MFC tries to delete your CFrameWnd on application exit, but you have allocated it on the stack.
MFC expects that frame windows are 'automatically allocated' by the framework, as they are when you use the 'normal' MDI/SDI approach with the wizards. They get automatically deleted when the application shuts down.
Therefore, if you create a CFrameWnd manually, you have to allocate it via new and must not delete it on application exit. The framework does this for you...
This is one of the more obscure "features" of MFC, for which I never found any documentation...
Hope this helps,
Nick
EDIT: some typos
|
|
|
|
|
Can anybody please tell me how to set Unprotected Attributes of CMSG_ENVELOPED_ENCODE_INFO ? Thanks in advance.
|
|
|
|
|
Why the Spin button in MFC behaves oddly. It should increment the buddy value when we press the UP button and decrement by pressing DOWN. The button functionality is Invert of what it should be.
|
|
|
|
|
You have to set the range using SetRange() . If you do not set the range, the default is to have the maximum set to zero and the minimum set to one hundred. This gives you the inverse functionality you are experiencing.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
because spin controls are constructed from 100 to 0 by default.
use CSpinButtonCtrl::SetRange() to set the lower/upper bounds of your spin
TOXCCT >>> GEII power [VisualCalc]
|
|
|
|
|
I got someone to code me a control in VC++. The program requires me to go through a process by which something gets written to the registry. Any idea why this is required?
Thanks.
|
|
|
|
|
Vivic wrote:
The program requires me to go through a process by which something gets written to the registry
i think That Program using Registry for storing some temp value for later use.
Vivic wrote:
Any idea why this is required?
for that you have to read the code ,why he is implementing that.may be to handle registry is very easy
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Vivic wrote:
Any idea why this is required?
It's by design. Beginning with Win95, Microsoft deprecated the concept of using .ini files to initialize program functions, and started pushing the concept of the Registry as a central repository of program information and initialization. Controls often require a few initial settings to be implemented and, consistent with the new model, this requires adding information to the Registry whenever a new control is added to a system.
"If it's Snowbird season, why can't we shoot them?" - Overheard in a bar in Bullhead City
|
|
|
|
|
Thanks for the answer.
But is it possible to do without using the registry at all? What I asked for is that icons be associated with unique functions. This is so that somebody doesn't manage to associate (deliberately or inadvertently) the diskette icon with the 'delete' function, for instance. Of course, that would mean that I have already used the diskette icon for the 'save' function. So, the diskette icon should neither be overridden nor be associated with a second function. Is this what the registry help accomplish? Can it be done without any dependency on Microsoft OS functionality and purely in VC++?
Thanks.
PS. In case you are wondering, the control lets me build a variety of toolbars from existing icons/functions and to whose library I may want to add more icons/functions.
|
|
|
|
|
How could I handling the process of 'Program closing' using Visual C++ (MFC)
I want the program to 'decide' how to quit or when to quit.
|
|
|
|
|
You have to override the WM_QUIT and WM_CLOSE messages. The WM_QUIT message is the one that terminates the entire application. WM_CLOSE is sent when exiting a window such as a dialog.
An example of how to manually quit the program would be
PostMessage(WM_QUIT, 0, 0)
Similarly WM_CLOSE can be used as well.
Hope that helps.
|
|
|
|
|
It doesn't work when I tried to override WM_CLOSE message in my view class. It seems that the system did not send WM_CLOSE message to my CView class when the prgram started to terminate.
|
|
|
|
|
Hmm. I'll try to help you out more, although I don't know that much about overriding those messages as I've never done it before.
I've only worked with closing the program in a dialog based app. The code I posted before should work for manually closing the program. I don't see why it would be any different in an SDI. I'd suggest working with the WM_QUIT message first since that is the message sent when the program terminates. As far as I know the WM_CLOSE message is used if you have for instance a pop-up dialog and want to close it, so it shouldn't be sending any WM_CLOSE messages upon termination of the entire program.
|
|
|
|