<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SnippetWare.com &#187; System</title>
	<atom:link href="http://www.snippetware.com/category/vb/system/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.snippetware.com</link>
	<description>Code snippets library</description>
	<lastBuildDate>Fri, 22 Jan 2010 12:04:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Obtain the Regional Settings for the System</title>
		<link>http://www.snippetware.com/2009/10/11/obtain-the-regional-settings-for-the-system/</link>
		<comments>http://www.snippetware.com/2009/10/11/obtain-the-regional-settings-for-the-system/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:59:38 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=255</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/obtain-the-regional-settings-for-the-system/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
Option Explicit
&#039; Locale Class
&#039; obtain the Regional Settings for the System.
&#039; ensure that all displays etc are correct for the country of use
&#039;
&#039; Locale Constants
Private Const LOCALE_SDECIMAL As Long = &amp;HE
Private Const LOCALE_SLONGDATE As Long = &amp;H20
Private Const LOCALE_SSHORTDATE As Long = &amp;H1F
Private Const LOCALE_SCURRENCY As Long = &amp;H14
Private Const LOCALE_STHOUSAND As Long = &amp;HF
Private Const LOCALE_SINTLSYMBOL As Long = &amp;H15
Private Const LOCALE_STIMEFORMAT As Long = &amp;H1003
Private Const LOCALE_SNEGATIVESIGN = &amp;H51
Private Const LOCALE_SPOSITIVESIGN = &amp;H50
Private Const LOCALE_SCOUNTRY As Long = &amp;H6
Private Const LOCALE_SDAYNAME1 As Long = &amp;H2A
Private Const LOCALE_SDAYNAME2 As Long = &amp;H2B
Private Const LOCALE_SDAYNAME3 As Long = &amp;H2C
Private Const LOCALE_SDAYNAME4 As Long = &amp;H2D
Private Const LOCALE_SDAYNAME5 As Long = &amp;H2E
Private Const LOCALE_SDAYNAME6 As Long = &amp;H2F
Private Const LOCALE_SDAYNAME7 As Long = &amp;H30
Private Const LOCALE_SENGCOUNTRY As Long = &amp;H1002
Private Const LOCALE_SENGLANGUAGE As Long = &amp;H1001
Private Const LOCALE_SLANGUAGE As Long = &amp;H2
Private Const LOCALE_SMONTHNAME1 As Long = &amp;H38
Private Const LOCALE_SMONTHNAME10 As Long = &amp;H41
Private Const LOCALE_SMONTHNAME11 As Long = &amp;H42
Private Const LOCALE_SMONTHNAME12 As Long = &amp;H43
Private Const LOCALE_SMONTHNAME2 As Long = &amp;H39
Private Const LOCALE_SMONTHNAME3 As Long = &amp;H3A
Private Const LOCALE_SMONTHNAME4 As Long = &amp;H3B
Private Const LOCALE_SMONTHNAME5 As Long = &amp;H3C
Private Const LOCALE_SMONTHNAME6 As Long = &amp;H3D
Private Const LOCALE_SMONTHNAME7 As Long = &amp;H3E
Private Const LOCALE_SMONTHNAME8 As Long = &amp;H3F
Private Const LOCALE_SMONTHNAME9 As Long = &amp;H40
Private Const LOCALE_SABBREVCTRYNAME = &amp;H7
Private Const LOCALE_SABBREVDAYNAME1 = &amp;H31
Private Const LOCALE_SABBREVDAYNAME3 = &amp;H33
Private Const LOCALE_SABBREVDAYNAME2 = &amp;H32
Private Const LOCALE_SABBREVDAYNAME4 = &amp;H34
Private Const LOCALE_SABBREVDAYNAME5 = &amp;H35
Private Const LOCALE_SABBREVDAYNAME6 = &amp;H36
Private Const LOCALE_SABBREVDAYNAME7 = &amp;H37
Private Const LOCALE_SABBREVLANGNAME = &amp;H3
Private Const LOCALE_SABBREVMONTHNAME1 = &amp;H44
Private Const LOCALE_SABBREVMONTHNAME10 = &amp;H4D
Private Const LOCALE_SABBREVMONTHNAME11 = &amp;H4E
Private Const LOCALE_SABBREVMONTHNAME12 = &amp;H4F
Private Const LOCALE_SABBREVMONTHNAME13 = &amp;H100F
Private Const LOCALE_SABBREVMONTHNAME2 = &amp;H45
Private Const LOCALE_SABBREVMONTHNAME3 = &amp;H46
Private Const LOCALE_SABBREVMONTHNAME4 = &amp;H47
Private Const LOCALE_SABBREVMONTHNAME5 = &amp;H48
Private Const LOCALE_SABBREVMONTHNAME6 = &amp;H49
Private Const LOCALE_SABBREVMONTHNAME7 = &amp;H4A
Private Const LOCALE_SABBREVMONTHNAME8 = &amp;H4B
Private Const LOCALE_SABBREVMONTHNAME9 = &amp;H4C
Private Const LOCALE_SNATIVECTRYNAME = &amp;H8
Private Const LOCALE_SNATIVELANGNAME = &amp;H4
Private Const LOCALE_USER_DEFAULT As Long = &amp;H400

&#039; API Declarations for the Locale Methods
Private Declare Function GetLocaleInfo Lib &quot;kernel32&quot; Alias &quot;GetLocaleInfoA&quot; (ByVal lLocale As Long, ByVal lLocaleType As Long, ByVal sLCData As String, ByVal lBufferLength As Long) As Long
Private Declare Function GetSystemDefaultLangID Lib &quot;kernel32&quot; () As Integer
Private Declare Function VerLanguageName Lib &quot;kernel32&quot; Alias &quot;VerLanguageNameA&quot; (ByVal wLang As Long, ByVal szLang As String, ByVal nSize As Long) As Long
&#039;------------------
&#039; Public Properties
&#039;------------------
Public Property Get DateFormat() As String
    &#039; This function will return the Locale date format for the system. Note that the
    &#039; returned Year is always formatted to &#039;YYYY&#039; regardless, to ensure Y2k compliance.
    On Error GoTo vbErrorHandler
    DateFormat = GetLocaleString(LOCALE_SSHORTDATE)
    &#039; Make sure we always have YYYY format for y2k
    If InStr(1, DateFormat, &quot;YYYY&quot;, vbTextCompare) = 0 Then DateFormat = Replace(DateFormat, &quot;YY&quot;, &quot;YYYY&quot;)
Exit Property
vbErrorHandler:
    Err.Raise Err.Number, &quot;CGLocaleInfo GetDateFormat&quot;, Err.Description
End Property

