[Openroad-users] WindowsAPI call to GetLocalTime

Doug White black_belt101 at hotmail.com
Fri Apr 25 13:03:08 EST 2008



Ross Kummer's email let me know they were stored in 2byte integers, so i originally did the solution below except back the front, then with a quick print out i realised that my year was 4 and my month was 2004. So i switched each pair of 2. 

not very technical im afraid... 

__ÐöUgWa__

Date: Thu, 24 Apr 2008 11:28:12 +0100
From: gareth.2.edwards at bt.com
To: openroad-users at peerlessit.com
Subject: Re: [Openroad-users] WindowsAPI call to GetLocalTime










Could you explain how you came up with that solution, as i was 
banging my head for an hour or so on this.
 
Cheers, 
Gareth Edwards 
BT Global Services 
t: +44 (0)131 300 
1907 
e: Gareth.2.Edwards at BT.com 
 


  
  
  From: openroad-users-bounces at peerlessit.com 
  [mailto:openroad-users-bounces at peerlessit.com] On Behalf Of Doug 
  White
Sent: Thursday, April 24, 2008 7:17 AM
To: 
  International OpenROAD Users
Subject: Re: [Openroad-users] 
  WindowsAPI call to GetLocalTime


  Sorry all, heres the corrected (and tested) 
  code

initialize()=
declare
    wYear = INTEGER NOT 
  NULL;
    wMonth = INTEGER NOT NULL;
    
  wDayOfWeek = INTEGER NOT NULL;
    wDay = INTEGER NOT 
  NULL;
    wHour = INTEGER NOT NULL;
    
  wMinute = INTEGER NOT NULL;
    wSecond = INTEGER NOT 
  NULL;
    wMilliseconds = INTEGER NOT NULL; 
  
  
    Li_1 = INTEGER NOT NULL;
    Li_2 = 
  INTEGER NOT NULL;
    Li_3 = INTEGER NOT 
  NULL;
    Li_4 = INTEGER NOT 
  NULL;
enddeclare
{
    CALLPROC 
  GetLocalTime(
        
  byref(Li_1),
        
  byref(Li_2),
        
  byref(Li_3),
        
  byref(Li_4));

wSecond = MOD(Li_4,65536);
wMilliseconds = (Li_4 - 
  wsecond) / 65536;

wHour = MOD(Li_3,65536);
wMinute = (Li_3 - wHour) 
  / 65536;

wDayOfWeek = MOD(Li_2,65536);
wDay = (Li_2 - wDayOfWeek) / 
  65536;

wYear = MOD(Li_1,65536);
wMonth = (Li_1 - wYear) / 
  65536;


CurFrame.TRACE(
    'Year: ' + 
  VARCHAR(wYear) +
    ' Mth: ' + VARCHAR(wMonth) 
  +
    ' DOW: ' + VARCHAR(wDayOfWeek) + 
  
    ' Day: ' + VARCHAR(wDay) +
    ' Hr: 
  ' + VARCHAR(wHour) +
    ' Min: ' + VARCHAR(wMinute) 
  +
    ' Sec: ' + VARCHAR(wSecond) +
    ' 
  MS : ' + VARCHAR(wMilliseconds));

}


  __ÐöUgWa__


  
    
    From: black_belt101 at hotmail.com
To: 
    openroad-users at peerlessit.com
Date: Thu, 24 Apr 2008 15:21:35 
    +1000
Subject: Re: [Openroad-users] WindowsAPI call to 
    GetLocalTime


    
    
    Hey all, haven't read through every single post, but this is how you get 
    data out of a STRUCT api call.

DECLARE
    wYear = 
    Integer NOT NULL;
    wMonth = Integer NOT NULL; 
    
    wDayOfWeek = Integer NOT NULL;
    
    wDay = Integer NOT NULL;
    wHour = Integer NOT NULL; 
    
    wMinute = Integer NOT NULL; 
    
    wSecond = Integer NOT NULL; 
    wMilliseconds = Integer 
    NOT NULL; 
ENDDECLARE
{
    Li_Return = CALLPROC 
    GetLocalTime 
    
                    
        ( BYREF(wYear),
       
                   
        BYREF(wMonth),
          
                    
    BYREF(wDayOfWeek),
          
                    
    BYREF(wDay),
          
                    
    BYREF(wHour),
          
                    
    BYREF(wMinute),
          
                    
    BYREF(wSecond),
          
                    
    BYREF(wMilliseconds));
}


    __ÐöUgWa__


    
      
      Date: Wed, 23 Apr 2008 11:13:45 +0100
From: 
      gareth.2.edwards at bt.com
To: openroad-users at peerlessit.com
Subject: 
      Re: [Openroad-users] WindowsAPI call to GetLocalTime


      

      

       >Where an API specifies a STRUCT as a 
      parameter, you should be able to declare a LongByteObject to pass to the 
      API.   
       
      I tried this with the following code and 
      get a runtime error.
       
      DECLARE
 LBO = 
      LongByteObject;
BEGIN
       
          CALLPROC GetLocalTime 
      (BYREF(LBO));
       
      =====
       
      E_EO001B Objects and arrays can not be passed 
      BYREF to 3GL procedures.
    Parameter number 1 to the 
      3GL procedure 'GetLocalTime' is an object or
    array 
      value. Objects and arrays can not be passed BYREF to 
      3GL
    procedures.  You will have to remove the 
      BYREF keyword from the
    parameter list to this 
      procedure.
       
      =====


    
    Click here Search for local singles online @ Lavalife. 


  
  Grab it. You dream 
  job is up for grabs. 

_________________________________________________________________
You dream job is up for grabs. Grab it.
http://mycareer.com.au/?s_cid=596065 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.peerlessit.com/pipermail/openroad-users/attachments/20080425/e3159c7e/attachment.html 


More information about the Openroad-users mailing list