hInst  :HINSTANCE 应用程序的实例句柄/
SetTimeZoneInformation VB声明 
Declare Function SetTimeZoneInformation Lib "kernel32" Alias "SetTimeZoneInformation" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long 
说明 
设置系统时区信息 
返回值 
Long,TRUE(非零)表示成功,否则返回零。会设置GetLastError 
参数表 
参数 类型及说明 
lpTimeZoneInformation TIME_ZONE_INFORMATION,要在其中设置当前时区信息的一个结构 
注解 
参考GetTimeZoneInformation 

解决方案 »

  1.   

    hInst  :HINSTANCE 应用程序的实例句柄,你就当一个指向某个程序的指针好了。第二问:SetTimer
    The SetTimer function creates a timer with the specified time-out value. UINT SetTimer(
      HWND hWnd,              // handle of window for timer messages
      UINT nIDEvent,          // timer identifier
      UINT uElapse,           // time-out value
      TIMERPROC lpTimerFunc   // address of timer procedure
    );
     
    Parameters
    hWnd 
    Handle to the window to be associated with the timer. This window must be owned by the calling thread. If this parameter is NULL, no window is associated with the timer and the nIDEvent parameter is ignored. 
    nIDEvent 
    Specifies a nonzero timer identifier. If the hWnd parameter is NULL, this parameter is ignored. 
    uElapse 
    Specifies the time-out value, in milliseconds. 
    lpTimerFunc 
    Pointer to the function to be notified when the time-out value elapses. For more information about the function, see TimerProc. 
    If lpTimerFunc is NULL, the system posts a WM_TIMER message to the application queue. The hwnd member of the message'sMSG structure contains the value of the hWnd parameter. Return Values
    If the function succeeds, the return value is an integer identifying the new timer. An application can pass this value, or the string identifier, if it exists, to the KillTimer function to destroy the timer. If the function fails to create a timer, the return value is zero. To get extended error information, call GetLastError.Res
    An application can process WM_TIMER messages by including a WM_TIMER case statement in the window procedure or by specifying a TimerProc callback function when creating the timer. When you specify a TimerProc callback function, the default window procedure calls the callback function when it processes WM_TIMER. Therefore, you need to dispatch messages in the calling thread, even when you use TimerProc instead of processing WM_TIMER. The wParam parameter of the WM_TIMER message contains the value of the nIDEvent parameter. QuickInfo
      Windows NT: Requires version 3.1 or later.
      Windows: Requires Windows 95 or later.
      Windows CE: Requires version 1.0 or later.
      Header: Declared in winuser.h.
      Import Library: Use user32.lib.See Also
    Timers Overview, Timer Functions, KillTimer,MSG, TimerProc, WM_TIMER 
    TIMERPROC 是个回调函数。
      

  2.   

    hInst  :HINSTANCE 应用程序的实例句柄,多数都是用在api函数中,delphi里很少用的。UINT SetTimer(
      HWND hWnd,              // 程序拥有的窗口handle
      UINT nIDEvent,          // 定时器编号,可以是大于零而小于2的32次方-1的任意整数,对于使用同一个窗口handle的所有定时器来说,编号必须是唯一的
      UINT uElapse,          // 每次触发的间隔时间,单位是毫秒
      TIMERPROC lpTimerFunc  // 触发时所调用的回调函数地址,如果你希望使用窗口消息的触发方式,可以为nil。
    );返回值,如果成功就返回定时器的编号,否则为0。附:深度历险的例子,其中的乱码是big5
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
      Dialogs, ExtCtrls, StdCtrls, MMSystem;type
      TForm1 = class(TForm)
        rgpTimerType: TRadioGroup;
        Panel1: TPanel;
        Label4: TLabel;
        Label5: TLabel;
        txtInterval: TEdit;
        Label1: TLabel;
        txtStopCount: TEdit;
        lblElapsed: TLabel;
        lblCount: TLabel;
        lblError: TLabel;
        btnStart: TButton;
        btnStop: TButton;
        procedure btnStartClick(Sender: TObject);
        procedure btnStopClick(Sender: TObject);
      private
        { Private declarations }
        procedure WMTimer(var message: TWMTimer); message WM_TIMER;
        procedure CommonTimerProc;
      public
        { Public declarations }
      end;
      
    var
      Form1: TForm1;
      
    implementation{$R *.DFM}const
      TimerInterval: DWORD = 10; { 箇砞丁筳丁 10 睝 }
      
    var
      MMTimerID   : Integer; { 纗 MMTimer  ID }
      StartTime   : DWORD;   { 币笆璸竟パ GetTickCount 眔丁 }
      TriggerCount: DWORD;   { 牟祇Ω计 }
      StopCount   : DWORD;   { 璝ぃ 0, 牟祇Ω计笷笆氨ゎ }
      
    procedure TForm1.CommonTimerProc;
    var
      TimeDiff: DWORD; { 龟悔禣丁 }
    begin
      { 璸衡龟悔禣丁 }
      TimeDiff := GetTickCount - StartTime;
      lblElapsed.Caption := 'Time : ' + IntToStr(TimeDiff) + ' ms';
      
      { 仓璸计竟 }
      Inc(TriggerCount);
      lblCount.Caption := 'Count: ' + IntToStr(TriggerCount) + ' times';
      
      { 粇畉 = 龟悔龟悔禣丁 - 璸计竟 * 丁筳丁 }
      lblError.Caption := 'Error: ' + IntToStr(TimeDiff - TriggerCount *
        TimerInterval) + ' ms';
      
      if (StopCount <> 0) and (TriggerCount = StopCount) then
        btnStopClick(btnStop);
    end;procedure TimerProc(Window: HWND; message, idEvent: UINT; dwTime:
        DWORD); stdcall;
    begin
      Form1.CommonTimerProc;
    end;procedure MMTimerProc(uTimerID, uMessage: UINT; dwUser, dw1, dw2:
        DWORD); stdcall;
    begin
      Form1.CommonTimerProc;
    end;procedure TForm1.WMTimer(var message: TWMTimer);
    begin
      CommonTimerProc;
    end;procedure TForm1.btnStartClick(Sender: TObject);
    begin
      TimerInterval := StrToIntDef(txtInterval.Text, 10);
      StopCount := StrToIntDef(txtStopCount.Text, 0);
      
      rgpTimerType.Enabled := False;
      TriggerCount := 0;
      StartTime := GetTickCount;
      
      { 沮匡拒玻ネぃ璸竟 }
      case rgpTimerType.ItemIndex of
        0: SetTimer(Handle, 1, TimerInterval, nil);
        1: SetTimer(Handle, 1, TimerInterval, @TimerProc);
        2: MMTimerID := timeSetEvent(TimerInterval, 0, @MMTimerProc, 0,
          TIME_PERIODIC or TIME_CALLBACK_FUNCTION);
      end;
      
      btnStop.Enabled := True;
    end;procedure TForm1.btnStopClick(Sender: TObject);
    begin
      case rgpTimerType.ItemIndex of
        0..1: KillTimer(Handle, 1);
        2: if MMTimerID <> 0 then timeKillEvent(MMTimerID);
      end;
      
      rgpTimerType.Enabled := True;
      btnStop.Enabled := False;
    end;end.