|
In the UK - and in most of Europe as well - we have lost an hour over the week-end. We get used to it and Windows usually handle it pretty well but... I have a client whose date / time is indicated properly in the task bar but COleDateTime::GetCurrentTime returns the time -1 hour (the old time - the GMT one).
Restarting the application does not change anything.
Any idea about what could cause this?
Should I mention it happens on a Novell network ot is this a red herring?
Thanks in advance for any help.
|
|
|
|
|
The administrator found the problem. I give his answer for future reference.
"Our W2K servers do not synch their time from Novell network, they synch their time from PDC, which synchronises itself using NTP. Our Novell network synchronises itself from the same NTP source as well. Neither W2K nor Novell has the ability of peering through NTP - they are both just synching themselves of an NTP source. All servers and workstations are displaying the correct time on the system tray or similar - and that might be something that baffled everyone.
The culprit for the error was a legacy environment variable TZ with its value set to GMT0, as required by Surveycraft since the day one. Surveycraft does all time zone difference calculations itself as the MS C-libraries were quite buggy on that respect in the mid 80's. To be able to do it properly Surveycraft required the TZ to be GMT0.
During the winter that did not make a difference, since the GMT0, or UTC as it should be called, was the same as the local time. Now, since the local time is UTC+1, there is an hour difference between the local time and GMT0, but the localtime was returning a time instructed by the TZ, a GMT0 time.
Removing setting of legacy environment variable TZ from the login script corrects situation here, but also cripples Surveycraft operations with CATI during the daylight saving time (should there be ever need for such a thing). A quick test indicated that Surveycraft and AskiaVoice were only applications affected by changing of the value of TZ environment variable - every other one tested returned the same value for current time regardless of the existence of TZ environment variable or its value."
|
|
|
|
|
Surveycraft should probably have been using gmtime(), not localtime(). gmtime() always returns the current UTC time. localtime() uses TZ if it's set and falls back on the Windows settings if it's not.
Most Windows applications will use GetSystemTime (returns UTC) or GetLocalTime (returns the current time in the time zone selected in Control Panel/Date and Time), rather than the C run-time libraries.
An additional issue is that DOS stored the local time in the hardware clock. It did not have any native support for Daylight Savings Time. When asked for UTC [gmtime(), time()], the DOS C run-time would convert back from local time (with the inherent flaws around the Daylight Savings start and end dates). Windows inherits keeping the hardware clock in local time, for compatibility, but only reads it at boot time, converting to UTC. It then maintains the clock in memory without reference to the hardware clock, relying on interrupts to update the in-memory clock. The hardware clock is, I think, only updated when the time zone changes or the date and time are set explicitly (either by the user or by the NTP client), and also on system shutdown.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks for this... and I have just read your article which is very useful as well!
|
|
|
|
|
I had written an application in a language version. All displaying strings in my application were written in this language in the string table.
Now, How could I add support for other languages without modifying the existed resources?
Is it possible to be done by adding resources such as string table in other languages?
What should I do to use resources of the specified language and let the IDE build an application of specified language?
I'll appreciate your help, thanks~~!
|
|
|
|
|
|
Hi, I need to get the domain name (not the controller domain name) of a remote computer. I'm using NetWkstaGetInfo function and I tried to use it, but I have got problems. This function works correctly when I try to get domain name of local computer but it returns an error when I tried to get information about a remote computer. This is the function code:
BOOL GetDomainName(char *szTerminal, char *szDomain)
{
PWKSTA_INFO_100 pBufferInfo;
NET_API_STATUS err = 0;
DWORD dwBytes;
WCHAR *swzTerminal = NULL;
dwBytes = MultiByteToWideChar(CP_ACP, 0, szTerminal, -1, NULL, 0);
swzTerminal = malloc(dwBytes* sizeof(TCHAR));
dwBytes = MultiByteToWideChar(CP_ACP,
0,
(LPCSTR)szTerminal,
-1,
swzTerminal,
dwBytes);
err = NetWkstaGetInfo((char *)swzTerminal,
(DWORD)100,
(LPBYTE *)&pBufferInfo);
if(err != NERR_Success)
{
return FALSE;
}
WideCharToMultiByte(CP_ACP,
0,
(LPCWSTR)pBufferInfo->wki100_langroup,
-1,
szDomain,
MAX_PATH,
NULL,
NULL);
return TRUE;
}
The returned error is err = 5 (ERROR_ACCESS_DENIED)
I read some Microsoft information about privileges required for executing this function. But I executed the program with an local administrator user in Windows 2K and NT and got the same problem. I just need information about the domain name, not modify anything. Maybe is there a posiblity of querying information with a lower level that don't require administrator privileges.
I've seen some commercial programs (like Dameware) that obtains the domain name just with IP address of remote computer, without establishing any connection (and introducing username and password). I am trying to do the same.
In the NetWkstaGetInfo information appears:
"You must have Print or Server operator privilege, or be a member of the Administrator or Account local groups to successfully execute NetWkstaGetInfo at level 0 or level 1 on a remote server. No special privilege is required for level 10 calls."
How can I do level 10 calls?
Thanks.
|
|
|
|
|
In my application, com component created a window which is not a com object(for example: CWindow ), and has a method to get the window's HWND.But I want to show the window in MFC's Splitter view.
I try to attach Splitter view to the window, but failed. who can tell me how to do this, thanks very much.
hdfhfgh
|
|
|
|
|
Hi
I'm using CHtmlEditCtrl to edit HTML documents.
The following code is used to load the file into the document object. It works fine when the document is initally loaded, but once the file has been edited and saved by the document object itself, the file does not load correctly.
I'm not to hot on reading from files, so any suggestions would be appriciated.
Many Thanks
Mark
if(f.Open(m_sEditingFile, CFile::modeRead))
{
while(f.ReadString(sIn))
{
SAFEARRAY* psa = SafeArrayCreateVector(VT_VARIANT, 0, 1);
VARIANT *param;
SafeArrayAccessData(psa, (LPVOID*)¶m);
param->vt = VT_BSTR;
param->bstrVal = sIn.AllocSysString();
pDoc->writeln(psa);
}
}
|
|
|
|
|
All
Found my own answer...
IHTMLDocument2 *pDoc;
if(m_pHtmlEditCtrl->GetDHtmlDocument(&pDoc))
{
LPDISPATCH lpDispatch = NULL;
IPersistFile *lpPersistFile = NULL;
// m_ctrl is an instance of the Web Browser control
pDoc->QueryInterface(IID_IPersistFile, (void**)&lpPersistFile);
lpPersistFile->Load( sFilename.AllocSysString(),0);
lpPersistFile->Release();
}
This came from code I found documented to save the file. A quick check and the IPersistFile did include a "load".
The thing that gets me is "where is this documented", they are all MS controls yet I can't find any of this on the MSDN site. I spent more time looking for examples of code and objects than I do designing the software and coding....
How the above code is a help to anyone else playing with these controls.
Mark
|
|
|
|
|
Hi
This is the basic layout of what I am doing:
(1) I have created a CPropertySheet() class that has a few CPropertyPages added to it. The CPropertySheet is set in wizard mode.
(2) For some CPropertyPage instances of CPropertyPage, the OnWizardNext determines which page will be viewed next. I thought that this should be simple enough and I can call (CPropertySheet*)GetParent() from CPropertyPage and then call CPropertySheet::SetActivePage with the page number that should be viewed next.
However, this does not work and I am not sure how and where SetActivePage() should generally be called from. The Visual C++ docs on this topic are sparse. If someone has used SetActivePage before or knows a clean way to change the ordering of the pages in a property sheet, please reply.
Thank you
|
|
|
|
|
|
In your CPropertyPage derived class, override OnWizardNext() and return the id of the CPropertyPage to be displayed. You can also return 0 for the default next page or -1 to prevent the wizard from advancing.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks
I just worked that out. For anyone else who is trying to use SetActivePage for changing the order of pages in CPropertySheet, please don't. Just read this in the MSDN docs for OnWizardBack and OnWizardNext:
Return Value
0 to automatically advance to the next page; –1 to prevent the page from changing. To jump to a page other than the next one, return the identifier of the dialog to be displayed.
|
|
|
|
|
I have a sb live CT4780 card. Can I program its EMU chip. Are there any four channel audio files on the net which can be used to check its capabilities? Which player should I use then? Will winamp 2.8 work? Or should I use its 4 channel plugin? (If it exists...)
|
|
|
|
|
Try looking for video files that have an AC3 sound track. Or, you could use a DVD with surround... e.g. the Matrix.
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^]
|
|
|
|
|
This sounds very simple, well I have a little problem trying to do that in VC++. I created a form application with .Net and the default form is perfect. I added the second one and for some reason when I include the second form's header it give me an error:
ObjIdl.h(246) : warning C4935: assembly access specifier modified from 'public'
ObjIdl.h(258) : warning C4935: assembly access specifier modified from 'public'
ObjIdl.h(7408) : error C2872: 'IDataObject' : ambiguous symbol
could be ObjIdl.h(246) : System::Windows::Forms::IDataObject IDataObject'
or 'stdafx.cpp(0) : System::Windows::Forms::IDataObject'
ObjIdl.h(7422) : fatal error C1903: unable to recover from previous error(s);
Well if anyone knows how to fix this...
Kamui
|
|
|
|
|
How to write device drivers compatible with both Win 95/98 – resources, steps, what development tools are needed, etc.
Tell me why
|
|
|
|
|
Your best bet would be to look at the Windows DDK and samples to learn about specific platform differences. Knowledge of assembly and C are helpful.
|
|
|
|
|
I have created project using VC6, SDI with some formviews. I can switc:(h these views with no problem. In the Doc, I do SERIALIZE with some CString with no problem, but when I use the derived Edit Control like CMyNumeric to create some edit boxes, and using variable in the private: like double Edit1; and so on. I do evrything the same as with CString but I have problem and don't know why only one data with numeric left over when I switch between forms, but all CString are still there. Could anyone help me, please? Where to be fixed?
TIA
Tony
|
|
|
|
|
Hi-- I've been banging my head trying to solve this problem. Of course I'm a self trained pseudo programmer who just started to use STL. I have a huge file with 10 million entries that are paired, say:
1 8
1 5
1 3
2 0
2 4
3 0
3 8
etc...
They are stored as a two dimensional array of 10 million rows and two columns... you get the idea of the data. I need to find the records in the file that have one and only one of the tags in the first entry of the pair and put the second in another vector file in the order found. For example, if I need records with the tag 2, I'll create the vector
0
4
I suppose I need to use a multimap, but do not know how to read the file and then store the results in a vector. Right now I have this simple code:
typedef vector DVECTOR;
DVECTOR FDV;
int tag;
double FD;
int id = 3;
int idp = id + 1;
while(tag != idp)
{
GetData >> tag >> FD;
cout << tag << " " << FD << endl ;
if(tag == id)
FDV.push_back(FD);
}
This does what I want by scaning the file from the begining until it finds the target value and reads all the entries with such value. If the number is close to the first entry, cool it's fast, but if it is near the end it will take a long time (big program repeated many times...). The question is, would the multimap work better and faster to do the same task? If so... how do I do it??? that is, read the file, store the data in a multimap, search for the tag number of my interest and copy all values associated to the tag number into a vector. If I have to read the whole 10 million line file to put it in a map, then it's going to be hanging around in memory for further use (several times)... or should I read the file every time I need it?? If so, then, isn't my naive code more efficient???
Thank you so much!
Carlos
|
|
|
|
|
Hi,
If your data is in memory, yes it is a multimap you need. You fill it like this:
typedef multimap<int,int> mmapint ;
mmapint mapData;
mapData.insert(mmapint::value_type(1,8));
mapData.insert(mmapint::value_type(1,5));
...
To find the data,use this
vector<int> vecResults;
mmapint::const_iterator iteWhere = mapData.find(nSearchedValue);
while ( iteWhere != mapData.end() )
{
if ( iteWhere->first != nSearchedValue)
break;
vecResults.push_back(iteWhere->second);
iteWhere++;
}
Now, if each time you are going to do a search, you are reading the whole file into memory, you might as well collect the information as you read it... And if your file is sorted, then you should probably do a search by doing successive seeks and halfing the extent of your search... moving to the first one and iterate until you find all of them.
Hope this helps!
|
|
|
|
|
YOU ARE AWSOME!!!!
THANK YOU THANK YOU THANK YOU!!!
CARLOS
|
|
|
|
|
1. If your source file does not change,
2. and you read it each time, or keep the file handle open,
3. it is already sorted by your first key,
then you might also optimize your existing system by keeping track of the file position where each set of elements begin. That is, where do the 1 begin, the 2 begin, the 3 begin, etc. Then you can SetFilePosition() or seek() to that spot, and at least read until you get something NOT matching your number.
Otherwise, if always in memory, then use the multimap.
|
|
|
|
|
GREAT IDEAS!
THANK YOU!
CARLOS
|
|
|
|
|