|
Have you left the default setting of precompiled headers in the compile options? If so, turn it off and delete everything in your debug folder before rebuilding.
|
|
|
|
|
Have you look at this link at all?
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q148652
does it help?
|
|
|
|
|
I am using the follwing code to get the current system time and put it in HH:MM:SS format.
CTime launch_event_time = CTime::GetCurrentTime();
// decompose the current time into hours minutes and seconds
hours = launch_event_time.GetHour();
minutes = launch_event_time.GetMinute();
seconds = launch_event_time.GetSecond();
// format the time for display in both the track report
// and geolocation tables and store in a global variable
sprintf(launch_event_time_txt, "%02d:%02d:%02d",
hours, minutes, seconds);
What I also need is tenths of seconds. Can anyone lend a hand with this?
|
|
|
|
|
If I remember correctly, CTime is based on C's time_t type which doesn't support tenths of seconds. Which is just one of the many problems with time_t.
Try using SYSTEMTIME or FILETIME.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Use getSystemTime() instead and use the wMilliseconds field of the SYSTEMTIME struct to get tenths of a second.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have a lot of problem (especially on windows 2000) to set focus input to the window I want in a multithread context (several threads manage windows)
I have found this remark in an MSDN article concerning SetForegroundWindow function :
Windows NT 5.0 and later: An application cannot force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window (see SetActiveWindow) and call theFlashWindowEx function to notify the user.
Is somebody can explain me what "while the user is working with another window" means exactly or where I can find it
|
|
|
|
|
This is a new GUI feature aimed at relieving the user from those apps that unsolicitedly put themselves on the foreground making the user lose the focus (which is annoying if one is for instance typing some text.) SetForegroundWindow will just show the associated taskbar button flashing to indicate the app requested attention.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Tanks for your response,
Do you know microsoft articles which deal with this purpose.
What you say is quite logical, but it seems to apply to multiapplication management but I have the sam effect in a single application. That is to say I try to give focus to a special window of my application but in another thread but I don't succed in changing focus and the taskbar is flashing
Gwenaël Dourmap
|
|
|
|
|
Hmmm... that's weird, according to the documentation you shouldn't have any problems changing the foreground window within the same process (as long as the process was the foreground process in the first place).
Anyway, take a look at http://www.mooremvp.freeserve.co.uk/Win32/w32tip33.htm for a little hack to get SetForegroundWindow working the way it did on older OSs (see method 2).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm trying to make an interactive batch file (.cmd) to run under Windows NT. The obvious way is to have a program that displays a prompt and sets an environment variable with the response - the batch file can then access the input value via the environment variable (as %environmentvariable%), however
1) using _setenv() only alters the environment for the current program, so the batch file that ran the program does not see the new variable; conversely
2) altering the registry where the environment variables are kept (HKEY_CURRENT_USER\Environment etc.) has no effect until a new DOS shell is started, so the batch file that ran the program does not see the new variable;
3) the old DOS method of getting the PSP and walking up the environment areas isn't allowed under NT (and there's never enough space in the environment area anyway);
If anyone knows how to write a program that can do this, or any other way of making a batch file interactive, I'd love to hear about it.
(PS I know that using VBS or some other scripting language is the right way to go, but I need this to run on any NT Server machine, and the CMD processor seems to be the only scripting engine that is guaranteed to be available)
Thanks
Dave
|
|
|
|
|
I don't know if modifying parent process' env block is possible. I'd give up setting the result in environment vars directly, instead, I'd write something to dynamically created .bat or .cmd file. If user enters 'foo', the file would look like this:
set var=foo
Main batch would call this file to make changes.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks, but it won't work - when the main batch calls the sub batch the sub batch will set the variable in its own environment, but then it disappears again when the sub batch returns to the main batch.
Dave
Dave
|
|
|
|
|
Are you sure? I've tested this on my XP Pro. When you execute b1, SET displays var with the value of 'foo'.
rem b1.bat
call b2.bat
set
rem b2.bat
set var=foo
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Consider using Windows Scripting Host (WSH) - it is intended exactly for such purposes. In WinNT WSH is available after installing Option Pack 4. In WSH you write scripts using Visual Basic Scripting Edition.
|
|
|
|
|
This is a common problem I face in MFC, and presumably theres a simple answer.
I created a dialog template, and loaded this fine from my CMainFrame, docking it also:
CDlgBar *Dlg = new CDlgBar();
Dlg->Create( this, IDD_DIALOG1, CBRS_LEFT | WS_CHILD, IDD_DIALOG1 );
Dlg->ShowWindow( SW_SHOW );
However, I then wanted to add some code to the Dialog template. So I press ctrl+w in the dialog designer and create a class to hold the dialog template. First problem is that I cant create an MFC class to inherit from CDlgBar. Why?!!! Anyway, I decided to inherit from CDialog and change all references to CDialog to CDialogBar manually. This is a lot of work (as we have to change the base class call etc.)
Being as Visual Studio doesnt let me inherit from CDlgBar I presume there is a reason I shouldnt be doing this?
I just found this note at Microsoft:
Because ClassWizard does not support deriving a class from CDialogBar, this
article shows the steps necessary to create a class from CDialog and then
"convert" the class to CDialogBar.
I guess my question is why doesnt ClassWizard support it?
Thanks
Chris
|
|
|
|
|
Hmmm.... Q99161 HOWTO: Derive From Classes not Listed in ClassWizard. Seems to be the answer. I still dont understand WHY classwizard doesnt support though-
|
|
|
|
|
I was playing around with dlls and made exported function like:
extern "C" {void __declspec(dllexport) __cdecl GetData(CString &szData);};
I loaded *function with GetProcAddress() and passed CString object to it. Then dll filled some text into it and i expected to get that data out of dll and actually i did, but when destructor of that CString was called i get error when m_psztext is deleted as it would be allready deleted before.
What did i do wrong?
|
|
|
|
|
Hi,
Dont use CString, use LPTSTR,
MFC uses some state information on a per-module
basis, and is very sensitive to module and
thread switches,
BTW did u include the AFX_MANAGE_STATE in
the exported function. ?
|
|
|
|
|
You can pass CStrings around if and only if you're using the same heap in .exe and .dll. Go to the project settings, then selectd 'C++' tab and 'Code Generation' category. You should ensure that both .exe and .dll use .dll runtime library.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
helo!
i am going to write an statefulll packet filtering firewall , can i block packet at very low level to stop DOS (Dannial Of services) attack on my server, is winsock support this feature, if winsock does not allow this feature then can i write a driver using DDK for doing this thing , kindly guide me for doing this thing .
a bundel of thanx
|
|
|
|
|
I have a document/view app which has drag/drop support to open files.
Currently the OnDropFiles() method calls the document's OnOpenDocument(), but this seems to have a few side effects
1) The document's title doesn't get updated
2) The view's OnInitialUpdate() doesn't get called, meaning my view doesn't realise the document has changed
What am I doing wrong?
Thanks,
Richard
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
You might consider calling
InitialUpdateFrame(pFrame, pDocument, bMakeVisible);
which will actually refresh the view and update the title.
Hope it works.
|
|
|
|
|
Hi
In my dialog I have two Date/Time-Picker-controls...one to select a date and another to select a time. I also have two variables, named
CDateTimeCtrl m_ctlTime;
CDateTimeCtrl m_ctlDate;
What's the easiest way to read their values (date and time) into one single CTime variable?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Use the overloaded construter
CTime( int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec, int nDST = -1 );
|
|
|
|
|
Try this...
SYSTEMTIME st;
m_ctlDate.GetTime(&st);
m_ctlTime.GetTime(&st);
CTime time = st;
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|