Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 15th, 2004, 08:09 AM
Object4 Object4 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 8 Object4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old November 15th, 2004, 08:52 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 42 m 50 sec
Reputation Power: 185
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.

Reply With Quote
  #3  
Old November 15th, 2004, 11:03 AM
Object4 Object4 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 8 Object4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
same

Reply With Quote
  #4  
Old November 15th, 2004, 05:56 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Click here for more information.
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,713 Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 11 h 21 m 11 sec
Reputation Power: 1179
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

Reply With Quote
  #5  
Old November 16th, 2004, 10:59 AM
Object4 Object4 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 8 Object4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 ?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > problem with return vaules help !!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT