November 15th, 2004, 08:09 AM
problem with return vaules help !!
i get wrong return vaules
at NetRemoteTOD, in tme_of_day structure
Specifies a DWORD value that contains the current hour. Valid values are 0 through 23.
i get 4194304, at this i dunno why
here is the code
November 15th, 2004, 08:52 AM
When passing Delphi records to windows functions, you have to declare them "packed" so the compiler doesn't realign the fields.
i.e. type myRec=packed record ..... end;
Not sure if this applies here, DWORD should be the default alignment, so a record of DWORDs is already packed. But you should give it a try.
November 15th, 2004, 11:03 AM
November 15th, 2004, 05:56 PM
I just looked at the code and boy, it has a big flaw. I'm assuming this is where your problem is:
Note the stuff in bold. If the call to NetRemoteToD succeeds, then it executes that line. If not, it doesn't execute that line, so Rek could be pointing anywhere. Regardless of whether the function succeeds or fails, it is writing out data. So, if NetRemoteToD fails, rek is pointing to uninitialized data and hence the data that is written out is completely bogus.
var Buffer :pointer;
if sex = 0 then
.... lots of other fields
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
November 16th, 2004, 10:59 AM
yes i noted that once a while after i posted the message, well i still get some wrong vaules and i hae no idiea why. the function seems to work but there are some wrong vaules.
thats sample thing in cmd to kow the time.
The current time is: 0:55:46.21
Enter the new time:
thats my file it seems to get the mins and sec good but not the nost importent hours
Currect Time is 15:55:48
and thats the finel code: http://www.jinote.com/css/NetRemoteTOD.rar
P.S: i tut maby the zone time inc / dec the hours but i cant get the zone currect vaule too.
so what to do ?