Pages

Friday, December 10, 2010

Set Local Computer Time with Powerbuilder

With External Function feature, we can set the Local Computer's time with Powerbuilder.

First, we need to declare the external function, called SetLocalTime from kernel32.dll

FUNCTION long SetLocalTime(ref str_SYSTEMTIME lpSystemTime ) LIBRARY "kernel32.dll" alias for "SetLocalTimeA"

To use the function, just pass a datetime variable when you call the function.

Example:

DataTime dtToday
dtToday = DateTime(Today(),Now())
SetLocalTime(dtToday)

2 comments:

  1. Great post which explains us how we can go for powerbuilding applications

    ReplyDelete
  2. does not work the lpSystemTime must be a structure

    ReplyDelete