Solved

TIME_ZONE_INFORMATION or TTimeZoneInformation

Posted on 2000-05-09
5
1,901 Views
Last Modified: 2012-05-04
I want to use the GetTimeZoneInformation WinAPI function, but it needs the structure TIME_ZONE_INFORMATION passed to it.

Examples of the usage of this function use the TTimeZoneInformation structure, but my version (D2) does not seem to know it.

Could someone please provide the definition of this structure?
0
Comment
Question by:sderaadt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:Motaz
ID: 2795508
Did you test such code:

procedure TForm1.FormCreate(Sender: TObject);
var
  Zone: TIME_ZONE_INFORMATION;
begin
  GetTimeZoneInformation(Zone);
end;

Motaz
0
 
LVL 20

Accepted Solution

by:
Madshi earned 50 total points
ID: 2795630
First you should look into your windows.pas unit. Look at the definition of GetTimeZoneInformation. What type did Borland use there? You should use that type, too.

Well, anyway, here is the structure:

type
 TIME_ZONE_INFORMATION = record
    Bias: Longint;
    StandardName: array[0..31] of WCHAR;
    StandardDate: TSystemTime;
    StandardBias: Longint;
    DaylightName: array[0..31] of WCHAR;
    DaylightDate: TSystemTime;
    DaylightBias: Longint;
  end;

Regards, Madshi.
0
 

Author Comment

by:sderaadt
ID: 2798092
Madshi

Thanks for the definition. I tried it, but still the same error:

'Types of actual and formal var parameters must be identical'

This is the code I have:
>>>>>
Type
     TIME_ZONE_INFORMATION = record
          Bias: Longint;
          StandardName: array[0..31] of WCHAR;
          StandardDate: TSystemTime;
          StandardBias: Longint;
          DaylightName: array[0..31] of WCHAR;
          DaylightDate: TSystemTime;
          DaylightBias: Longint;
     end;

procedure TfEdit.Button1Click(Sender: TObject);
var
     tzi : TTimeZoneInformation;
     iRes : integer;
begin
     iRes := GetTimeZoneInformation(tzi);
end;

>>>>>

Although TIME_ZONE_INFORMATION (or TTimeZoneInformation) was not defined in my windows.pas, TSystemTime is.

Whats wrong? Is TSystemTime defined in my windows.pas wrong?

>>>>>
TSystemTime = record
    wYear: Word;
    wMonth: Word;
    wDayOfWeek: Word;
    wDay: Word;
    wHour: Word;
    wMinute: Word;
    wSecond: Word;
    wMilliseconds: Word;
  end;
>>>>>

I am using Delphi Desktop 2.0.

Cheers

sderaadt

0
 
LVL 20

Expert Comment

by:Madshi
ID: 2799017
>> 'Types of actual and formal var parameters must be identical'

This error tells you that Delphi wants to have a different type in the GetTimeZoneInformation call.
Please look in "Windows.pas" (or if you don't find it there, in all other units) for the definition "GetTimeZoneInformation". What type is used as the parameter there? I don't have D2 installed anymore, so I can't look myself...

Regards, Madshi.
0
 

Author Comment

by:sderaadt
ID: 2802363
Madshi

Thanks for the help - it appears there was a small typo somewhere in my code, but its working now.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question