Public Property Get TimeFormat() As String
    &#039;This function returns the locale&#039;s defined Time Format.
    TimeFormat = Left(GetLocaleString(LOCALE_STIMEFORMAT), <img src='http://www.snippetware.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' />
Exit Property
vbErrorHandler:
    Err.Raise Err.Number, &quot;CGLocaleInfo GetTimeFormat&quot;, Err.Description
End Property

Public Property Get NumberFormat() As String
&#039; This function returns the Locales defined Decimal Number format
    On Error GoTo vbErrorHandler
    NumberFormat = &quot;##&quot; &amp; ThousandSpecifier &amp; &quot;##0&quot; &amp; DecimalSpecifier &amp; &quot;00&quot;
Exit Property
vbErrorHandler:
    NumberFormat = &quot;##,##,0.00&quot; &#039;Set a Default
End Property

Public Property Get ThousandSpecifier() As String
    &#039;This function returns the correct Thousand Specifier for the system Locale
    ThousandSpecifier = GetLocaleString(LOCALE_STHOUSAND)
End Property

Public Property Get DecimalSpecifier() As String
    &#039;This function returns the correct Decimal Specifier for the system Locale
    DecimalSpecifier = GetLocaleString(LOCALE_SDECIMAL)

End Property

Public Property Get CurrencySpecifier() As String
    &#039;This function returns the correct Currency Specifier for the system Locale
    CurrencySpecifier = GetLocaleString(LOCALE_SCURRENCY)
End Property

Public Property Get SysLanguageID() As Long
    &#039;Returns the System Language ID for the machine
    SysLanguageID = GetSystemDefaultLangID
End Property

Public Property Get SysLanguageName() As String
    &#039;Returns the System Language Name eg : English (United Kingdom)
    Dim lLangID As Long
    Dim sBuffer As String
    Dim lBuffSize As Long
    Dim lRet As Long

    On Error GoTo vbErrorHandler

    lLangID = GetSystemDefaultLangID
    &#039;Setup a buffer to receive the settings
    lBuffSize = 50
    sBuffer = String$(lBuffSize, vbNullChar)
    lRet = VerLanguageName(lLangID, sBuffer, lBuffSize)
    If lRet &gt; 0 Then
        SysLanguageName = Left$(sBuffer, lRet)
    End If
Exit Property
vbErrorHandler:
    Err.Raise Err.Number, &quot;CGLocaleInfo GetSysLanguageName&quot;, Err.Description
End Property

Public Property Get Country() As String
    &#039;Returns the Country Name eg. &#039;United Kingdom&#039;
    Country = GetLocaleString(LOCALE_SENGCOUNTRY)
End Property

Public Property Get LanguageName() As String
    &#039;Returns the Native Language Name eg. &#039;English&#039;
    LanguageName = GetLocaleString(LOCALE_SNATIVELANGNAME)
End Property

Public Property Get NativeCountryName() As String
    NativeCountryName = GetLocaleString(LOCALE_SNATIVECTRYNAME)
End Property

Public Property Get PositiveSign() As String
    &#039;Returns the symbol used for the positive sign eg. +
    PositiveSign = GetLocaleString(LOCALE_SPOSITIVESIGN)
End Property

Public Property Get NegativeSign() As String
&#039; Returns the symbol used for the negative sign eg. -
    NegativeSign = GetLocaleString(LOCALE_SNEGATIVESIGN)
End Property

&#039;-----------------
&#039; Public Functions
&#039;-----------------
Public Function DayName(ByVal iDayNum As Integer, Optional Short As Boolean = False) As String
    DayName = IIf(Short, GetLocaleString(LOCALE_SABBREVDAYNAME1 + iDayNum - 1), GetLocaleString(LOCALE_SDAYNAME1 + iDayNum - 1))
End Function

Public Function MonthName(ByVal iMonthNum As Integer, Optional Short As Boolean = False) As String
    MonthName = IIf(Short, GetLocaleString(LOCALE_SABBREVMONTHNAME1 - 1 + iMonthNum), GetLocaleString(LOCALE_SMONTHNAME1 + iMonthNum - 1))
End Function

&#039;------------------
&#039; Private Functions
&#039;------------------
Private Function GetLocaleString(ByVal lLocaleNum As Long) As String
    &#039;Generic routine to get the locale string from the Operating system.
    Dim lBuffSize As String
    Dim sBuffer As String
    Dim lRet As Long

    lBuffSize = 256
    sBuffer = String$(lBuffSize, vbNullChar)

    &#039;Get the information from the registry
    lRet = GetLocaleInfo(LOCALE_USER_DEFAULT, lLocaleNum, sBuffer, lBuffSize)
    &#039;If lRet &gt; 0 then success - lret is the size of the string returned
    If lRet &gt; 0 Then
        GetLocaleString = Left$(sBuffer, lRet - 1)
    End If
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/obtain-the-regional-settings-for-the-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Retrieve various System / Windows Info</title>
		<link>http://www.snippetware.com/2009/10/11/retrieve-various-system-windows-info/</link>
		<comments>http://www.snippetware.com/2009/10/11/retrieve-various-system-windows-info/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:59:06 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=253</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/retrieve-various-system-windows-info/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
Option Explicit

&#039;Windows System Information Constants
Private Const SQL_SUCCESS As Long = 0
Private Const SQL_FETCH_NEXT = 1
Private Const SQL_FETCH_FIRST_SYSTEM = 32

Private Const SECS_PER_DAY As Long = 86000
Private Const MINS_PER_DAY As Long = 1400

&#039;Enumerated Types
Public Enum ControlPanelTypes
    cplSystem = 1
    cplInternet = 2
    cplModem = 3
    cplSoftware = 4
    cplHardware = 5
    cplSounds = 6
    cplNetwork = 7
    cplMouse = 8
    cplKeyboard = 9
    cplDateTime = 10
    cplRegional = 11
    cplPassword = 12
    cplDisplay = 13
End Enum

Public Enum DIR_TYPE
    dirWINDOWS
    dirSYSTEM
    dirTEMP
End Enum

Public Enum DRIVE_TYPE
    DRIVE_DOESNT_EXIST = 1
    DRIVE_REMOVABLE = 2
    DRIVE_FIXED = 3
    DRIVE_REMOTE = 4
    DRIVE_CDROM = 5
    DRIVE_RAMDISK = 6
End Enum

Public Enum enStockIcons
    IDI_APPLICATION = 32512&amp;
    IDI_ASTERISK = 32516&amp;
    IDI_EXCLAMATION = 32515&amp;
    IDI_HAND = 32513&amp;   &#039;This is the STOP icon
    IDI_QUESTION = 32514&amp;
End Enum

Public Enum OS_VERSION
    OS_WINDOWS_UNKNOWN
    OS_WINDOWS_3X
    OS_WINDOWS_95
    OS_WINDOWS_98
    OS_WINDOWS_NT3X
    OS_WINDOWS_NT40
    OS_WINDOWS_2000
End Enum

Private Type OSVERSIONINFOEX
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Private Type MEMORYSTATUS
    dwLength As Long
    dwMemoryLoad As Long
    dwTotalPhys As Long
    dwAvailPhys As Long
    dwTotalPageFile As Long
    dwAvailPageFile As Long
    dwTotalVirtual As Long
    dwAvailVirtual As Long
End Type

Public Enum ShutdownType
    Logoff = 0
    ByeBye = 1
    Reboot = 2
End Enum

Private Const VER_PLATFORM_WIN32s = 0
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Private Const VER_PLATFORM_WIN32_NT = 2

Private Const BITSPIXEL = 12
Private Const PLANES = 14

&#039; API Declarations for the Locale Methods
Private Declare Sub GlobalMemoryStatus Lib &quot;kernel32&quot; (lpBuffer As MEMORYSTATUS)
&#039;API Functions
Private Declare Function DrawIconApi Lib &quot;user32&quot; Alias &quot;DrawIcon&quot; (ByVal HDC As Long, ByVal x As Long, ByVal Y As Long, ByVal hIcon As Long) As Long
Private Declare Function ExitWindowsEx Lib &quot;user32&quot; (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long
Private Declare Function FreeLibrary Lib &quot;kernel32&quot; (ByVal hLibModule As Long) As Long
Private Declare Function GetComputerName Lib &quot;kernel32&quot; Alias &quot;GetComputerNameA&quot; (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetDeviceCaps Lib &quot;gdi32&quot; (ByVal HDC As Long, ByVal nIndex As Long) As Long
Private Declare Function GetDiskFreeSpace Lib &quot;kernel32&quot; Alias &quot;GetDiskFreeSpaceA&quot; (ByVal lpRootPathName As String, lpSectorsPerCluster As Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As Long, lpTotalNumberOfClusters As Long) As Long
Private Declare Function GetDriveType Lib &quot;kernel32&quot; Alias &quot;GetDriveTypeA&quot; (ByVal nDrive As String) As Long
Private Declare Function GetProcAddress Lib &quot;kernel32&quot; (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare Function GetSystemDirectory Lib &quot;kernel32&quot; Alias &quot;GetSystemDirectoryA&quot; (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetTickCount Lib &quot;kernel32.dll&quot; () As Long
Private Declare Function GetTempPath Lib &quot;kernel32&quot; Alias &quot;GetTempPathA&quot; (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Declare Function GetUserName Lib &quot;advapi32.dll&quot; Alias &quot;GetUserNameA&quot; (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetVersionEx Lib &quot;kernel32&quot; Alias &quot;GetVersionExA&quot; (lpVersionInformation As OSVERSIONINFOEX) As Long
Private Declare Function GetVolumeInformation Lib &quot;kernel32&quot; Alias &quot;GetVolumeInformationA&quot; (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
Private Declare Function GetWindowsDirectory Lib &quot;kernel32&quot; Alias &quot;GetWindowsDirectoryA&quot; (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function InternetGetConnectedState Lib &quot;wininet.dll&quot; (ByRef lpSFlags As Long, ByVal dwReserved As Long) As Long
Private Declare Function LoadIconApi Lib &quot;user32&quot; Alias &quot;LoadIconA&quot; (ByVal hInstance As Long, ByVal lpIconName As Long) As Long
Private Declare Function LoadLibrary Lib &quot;kernel32&quot; Alias &quot;LoadLibraryA&quot; (ByVal lpLibFileName As String) As Long
Private Declare Function ShellAbout Lib &quot;shell32.dll&quot; Alias &quot;ShellAboutA&quot; (ByVal hWnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long
Private Declare Function SQLAllocEnv Lib &quot;odbc32.dll&quot; (phenv As Long) As Integer
Private Declare Function SQLDataSources Lib &quot;odbc32.dll&quot; (ByVal hEnv As Long, ByVal fDirection As Integer, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN As Integer, ByVal szDescription As String, ByVal cbDescriptionMax As Integer, pcbDescription As Integer) As Integer
Private Declare Function SQLFreeEnv Lib &quot;odbc32.dll&quot; (ByVal hEnv As Long) As Integer
Private Declare Function waveOutGetNumDevs Lib &quot;winmm.dll&quot; () As Long

Private pUdtOSVersion As OSVERSIONINFOEX
Private pUdtMemStatus As MEMORYSTATUS

Private plMajorVersion  As Long
Private plMinorVersion As Long
Private plPlatformID As Long

Private psComputerName As String
Private plLastDllError As Long

&#039;-----------------
&#039;Public Properties
&#039;-----------------
Public Property Get Name() As String
    Dim sBuffer As String
    Dim lAns As Long

    plLastDllError = 0
    sBuffer = Space$(255)
    lAns = GetComputerName(sBuffer, 255)
    If lAns &lt;&gt; 0 Then
        &#039;read from beginning of string to null-terminator
        Name = Left$(sBuffer, InStr(sBuffer, Chr(0)) - 1)
    Else
        plLastDllError = Err.LastDllError
    End If
End Property

Public Property Get CurrentUser() As String
    Dim l As Long
    Dim sUser As String

    plLastDllError = 0
    sUser = Space(255)
    l = GetUserName(sUser, 255)
    &#039;strip null terminator
    If l &lt;&gt; 0 Then
        CurrentUser = Left(sUser, InStr(sUser, Chr(0)) - 1)
    Else
        plLastDllError = Err.LastDllError
    End If
End Property

Public Property Get MaxScreenColors() As Double
    &#039;Returns the maximum number of colors supported
    &#039;by the system - e.g.,  256, 16,777,216
    Dim lngBits As Long
    Dim lngPlanes As Long
    Dim lwndHandle As Long
    Dim dblAns As Double
    plLastDllError = 0
    lwndHandle = Form1.HDC
    &#039;bits per pixel
    lngBits = GetDeviceCaps(lwndHandle, BITSPIXEL)
    &#039;number of color planes
    lngPlanes = GetDeviceCaps(lwndHandle, PLANES)
    &#039;maximum colors available
    MaxScreenColors = (2 ^ (lngBits * lngPlanes))
    plLastDllError = Err.LastDllError
End Property

Public Property Get OSVersion() As OS_VERSION
    On Error GoTo ErrorHandler

    plLastDllError = 0
    Select Case plMajorVersion
        Case 5: OSVersion = OS_WINDOWS_2000 &#039;UNTESTED
        Case 4
            If plPlatformID = VER_PLATFORM_WIN32_NT Then
                OSVersion = OS_WINDOWS_NT40
            Else
                OSVersion = IIf(plMinorVersion = 0, OS_WINDOWS_95, OS_WINDOWS_98)
            End If
        Case 3
            If plPlatformID = VER_PLATFORM_WIN32s Then
                OSVersion = OS_WINDOWS_3X
            ElseIf plPlatformID = VER_PLATFORM_WIN32_NT Then
                OSVersion = OS_WINDOWS_NT40
            End If
        Case Else:  OSVersion = OS_WINDOWS_UNKNOWN
    End Select
Exit Property
ErrorHandler:
    OSVersion = OS_WINDOWS_UNKNOWN
    plLastDllError = Err.LastDllError
End Property

Public Property Get ScreenPixelWidth() As Integer
    plLastDllError = 0
    ScreenPixelWidth = Screen.Width \ Screen.TwipsPerPixelX
End Property

Public Property Get ScreenPixelHeight() As Integer
    plLastDllError = 0
    ScreenPixelHeight = Screen.Height \ Screen.TwipsPerPixelY
End Property

Public Property Get ScreenResolution() As String
    plLastDllError = 0
    ScreenResolution = ScreenPixelWidth &amp; &quot;x&quot; &amp; ScreenPixelHeight
End Property

Public Property Get SystemErrorCode() As Long
    SystemErrorCode = plLastDllError
End Property

Public Property Get SoundCard() As Boolean
     SoundCard = waveOutGetNumDevs &gt; 0
End Property
&#039;----------------
&#039;Public Functions
&#039;----------------
Public Function AboutBox(Optional hWndA As Long = -1, Optional Copyright As String, Optional ProductInfo As String, Optional Icon As Long = 0)
    If Len(Copyright) = 0 Then Copyright = Common.Version() &amp; &quot;#&quot; &amp; App.ProductName
    If Len(ProductInfo) = 0 Then
        If Len(App.LegalTrademarks) &gt; 0 And Len(App.CompanyName) &gt; 0 Then
            ProductInfo = App.LegalTrademarks
            ProductInfo = ProductInfo &amp; &quot; are legal trademarks of &quot;
            ProductInfo = ProductInfo &amp; App.CompanyName
        Else
            ProductInfo = ProjectName
            ProductInfo = ProductInfo &amp; &quot; is a legal trademark of &quot;
            ProductInfo = ProductInfo &amp; IIf(Len(App.CompanyName) &gt; 0, App.CompanyName, &quot;FailSafe Systems&quot;)
        End If
    End If
    Call ShellAbout(hWndA, Copyright, ProductInfo, Icon)
End Function

Public Function APIFunctionPresent(ByVal FunctionName As String, ByVal DLLName As String) As Boolean
    &#039;USAGE: Dim bAvail as boolean
    &#039;       bAvail = APIFunctionPresent(&quot;GetDiskFreeSpaceExA&quot;, &quot;kernel32&quot;)
    Dim lHandle As Long
    Dim lAddr  As Long
    lHandle = LoadLibrary(DLLName)
    If lHandle &lt;&gt; 0 Then
        lAddr = GetProcAddress(lHandle, FunctionName)
        FreeLibrary lHandle
    End If
    APIFunctionPresent = (lAddr &lt;&gt; 0)
End Function

Public Sub CascadeWindows()
&#039; TODO:
&#039;    Dim objShell As New Shell32.Shell
&#039;    objShell.CascadeWindows
&#039;    Set objShell = Nothing
End Sub

Public Function ControlPanel(Setting As ControlPanelTypes) As Long
    Dim lPanel As String
    Select Case Setting
        Case cplSoftware:   lPanel = &quot;appwiz.cpl,,1&quot;
        Case cplHardware:   lPanel = &quot;sysdm.cpl @1&quot;
        Case cplInternet:   lPanel = &quot;inetcpl.cpl,,0&quot;
        Case cplKeyboard:   lPanel = &quot;main.cpl @1&quot;
        Case cplModem:      lPanel = &quot;modem.cpl&quot;
        Case cplMouse:      lPanel = &quot;main.cpl @0&quot;
        Case cplNetwork:    lPanel = &quot;netcpl.cpl&quot;
        Case cplSounds:     lPanel = &quot;mmsys.cpl @1&quot;
        Case cplSystem:     lPanel = &quot;sysdm.cpl,,0&quot;
        Case cplDisplay:    lPanel = &quot;desk.cpl,,0&quot;
        Case cplPassword:   lPanel = &quot;password.cpl&quot;
        Case cplRegional:   lPanel = &quot;intl.cpl,,0&quot;
        Case cplDateTime:   lPanel = &quot;timedate.cpl&quot;
    End Select
    If Len(lPanel) &gt; 0 Then ControlPanel = Shell(&quot;rundll32.exe shell32.dll,Control_RunDLL &quot; &amp; lPanel, 5)
    plLastDllError = Err.LastDllError
End Function

Public Function Directory(WhichDir As DIR_TYPE) As String
    Dim Temp As String
    Dim Ret As Long
    Const MAX_LENGTH = 255

    Temp = String$(MAX_LENGTH, 0)
    Select Case WhichDir
        Case dirWINDOWS:    Ret = GetWindowsDirectory(Temp, MAX_LENGTH)
        Case dirSYSTEM:     Ret = GetSystemDirectory(Temp, MAX_LENGTH)
        Case dirTEMP:       Ret = GetTempPath(Len(Temp), Temp)
        Case Else:          Ret = 0: Temp = &quot;&quot;
    End Select
    Directory = PathCheck(Left$(Temp, Ret))
End Function

Public Function DriveMBFree(Optional Drive As String = &quot;C:\&quot;) As Double
    &#039;some time in the future disk may be to large to calculate
    &#039;like this so resume next on any errors
    On Error Resume Next

    Dim lAns As Long
    Dim lSectorsPerCluster As Long
    Dim lBytesPerSector As Long

    Dim lFreeClusters As Long
    Dim lTotalClusters As Long
    Dim lBytesPerCluster As Long
    Dim lFreeBytes As Double

    &#039;fix bad parameter values
    If Len(Drive) = 1 Then Drive = Drive &amp; &quot;:\&quot;
    If Len(Drive) = 2 And Right$(Drive, 1) = &quot;:&quot; Then Drive = Drive &amp; &quot;\&quot;

    lAns = GetDiskFreeSpace(Drive, lSectorsPerCluster, lBytesPerSector, lFreeClusters, lTotalClusters)
    lBytesPerCluster = lSectorsPerCluster * lBytesPerSector

    DriveMBFree = ((lBytesPerCluster / 1024) / 1024) * lFreeClusters
    DriveMBFree = Format(DriveMBFree, &quot;###,###,##0.00&quot;)
End Function

Public Function DriveMBSize(Optional Drive As String = &quot;C:\&quot;) As Double
    &#039;some time in the future disk may be to large to calculate
    &#039;like this so resume next on any errors
    On Error Resume Next

    Dim lAns As Long
    Dim lSectorsPerCluster As Long
    Dim lBytesPerSector As Long

    Dim lFreeClusters As Long
    Dim lTotalClusters As Long
    Dim lBytesPerCluster As Long
    Dim lTotalBytes As Double

    &#039;fix bad parameter values
    If Len(Drive) = 1 Then Drive = Drive &amp; &quot;:\&quot;
    If Len(Drive) = 2 And Right$(Drive, 1) = &quot;:&quot; Then Drive = Drive &amp; &quot;\&quot;

    lAns = GetDiskFreeSpace(Drive, lSectorsPerCluster, lBytesPerSector, lFreeClusters, lTotalClusters)
    lBytesPerCluster = lSectorsPerCluster * lBytesPerSector

    DriveMBSize = ((lBytesPerCluster / 1024) / 1024) * lTotalClusters
    DriveMBSize = Format(DriveMBSize, &quot;###,###,##0.00&quot;)
End Function

Public Function DriveName(Optional Drive As String = &quot;C:\&quot;)
    Dim sBuffer As String

    plLastDllError = 0
    sBuffer = Space$(255)
    &#039;fix bad parameter values
    If Len(Drive) = 1 Then Drive = Drive &amp; &quot;:\&quot;
    If Len(Drive) = 2 And Right$(Drive, 1) = &quot;:&quot; Then Drive = Drive &amp; &quot;\&quot;
    If GetVolumeInformation(Drive, sBuffer, Len(sBuffer), 0, 0, 0, Space$(255), 255) = 0 Then
        plLastDllError = Err.LastDllError
    Else
        DriveName = Left$(sBuffer, InStr(sBuffer, Chr$(0)) - 1)
    End If
End Function

Public Function DriveType(Drive As String) As DRIVE_TYPE
    &#039;fix bad parameter values
    DriveType = DRIVE_DOESNT_EXIST
    plLastDllError = 0
    Drive = IIf(Len(Drive) = 1, Drive &amp; &quot;:&quot;, Drive)
    If Len(Drive) = 1 Then Drive = Drive &amp; &quot;:\&quot;
    If Len(Drive) = 2 And Right$(Drive, 1) = &quot;:&quot; Then Drive = Drive &amp; &quot;\&quot;
    Drive = PathCheck(Drive)
    DriveType = GetDriveType(Drive)
    plLastDllError = Err.LastDllError
End Function

Public Sub DSNs(DSNArray() As String)
    &#039;POPULATES DSNARRAY WITH ALL DSNs installed on the system,
    &#039;in the form of &quot;DSN | DRIVER&quot;
    &#039;USAGE:
    &#039;Dim asDSNArray() As String
    &#039;Dim iCtr As Integer
    &#039;SystemDSNs asDSNArray
    &#039;For iCtr = 0 To UBound(asDSNArray)
    &#039;     Debug.Print asDSNArray(iCtr)
    &#039;Next
    Dim iRet As Integer
    Dim sDSN As String
    Dim sDriver As String
    Dim iDSNLen As Integer
    Dim iDriverLen As Integer
    ReDim DSNArray(0) As String
    Dim lEnvHandle As Long

    iRet = SQLAllocEnv(lEnvHandle)
    sDSN = Space(1024)
    sDriver = Space(1024)
    iRet = SQLDataSources(lEnvHandle, SQL_FETCH_FIRST_SYSTEM, sDSN, 1024, iDSNLen, sDriver, 1024, iDriverLen)

    If iRet = SQL_SUCCESS Then
        sDSN = Mid(sDSN, 1, iDSNLen)
        sDriver = Mid(sDriver, 1, iDriverLen)
        DSNArray(0) = sDSN &amp; &quot; | &quot; &amp; sDriver
        Do Until iRet &lt;&gt; SQL_SUCCESS
            sDSN = Space(1024)
            sDriver = Space(1024)
            iRet = SQLDataSources(lEnvHandle, SQL_FETCH_NEXT, sDSN, 1024, iDSNLen, sDriver, 1024, iDriverLen)
            If Trim(sDSN) &lt;&gt; &quot;&quot; Then
                sDSN = Mid(sDSN, 1, iDSNLen)
                sDriver = Mid(sDriver, 1, iDriverLen)
                ReDim Preserve DSNArray(UBound(DSNArray) + 1)
                DSNArray(UBound(DSNArray)) = sDSN &amp; &quot; | &quot; &amp; sDriver
            End If
       Loop
    End If
    iRet = SQLFreeEnv(lEnvHandle)
End Sub

Public Function IsConnectedToInternet(Optional ConnectMode As Integer) As Boolean
    Dim flags As Long
    IsConnectedToInternet = InternetGetConnectedState(flags, 0) &#039; this ASPI function does it all
    ConnectMode = flags                                         &#039; return the flag through the optional argument
End Function

Public Function MemoryAvailable() As Double
    &#039;Return Value in Megabytes
     MemoryAvailable = MemoryAvailablePhysical + MemoryPageFile
End Function

Public Function MemoryAvailablePhysical() As Double
    &#039;Return Value in Megabytes
    Dim dblAns As Double
    plLastDllError = 0
    GlobalMemoryStatus pUdtMemStatus
    dblAns = pUdtMemStatus.dwAvailPhys
    MemoryAvailablePhysical = BytesToMegabytes(dblAns)
    plLastDllError = Err.LastDllError
End Function

Public Function MemoryInTotal() As Double
    &#039;Return Value in Megabytes
    MemoryInTotal = MemoryPageFileSize + MemoryTotalPhysical
End Function

Public Function MemoryPageFile() As Double
    &#039;Return Value in Megabytes
    Dim dblAns As Double

    plLastDllError = 0
    GlobalMemoryStatus pUdtMemStatus
    dblAns = pUdtMemStatus.dwAvailPageFile
    MemoryPageFile = BytesToMegabytes(dblAns)
    plLastDllError = Err.LastDllError
End Function

Public Function MemoryPageFileSize() As Double
    &#039;Return Value in Megabytes
    Dim dblAns As Double

    plLastDllError = 0
    GlobalMemoryStatus pUdtMemStatus
    dblAns = pUdtMemStatus.dwTotalPageFile
    MemoryPageFileSize = BytesToMegabytes(dblAns)
    plLastDllError = Err.LastDllError
End Function

Public Function MemoryPercentFree() As Double
    MemoryPercentFree = Format(MemoryAvailable / MemoryInTotal * 100, &quot;0#&quot;)
End Function

Public Function MemoryTotalPhysical() As Double
    &#039;Return Value in Megabytes
    Dim dblAns As Double
    plLastDllError = 0
    GlobalMemoryStatus pUdtMemStatus
    dblAns = pUdtMemStatus.dwTotalPhys
    MemoryTotalPhysical = BytesToMegabytes(dblAns)
    plLastDllError = Err.LastDllError
End Function

Public Function Running(Optional InSeconds As Boolean = False) As Double
    Running = SECS_PER_DAY * (GetTickCount / 1000 / 60 / 60 / 24)
    Running = IIf(InSeconds, Round(Running, 2), Round(Running / 3600, 2))
End Function

Public Function ShutDown(ExitType As ShutdownType) As Long
    ShutDown = ExitWindowsEx(ExitType, 0&amp;)
End Function

Public Function Started() As Date
    Dim dTicks     As Double
    &#039;Store the number of days the systems has been running
    dTicks = GetTickCount / 1000 / 60 / 60 / 24
    Started = Now() - dTicks
End Function

&#039;-----------------
&#039;Private Functions
&#039;-----------------
Private Function BytesToMegabytes(bytes As Double) As Double
  Dim dblAns As Double
  dblAns = (bytes / 1024) / 1024
  BytesToMegabytes = Format(dblAns, &quot;###,###,##0.00&quot;)
End Function

Private Function FreeBytesOnDisk(Drive As String) As Long
    On Error Resume Next
    plLastDllError = 0

    Dim lAns As Long
    Dim lSectorsPerCluster As Long
    Dim lBytesPerSector As Long

    Dim lFreeClusters As Long
    Dim lTotalClusters As Long
    Dim lBytesPerCluster As Long
    Dim lFreeBytes As Double

    lAns = GetDiskFreeSpace(Drive, lSectorsPerCluster, lBytesPerSector, lFreeClusters, lTotalClusters)
    lBytesPerCluster = lSectorsPerCluster * lBytesPerSector
    lFreeBytes = lBytesPerCluster * lFreeClusters
    FreeBytesOnDisk = lFreeBytes
    plLastDllError = Err.LastDllError
End Function

Private Function PathCheck(ByVal PathName As String, Optional AltDelimiter As String = &quot;&quot;) As String
    If Len(PathName) = 0 Then Exit Function
    Dim Delimiter As String
    Delimiter = IIf(InStr(PathName, &quot;/&quot;), &quot;/&quot;, &quot;\&quot;)
    PathCheck = IIf(Right$(PathName, 1) = Delimiter, PathName, PathName &amp; Delimiter)
    PathCheck = IIf(Len(AltDelimiter) = 0, PathCheck, Replace(PathCheck, Delimiter, AltDelimiter))
End Function

Private Function TotalBytesOnDisk(Drive As String) As Double
    On Error Resume Next
    plLastDllError = 0
    Dim lAns As Long
    Dim lSectorsPerCluster As Long
    Dim lBytesPerSector As Long

    Dim lFreeClusters As Long
    Dim lTotalClusters As Long
    Dim lBytesPerCluster As Long
    Dim lTotalBytes As Double

    lAns = GetDiskFreeSpace(Drive, lSectorsPerCluster, lBytesPerSector, lFreeClusters, lTotalClusters)
    lBytesPerCluster = lSectorsPerCluster * lBytesPerSector
    &#039;dblAns = (Bytes / 1024) / 1024
    TotalBytesOnDisk = lBytesPerCluster * lTotalClusters
    If TotalBytesOnDisk = 0 Then
        TotalBytesOnDisk = ((lBytesPerCluster / 1024) / 1024) * lTotalClusters
    End If
    plLastDllError = Err.LastDllError
End Function

Public Function LoadSystemIcon(ByVal StockIcon As enStockIcons) As Long
    On Error Resume Next
    LoadSystemIcon = LoadIconApi(0, StockIcon)
End Function

Public Sub DrawIcon(ByVal HDC As Long, ByVal xPos As Long, ByVal yPos As Long, ByVal Icon As Long)
    Dim lRet As Long
    lRet = DrawIconApi(HDC, xPos, yPos, Icon)
    If (Err.LastDllError &gt; 0) Or (lRet = 0) Then Debug.Print &quot;DrawIcon failed&quot;
End Sub
&#039;use:

&#039;---------------------
&#039; Class Initialization
&#039;---------------------
Private Sub Class_Initialize()
    pUdtOSVersion.dwOSVersionInfoSize = Len(pUdtOSVersion)
    GetVersionEx pUdtOSVersion
    plMajorVersion = pUdtOSVersion.dwMajorVersion
    plMinorVersion = pUdtOSVersion.dwMinorVersion
    plPlatformID = pUdtOSVersion.dwPlatformId
End Sub

Private Sub Class_Terminate()
    &#039;
End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/retrieve-various-system-windows-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display Windows Accessability Properties Dialog</title>
		<link>http://www.snippetware.com/2009/10/11/display-windows-accessability-properties-dialog/</link>
		<comments>http://www.snippetware.com/2009/10/11/display-windows-accessability-properties-dialog/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:58:44 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=251</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/display-windows-accessability-properties-dialog/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
&#039; -------
&#039; Code
&#039; -------

Sub AccessabilityDialog_Keyboard()
    &#039; Launch Accessability Properties Dialog (Keyboard Tab)

    Dim dblReturn As Double
    dblReturn = Shell(&quot;rundll32.exe shell32.dll,Control_RunDLL access.cpl,,1&quot;, 1)
End Sub

&#039; ================================================================= &#039;

Sub AccessabilityDialog_Sound()
    &#039; Launch Accessability Properties Dialog (Sound Tab)

    Dim dblReturn As Double
    dblReturn = Shell(&quot;rundll32.exe shell32.dll,Control_RunDLL access.cpl,,2&quot;, 1)
End Sub

&#039; ================================================================= &#039;

Sub AccessabilityDialog_Display()
    &#039; Launch Accessability Properties Dialog (Display Tab)

    Dim dblReturn As Double
    dblReturn = Shell(&quot;rundll32.exe shell32.dll,Control_RunDLL access.cpl,,3&quot;, 1)
End Sub

&#039; ================================================================= &#039;

Sub AccessabilityDialog_Mouse()
    &#039; Launch Accessability Properties Dialog (Mouse Tab)

    Dim dblReturn As Double
    dblReturn = Shell(&quot;rundll32.exe shell32.dll,Control_RunDLL access.cpl,,4&quot;, 1)
End Sub

&#039; ================================================================= &#039;

Sub AccessabilityDialog_General()
    &#039; Launch Accessability Properties Dialog (General Tab)

    Dim dblReturn As Double
    dblReturn = Shell(&quot;rundll32.exe shell32.dll,Control_RunDLL access.cpl,,5&quot;, 1)
End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/display-windows-accessability-properties-dialog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detect Windows NT</title>
		<link>http://www.snippetware.com/2009/10/11/detect-windows-nt/</link>
		<comments>http://www.snippetware.com/2009/10/11/detect-windows-nt/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:58:13 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=249</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/detect-windows-nt/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
&#039;-----------------------------------------------------------
&#039; FUNCTION: IsWindowsNT
&#039;
&#039; Returns true if this program is running under Windows NT
&#039;-----------------------------------------------------------
&#039;
Function IsWindowsNT() As Boolean
    Const dwMaskNT = &amp;H2&amp;
    IsWindowsNT = (GetWinPlatform() And dwMaskNT)
End Function

&#039;-----------------------------------------------------------
&#039; FUNCTION: IsWindowsNT4WithoutSP2
&#039;
&#039; Determines if the user is running under Windows NT 4.0
&#039; but without Service Pack 2 (SP2).  If running under any
&#039; other platform, returns False.
&#039;
&#039; IN: [none]
&#039;
&#039; Returns: True if and only if running under Windows NT 4.0
&#039; without at least Service Pack 2 installed.
&#039;-----------------------------------------------------------
&#039;
Function IsWindowsNT4WithoutSP2() As Boolean
    IsWindowsNT4WithoutSP2 = False

    If Not IsWindowsNT() Then
        Exit Function
    End If

    Dim osvi As OSVERSIONINFO
    Dim strCSDVersion As String
    osvi.dwOSVersionInfoSize = Len(osvi)
    If GetVersionEx(osvi) = 0 Then
        Exit Function
    End If
    strCSDVersion = StripTerminator(osvi.szCSDVersion)

    &#039;Is this Windows NT 4.0?
    Const NT4MajorVersion = 4
    Const NT4MinorVersion = 0
    If (osvi.dwMajorVersion &lt;&gt; NT4MajorVersion) Or (osvi.dwMinorVersion &lt;&gt; NT4MinorVersion) Then
        &#039;No.  Return False.
        Exit Function
    End If

    &#039;If no service pack is installed, or if Service Pack 1 is
    &#039;installed, then return True.
    Const strSP1 = &quot;SERVICE PACK 1&quot;
    If strCSDVersion = &quot;&quot; Then
        IsWindowsNT4WithoutSP2 = True &#039;No service pack installed
    ElseIf strCSDVersion = strSP1 Then
        IsWindowsNT4WithoutSP2 = True &#039;Only SP1 installed
    End If
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/detect-windows-nt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detect Windows 95</title>
		<link>http://www.snippetware.com/2009/10/11/detect-windows-95/</link>
		<comments>http://www.snippetware.com/2009/10/11/detect-windows-95/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:57:52 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=247</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/detect-windows-95/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
&#039;-----------------------------------------------------------
&#039; FUNCTION: IsWindows95
&#039;
&#039; Returns true if this program is running under Windows 95
&#039;   or successor
&#039;-----------------------------------------------------------
&#039;
Function IsWindows95() As Boolean
    Const dwMask95 = &amp;H1&amp;
    IsWindows95 = (GetWinPlatform() And dwMask95)
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/detect-windows-95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the current windows platform</title>
		<link>http://www.snippetware.com/2009/10/11/get-the-current-windows-platform/</link>
		<comments>http://www.snippetware.com/2009/10/11/get-the-current-windows-platform/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:57:18 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=245</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/get-the-current-windows-platform/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
&#039;----------------------------------------------------------
&#039; FUNCTION: GetWinPlatform
&#039; Get the current windows platform.
&#039; ---------------------------------------------------------
Public Function GetWinPlatform() As Long
    Dim osvi As OSVERSIONINFO
    Dim strCSDVersion As String

    osvi.dwOSVersionInfoSize = Len(osvi)

    If GetVersionEx(osvi) = 0 Then
        Exit Function
    End If

    GetWinPlatform = osvi.dwPlatformId
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/get-the-current-windows-platform/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable / Enable Ctrl + Alt + Del, Alt + Tab, And Ctrl + Esc</title>
		<link>http://www.snippetware.com/2009/10/11/disable-enable-ctrl-alt-del-alt-tab-and-ctrl-esc/</link>
		<comments>http://www.snippetware.com/2009/10/11/disable-enable-ctrl-alt-del-alt-tab-and-ctrl-esc/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:56:55 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=243</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/disable-enable-ctrl-alt-del-alt-tab-and-ctrl-esc/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
Option Explicit

&#039; ----------------------------
&#039; Constants &amp; API Declarations
&#039; ----------------------------

Private Declare Function SystemParametersInfo Lib &quot;user32&quot; Alias &quot;SystemParametersInfoA&quot; (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long

Private Const SPI_SCREENSAVERRUNNING = 97

&#039; ---------------
&#039; Function
&#039; ---------------

Sub Change_TaskView(Enable As Boolean)
    Dim eTask As Integer
    Dim junk As Boolean

    eTask = SystemParametersInfo(SPI_SCREENSAVERRUNNING, Not Enable, junk, 0)
End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/disable-enable-ctrl-alt-del-alt-tab-and-ctrl-esc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create File Association</title>
		<link>http://www.snippetware.com/2009/10/11/create-file-association/</link>
		<comments>http://www.snippetware.com/2009/10/11/create-file-association/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:56:22 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=241</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/create-file-association/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
&#039; ---------------
&#039; How to use :
&#039;
&#039; Call CreateAssociation() to create file association
&#039; ---------------

Option Explicit

&#039;// Windows Registry Messages
Private Const REG_SZ As Long = 1
Private Const REG_DWORD As Long = 4
Private Const HKEY_CLASSES_ROOT = &amp;H80000000
Private Const HKEY_CURRENT_USER = &amp;H80000001
Private Const HKEY_LOCAL_MACHINE = &amp;H80000002
Private Const HKEY_USERS = &amp;H80000003

&#039;// Windows Error Messages
Private Const ERROR_NONE = 0
Private Const ERROR_BADDB = 1
Private Const ERROR_BADKEY = 2
Private Const ERROR_CANTOPEN = 3
Private Const ERROR_CANTREAD = 4
Private Const ERROR_CANTWRITE = 5
Private Const ERROR_OUTOFMEMORY = 6
Private Const ERROR_INVALID_PARAMETER = 7
Private Const ERROR_ACCESS_DENIED = 8
Private Const ERROR_INVALID_PARAMETERS = 87
Private Const ERROR_NO_MORE_ITEMS = 259

&#039;// Windows Security Messages
Private Const KEY_ALL_ACCESS = &amp;H3F
Private Const REG_OPTION_NON_VOLATILE = 0

&#039;// Windows Registry API calls
Private Declare Function RegCloseKey Lib &quot;advapi32.dll&quot; _
 (ByVal hKey As Long) As Long

Private Declare Function RegCreateKeyEx _
  Lib &quot;advapi32.dll&quot; Alias &quot;RegCreateKeyExA&quot; _
 (ByVal hKey As Long, _
  ByVal lpSubKey As String, _
  ByVal Reserved As Long, _
  ByVal lpClass As String, _
  ByVal dwOptions As Long, _
  ByVal samDesired As Long, _
  ByVal lpSecurityAttributes As Long, _
  phkResult As Long, _
  lpdwDisposition As Long) As Long

Private Declare Function RegOpenKeyEx _
  Lib &quot;advapi32.dll&quot; Alias &quot;RegOpenKeyExA&quot; _
 (ByVal hKey As Long, _
  ByVal lpSubKey As String, _
  ByVal ulOptions As Long, _
  ByVal samDesired As Long, _
  phkResult As Long) As Long

Private Declare Function RegSetValueExString _
  Lib &quot;advapi32.dll&quot; Alias &quot;RegSetValueExA&quot; _
 (ByVal hKey As Long, _
  ByVal lpValueName As String, _
  ByVal Reserved As Long, _
  ByVal dwType As Long, _
  ByVal lpValue As String, _
  ByVal cbData As Long) As Long

Private Declare Function RegSetValueExLong _
  Lib &quot;advapi32.dll&quot; Alias &quot;RegSetValueExA&quot; _
 (ByVal hKey As Long, _
  ByVal lpValueName As String, _
  ByVal Reserved As Long, _
  ByVal dwType As Long, _
  lpValue As Long, _
  ByVal cbData As Long) As Long

Public Sub CreateAssociation(fileEx As String, Discription As String)
  Dim sPath As String

  CreateNewKey fileEx, HKEY_CLASSES_ROOT
  SetKeyValue fileEx, &quot;&quot;, Discription, REG_SZ
  CreateNewKey Discription &amp; &quot;\shell\Open in CyberCrypt\command&quot;, HKEY_CLASSES_ROOT
  CreateNewKey Discription &amp; &quot;\DefaultIcon&quot;, HKEY_CLASSES_ROOT
  SetKeyValue Discription &amp; &quot;\DefaultIcon&quot;, &quot;&quot;, App.Path &amp; &quot;\&quot; &amp; App.EXEName &amp; &quot;.exe,0&quot;, REG_SZ
  SetKeyValue Discription, &quot;&quot;, &quot;CyberCrypt file&quot;, REG_SZ
  sPath = App.Path &amp; &quot;\&quot; &amp; App.EXEName &amp; &quot;.exe %1&quot;

  SetKeyValue Discription &amp; &quot;\shell\Open in CyberCrypt\command&quot;, &quot;&quot;, sPath, REG_SZ
End Sub

Private Function SetValueEx(ByVal hKey As Long, _
 sValueName As String, lType As Long, _
 vValue As Variant) As Long

  Dim nValue As Long
  Dim sValue As String

  Select Case lType
    Case REG_SZ
      sValue = vValue &amp; Chr$(0)
      SetValueEx = RegSetValueExString(hKey, _
        sValueName, 0&amp;, lType, sValue, Len(sValue))

    Case REG_DWORD
      nValue = vValue
      SetValueEx = RegSetValueExLong(hKey, sValueName, _
        0&amp;, lType, nValue, 4)

  End Select
End Function

Private Sub CreateNewKey(sNewKeyName As String, _
  lPredefinedKey As Long)

  &#039;// handle to the new key
  Dim hKey As Long

  &#039;// result of the RegCreateKeyEx function
  Dim r As Long

  r = RegCreateKeyEx(lPredefinedKey, sNewKeyName, 0&amp;, _
    vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0&amp;, hKey, r)

  Call RegCloseKey(hKey)
End Sub

Private Sub SetKeyValue(sKeyName As String, sValueName As String, _
vValueSetting As Variant, lValueType As Long)

  &#039;// result of the SetValueEx function
  Dim r As Long

  &#039;// handle of opened key
  Dim hKey As Long

  &#039;// open the specified key
  r = RegOpenKeyEx(HKEY_CLASSES_ROOT, sKeyName, 0, _
    KEY_ALL_ACCESS, hKey)

  r = SetValueEx(hKey, sValueName, lValueType, vValueSetting)

  Call RegCloseKey(hKey)
End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/create-file-association/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shut down System</title>
		<link>http://www.snippetware.com/2009/10/11/shut-down-system/</link>
		<comments>http://www.snippetware.com/2009/10/11/shut-down-system/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:55:56 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=239</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/shut-down-system/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
Option Explicit

&#039; ----------------------------
&#039; Constants &amp; API Declarations
&#039; ----------------------------

Private Declare Function SetWindowPos Lib &quot;user32&quot; (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SystemParametersInfo Lib &quot;user32&quot; Alias &quot;SystemParametersInfoA&quot; (ByVal uAction As Long, ByVal uParam As Long, lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Declare Function ExitWindowsEx Lib &quot;user32&quot; (ByVal uFlags As Long, ByVal dwReserved As Long) As Long

Private Const EWX_SHUTDOWN = 1

&#039; ---------------
&#039; Function
&#039; ---------------

Private sub Shutdown()
        Dim ret As Integer
        Dim pOld As Boolean

        ret = SystemParametersInfo(97, False, pOld, 0)
End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/shut-down-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Close all windows and logon as a different user</title>
		<link>http://www.snippetware.com/2009/10/11/close-all-windows-and-logon-as-a-different-user/</link>
		<comments>http://www.snippetware.com/2009/10/11/close-all-windows-and-logon-as-a-different-user/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 12:55:25 +0000</pubDate>
		<dc:creator>Zaur</dc:creator>
				<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.snippetware.com/?p=237</guid>
		<description><![CDATA[<p><a href="http://www.snippetware.com/2009/10/11/close-all-windows-and-logon-as-a-different-user/">Continue</a></p>]]></description>
			<content:encoded><![CDATA[<pre class="brush: vb">
Option Explicit

&#039; ---------------
&#039; Declarations
&#039; ---------------

Private Const EWX_LogOff As Long = 0
Private Declare Function ExitWindowsEx Lib &quot;user32&quot; (ByVal dwOptions As Long, ByVal dwReserved As Long) As Long

&#039; ---------------
&#039; Function
&#039; ---------------

&#039; close all programs and log on as a different user
Sub CloseWindows()
    Dim lngResult As Long
    lngResult = ExitWindowsEx(EWX_LogOff, 0&amp;)
End Sub
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.snippetware.com/2009/10/11/close-all-windows-and-logon-as-a-different-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

