Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

InstallDate via RegQueryValueEx

61 views
Skip to first unread message

Larry Bowen

unread,
May 20, 1999, 3:00:00 AM5/20/99
to

I'm trying to display the NT install date in my app. I can get it from
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\InstallDate with RegQueryValueEx, but can't make sense
of the REG_DWORD value. How do I convert the "36bf6044" to something
like 12/12/1998? Thx!


mike ber

unread,
May 21, 1999, 3:00:00 AM5/21/99
to
try to use CDate function, but the number must be much smaller. of course it
includes the time also.
i think that you have to try on real dates and times and see what 's the
number

Larry Bowen wrote in message
<1EA35E87BFDCD2119E820008C7F9E55DB4F7FE@CPECMAILE01>...

Axel Braukmann

unread,
Jul 1, 1999, 3:00:00 AM7/1/99
to
Hello Larry,

i have the same Problem. It looks like the Time format is based on the
1970.01.01 0:00 counting the Seconds to now. So you (and me too) need a
Function to convert this fTime Structur of the Date to the VB Time&Date
Format.

Maybe the Function SystemTimeToVariantTime form the oleaut32.dll may help. I
will try this out ....

Bye
Axel Braukmann


Larry Bowen <La...@BowenAero.com> schrieb in im Newsbeitrag:
1EA35E87BFDCD2119E820008C7F9E55DB4F7FE@CPECMAILE01...

Scott Seligman

unread,
Jul 1, 1999, 3:00:00 AM7/1/99
to
Axel Braukmann <Axel_Br...@Hotmail.com> wrote in message
news:#GnsCD4w#GA....@cppssbbsa02.microsoft.com...

> i have the same Problem. It looks like the Time format is based on the
> 1970.01.01 0:00 counting the Seconds to now. So you (and me too) need a
> Function to convert this fTime Structur of the Date to the VB Time&Date
> Format.
>
> Maybe the Function SystemTimeToVariantTime form the oleaut32.dll may help.
I
> will try this out ....

Will

Debug.Print DateAdd("s", nNumSeconds, #1/1/70#)

Work for you?

--
Scott Seligman <sc...@scottandmichelle.net>
http://www.scottandmichelle.net/scott/code/
Sample code, message forum, and utilities..


Terry Keep

unread,
Jul 1, 1999, 3:00:00 AM7/1/99
to
Well I don't know if it helped Axel out but you solved one of my
problems....


thanks very much.


Scott Seligman wrote in message <#iWNCS8w#GA.306@cppssbbsa04>...

BowenAero.com

unread,
Jul 1, 1999, 3:00:00 AM7/1/99
to
I started this thread. Thanks all you guys, I can finish it too. Here
is the solution I pieced together from various resources I found:

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Get NT Install Date '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
lRetLen = 50
lRetVal = RegOpenKeyEx(lRemReg_HLM _
, "SOFTWARE\Microsoft\Windows NT\CurrentVersion" _
, 0, KEY_READ, lKeyHandle_HLM)
If lRetVal <> SUCCESS Then
'MsgBox "Can't Open Key. Error: " & lRetVal, vbCritical,
"Error!"
lblInstallDate.Caption = BlankVal
Else
lRetValQ = RegQueryValueEx(lKeyHandle_HLM _
, "InstallDate" _
, 0&, REG_DWORD, lRegVal, lRetLen)
If lRetValQ = SUCCESS Then
lRegVal = RegTimeToVbTime(lRegVal)
lblInstallDate.Caption = Format(lRegVal, "short date")
lblInstallDate.ToolTipText = Format(lRegVal, "long
date")
End If
lRetVal = RegCloseKey(lKeyHandle_HCU)
End If

Public Function RegTimeToVbTime(RegDate As Long) As Double
Const BaseDate# = 25569 'DateSerial(1970, 1, 1)
Const SecsPerDay# = 86400
RegTimeToVbTime = BaseDate + (CDbl(RegDate) / SecsPerDay)
End Function

==========================================================
In article <#GnsCD4w#GA....@cppssbbsa02.microsoft.com>,
"Axel Braukmann" <Axel_Br...@Hotmail.com> wrote:
> Hello Larry,


>
> i have the same Problem. It looks like the Time format is based on the
> 1970.01.01 0:00 counting the Seconds to now. So you (and me too) need
a
> Function to convert this fTime Structur of the Date to the VB
Time&Date
> Format.
>
> Maybe the Function SystemTimeToVariantTime form the oleaut32.dll may
help. I
> will try this out ....
>

> Bye
> Axel Braukmann
>
> Larry Bowen <La...@BowenAero.com> schrieb in im Newsbeitrag:
> 1EA35E87BFDCD2119E820008C7F9E55DB4F7FE@CPECMAILE01...
> > I'm trying to display the NT install date in my app. I can get it
from
> > HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
> > NT\CurrentVersion\InstallDate with RegQueryValueEx, but can't make
sense
> > of the REG_DWORD value. How do I convert the "36bf6044" to
something
> > like 12/12/1998? Thx!
> >
>
>

--

-Larry
http://BowenAero.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

0 new messages