|
forget all and use the logic as in my first post. it will work.
but add a new line to that
AfxMessageBox(str);
-----------------------------------
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
Yep it's work cool.
I appreciate your help all the time...
Eranga
|
|
|
|
|
:-Dgood,
congratulations.
|
|
|
|
|
Eranga Thennakoon wrote: AfxMessageBox(c_Date.Format("%d:%d:%d", c_Time.GetDay(), c_Time.GetMonth(), c_Time.GetYear()), MB_OK) ;
no it not work,as it is not returning any string!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thats what I'm really worried. The first argument is not a string. So what is your suggestion.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: The first argument is not a string
First you have to Format the Date Time in the CString object, than you have use that object in the messagebox!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Sure you can, but why would you want to (use such an ugly statement)? Try this instead:
CTime time = CTime::GetCurrentTime();
AfxMessageBox(time.Format("%x"));
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have an MFC application (MDI) that at startup loads a separate resource-dll containing dialogs, string table, menus, bitmaps etc. depending on the current language (which is set in a .ini-file).
My problem occurs when I want to change resource dll during run-time (i do this from a new dialog). All new dialogs that opens after I load the new dll get the right language but stuff like the menus etc. that are already loaded keeps the old language. What I'm looking for is like a global redraw-function that completely reloads the UI from current resources.
I have tried UpdateWindow(), RedrawWindow(), and Invalidate() on the main window but nothing works. I fear I have to write a custom-made update function where I gather all calls to resource items which is something I'd like to avoid as far as possible.
Any ideas?
|
|
|
|
|
KnoenTCP wrote: I have an MFC application (MDI) that at startup loads a separate resource-dll containing dialogs, string table, menus, bitmaps etc. depending on the current language (which is set in a .ini-file).
In which function you are switching the resource?
|
|
|
|
|
I switch the resource in a dialog class function, e.g. CMyChangeLanuageDialog::OnOK
<br />
...<br />
m_hResourceDLL = LoadLibrary( (LPCSTR)strDllFileName );<br />
AfxSetResourceHandle( m_hResourceDLL );<br />
...<br />
Same is done at startup in something like CMyApp::initilize(), where CMyApp is derived from CWinApp. After which the application picks the right resources when creating the UI.
But when I just set a new file-handle during run-time with AfxSetResourceHandle() it does not seem to reload the UI, only save the new handle for future checks. Thats why I'm looking for some global redraw function.
|
|
|
|
|
The already-loaded resources need to be reloaded. Once they are loaded the first
time when the UI object is created, the system doesn't look at the resource again.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yeah, seems like this is the only way. Is there any way to do this without restarting the whole application (this is what I wanted to avoid)?
Can't seem to find a member function of the controls that would make it reload itself. Tried to destoy (e.g. a menu) and load again but seems to give me other problems then, CMDIFrameWnd::Assertvalid() fails. I'm at a loss at this one.
|
|
|
|
|
You'd probably need to destroy windows and recreate them.
To prevent the application from terminating if the main window is
destroyed, set the app class' m_pMainWnd member to NULL.
When the new main window is created, you can set m_pMainWnd
as a pointer to the new main window.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everyone,
I want to print out and log localized message according to current locale of machine. For example, if I am always use MESSAGE_ERROR macro in my program, and I want to replace it with "Error" when the locale is en_US and be replaced with French if the locale if Fr.
I am wondering whether Visual Studio 2005 provide some existing technology or some resource file which I could utilize? For example, I could define MESSAGE_ERROR macro to "error" if locale is English and define to other values if other locale is set. I do not want to change any source codes if necessary. I am developing unmanaged C++ DLL using Visual Studio 2005.
thanks in advance,
George
|
|
|
|
|
Hi Experts,
I devolped a SDI appliaction.As I execute it, sometimes it fit to window somtimes not.Can anyone help me ?
|
|
|
|
|
pther wrote: As I execute it, sometimes it fit to window somtimes not
can you explain a bit clearly?
|
|
|
|
|
As I run the application it does not fit into window as a maximized window application fit. It appears a maximized window but little down to the taskbar.
|
|
|
|
|
you want it to be maximised always?
|
|
|
|
|
It is already maximized but appear littile down to taskbar.It is getting same position to maximize.
|
|
|
|
|
no proper clue.
because, i never faced such problems with sdi applications.
try using it in any other system and see.
if possible, you can send me your project folder zipped without debug folder,
provided, it is in vc++ 6.0.
|
|
|
|
|
Thank you . But I can't send you the full project . Will screenshot be usefull ?
|
|
|
|
|
|
chandu004 wrote: if possible, you can send me your project folder zipped without debug folder...
And how does this benefit others that are reading this thread?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes sir you are right.
but iam sure that, the OP or me shall quote the solution in this forum, if it is really solved.
why i wanted him to send his application is , because, i never faced this problem with sdi.
so i wanted to see it practically and try to solve it.
|
|
|
|
|
pther wrote: It is already maximized...
How are you verifying this? Even if your app's window fills 98% of the desktop, it is still not maximized.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|