|
i might beat you by second!
"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
|
|
|
|
|
All are beat me here by years of experience at all.
Thanks for you replay as well.
I appreciate your help all the time...
Eranga
|
|
|
|
|
yah good.
one funny thing happened you know,
as per the practice,
after i punch few lines of code in the editor, automatically, my index finger hits the F7 key to build the code and my lefthand hits the escape key to exit the output window.
the same hapenned in my previous post. but when i hit escape, the content i typed got disappeared. again i had to retype the post. thats why you are fast.
you can try out this logic. its funny.;P
|
|
|
|
|
Had you immediately hit Ctrl+Z, your text would have reappeared.
"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
|
|
|
|
|
;Pyah its working.
thank you.
|
|
|
|
|
Yep, I found this on MSDN as well. But my question is how to assign that time(or date) in CString. Casting is not allow on, LPCSTR. Isn't it
I appreciate your help all the time...
Eranga
|
|
|
|
|
observe my post clearly. it solves ur problem.
i.e. assigning the time to a CString.
--------------------------------------------------
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
|
yah first, i didnt specify that line.
but later i thought that, that would also be helpful to you.
any way.
solved or not?
|
|
|
|
|
Yep, the code seems work fine. But the thing is I can't use it directly on a message box as follows. May be my effort can be silly.
<br />
AfxMessageBox(c_Date.Format("%d:%d:%d", c_Time.GetDay(), c_Time.GetMonth(), c_Time.GetYear()), MB_OK) ;<br />
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: May be my effort can be silly.
yah you are always correct. ;P
use them separately.
BTW, what is that you are getting when you used like this.
|
|
|
|
|
The following error I got,
none of the 2 overloads can convert parameter 1 from type 'void'
According to things so far I've learned, if I use two arguments the first one should be in UINT or LPCTSTR format. So I changed it as follows and check,
AfxMessageBox(c_Date.Format("%d", c_Time.GetYear()), MB_OK) ;
Still got the same error. Why it wont work, GetYear() pass int value, isn't it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
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++
|
|
|
|