Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

TIME_ZONE_INFORMATION or TTimeZoneInformation

Posted on 2000-05-09
5
Medium Priority
?
2,006 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 150 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

597 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