Article ID: 113945
Article Last Modified on 10/29/2003
' Enter each of the following Declare statements as one, single line:
Declare Function GetModuleHandle Lib "Kernel" (ByVal Module As String)
As Integer
Declare Function LoadString Lib "User" (ByVal hInst As Integer,
ByVal wID As Integer, ByVal buf As Any, ByVal size As Integer)
As Integer
Sub Command1_Click ()
Dim hInst As Integer
Dim user As String, organization As String, title As String
Dim length As Integer
hInst = GetModuleHandle("user.exe")
' Get user name:
user = Space$(256)
length = LoadString(hInst, 514, user, Len(user))
user = Left$(user, length)
' Get organization:
organization = Space$(256)
length = LoadString(hInst, 515, organization, Len(organization))
organization = Left$(organization, length)
title = "This copy of Windows Registered to:"
MsgBox user & Chr(13) & Chr(10) & organization, , title
End Sub
Additional query words: 3.00 MSJ CodeSampleMSDN
Keywords: KB113945