|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
problem with return vaules help !!
i get wrong return vaules
at NetRemoteTOD, in tme_of_day structure like tod_hours 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 http://authors.aspalliance.com/aylar/ViewPasteCode.aspx?PasteCodeID=3490 |
|
#2
|
|||
|
|||
|
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. hth, M.
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
|||
|
|||
|
same
|
|
#4
|
||||
|
||||
|
I just looked at the code and boy, it has a big flaw. I'm assuming this is where your problem is:
Code:
var Buffer :pointer;
Rek :PTime_Of_Day_Info;
sex:dword;
begin
sex:=NetRemoteTOD(nil,buffer);
if sex = 0 then
Rek:=PTime_Of_Day_Info(Buffer);
writeln(rek.tod_elapsedt);
writeln(rek.tod_msecs);
writeln(rek.tod_hours);
.... lots of other fields
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.
__________________
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 Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month |
|
#5
|
|||
|
|||
|
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.
Code:
C:\>time The current time is: 0:55:46.21 Enter the new time: thats sample thing in cmd to kow the time. Code:
C:\>time1 +------------------+ Currect Time is 15:55:48 +------------------+ thats my file it seems to get the mins and sec good but not the nost importent hours ![]() 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 ? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > problem with return vaules help !! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|