<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-33002948</id><updated>2011-12-14T19:10:20.515-08:00</updated><category term='visual'/><category term='long'/><category term='rnd'/><category term='cdbl'/><category term='basic'/><category term='double'/><category term='list'/><category term='NETWORK_ALIVE_LAN'/><category term='random'/><category term='clng'/><category term='GetInputState'/><category term='overflow'/><category term='NETWORK_ALIVE_WAN'/><category term='How to change time zone information by using Visual Basic'/><category term='RasConnectionNotification'/><category term='floating point'/><category term='IsDestinationReachable'/><category term='processes'/><category term='timezone'/><category term='running'/><category term='doevents'/><category term='datatype'/><category term='WaitForMultipleObjects'/><category term='createevent'/><category term='Randomize'/><category term='numbers'/><category term='GetQueueStatus'/><title type='text'>Visual Basic Coding Tips and Tricks</title><subtitle type='html'>A place for Visual Basic coders to share their dreams</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://undim.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-33002948.post-3801207862991370449</id><published>2010-03-01T02:30:00.001-08:00</published><updated>2010-03-01T02:33:08.694-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='long'/><category scheme='http://www.blogger.com/atom/ns#' term='double'/><category scheme='http://www.blogger.com/atom/ns#' term='clng'/><category scheme='http://www.blogger.com/atom/ns#' term='datatype'/><category scheme='http://www.blogger.com/atom/ns#' term='cdbl'/><category scheme='http://www.blogger.com/atom/ns#' term='floating point'/><category scheme='http://www.blogger.com/atom/ns#' term='overflow'/><title type='text'>How to convert a long number to double and vice versa</title><content type='html'>&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td   style="font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;font-family:inherit;font-size:inherit;" valign="top"&gt;The function that you could use to convert a long number to double is :&lt;br /&gt;cDbl&lt;br /&gt;&lt;br /&gt;Example source code:&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;Dim dblMyNumber As Double&lt;br /&gt;Dim lngMyNumber As Long&lt;br /&gt;&lt;br /&gt;lngMyNumber = 1002992&lt;br /&gt;&lt;br /&gt;dblMyNumber = &lt;span style="font-weight: bold;"&gt;CDbl&lt;/span&gt;(lngMyNumber)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Thus lngMyNumber was converted to a double using CDbl. The output double variable is dblMyNumber.&lt;br /&gt;&lt;br /&gt;Now, to convert a Double to a long, you need cLng function.&lt;br /&gt;cLng (Convert to Long) is used like in the following example:&lt;br /&gt;&lt;br /&gt;Example source code:&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;Dim dblMyNumber As Double&lt;br /&gt;Dim lngMyNumber As Long&lt;br /&gt;&lt;br /&gt;dblMyNumber = 1002992&lt;br /&gt;&lt;br /&gt;lngMyNumber = &lt;span style="font-weight: bold;"&gt;CLng&lt;/span&gt;(dblMyNumber)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;So dblMyNumber was converted to a Long using &lt;span style="font-weight: bold;"&gt;CLng&lt;/span&gt;. The output double variable is lngMyNumber.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NOTICE:&lt;/span&gt;&lt;br /&gt;The Long data type is a 32-bit number&lt;br /&gt;It ranges from -2,147,483,648 to 2,147,483,647.&lt;br /&gt;Long variables can only contain non-fractional integer values.&lt;br /&gt;&lt;br /&gt;The Double data type is a 64-bit floating point number used when high accuracy is needed.&lt;br /&gt;These variables can range from -1.79769313486232e308 to -4.94065645841247e-324 for negative values and from 4.94065645841247e-324 to 1.79769313486232e308 for positive values.&lt;br /&gt;&lt;br /&gt;This means that you might face overflow issues because Double has the double size than Long datatype.&lt;br /&gt;&lt;br /&gt;Take a look at the following code:&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;Dim dblMyNumber As Double&lt;br /&gt;Dim lngMyNumber As Long&lt;br /&gt;&lt;br /&gt;dblMyNumber = 3147483647#&lt;br /&gt;&lt;br /&gt;lngMyNumber =  CLng(dblMyNumber)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33002948-3801207862991370449?l=undim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://undim.blogspot.com/feeds/3801207862991370449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://undim.blogspot.com/2010/03/how-to-convert-long-number-to-double.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/3801207862991370449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/3801207862991370449'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/2010/03/how-to-convert-long-number-to-double.html' title='How to convert a long number to double and vice versa'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33002948.post-791373501641733429</id><published>2007-12-07T01:20:00.000-08:00</published><updated>2008-01-13T21:55:53.382-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='timezone'/><category scheme='http://www.blogger.com/atom/ns#' term='How to change time zone information by using Visual Basic'/><title type='text'>How to change time zone information by using Visual Basic</title><content type='html'>The way to implement this effect is as follows: &lt;table class="list ol"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="number"&gt;1.&lt;/td&gt;&lt;td class="text"&gt; Determine which time zone you would like to change to. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;2.&lt;/td&gt;&lt;td class="text"&gt; Find the key in the registry that contains the information needed to fill the TIME_ZONE_INFORMATION structure. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;3.&lt;/td&gt;&lt;td class="text"&gt; Read in that information and load the values into a variable of type TIME_ZONE_INFORMATION. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;4.&lt;/td&gt;&lt;td class="text"&gt; Call the SetTimeZoneInformation API, passing it the TIME_ZONE_INFORMATION struct variable. &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;  The location in the registry that contains time zone information differs between Windows 9x and Windows NT/Windows 2000.&lt;br /&gt;&lt;br /&gt;For Windows NT and Windows 2000, it is located at:   &lt;div class="indent"&gt;&lt;b&gt;HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones&lt;/b&gt;&lt;/div&gt; For Windows 9x, it is located at:  &lt;div class="indent"&gt;&lt;b&gt;HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Time Zones&lt;/b&gt;&lt;/div&gt; The Time Zone key names differ between Windows NT, Windows 2000, and Windows 9x as well because Windows NT and Windows 2000 append the string "Standard Time" to the different keys whereas Windows 9x does not.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;In Windows NT and Windows 2000, you would see this key:&lt;br /&gt;&lt;div class="indent"&gt;&lt;b&gt;Pacific Standard Time&lt;/b&gt;&lt;/div&gt; while in Windows 9x, you would see this key:&lt;div class="indent"&gt;&lt;b&gt;Pacific&lt;/b&gt;&lt;/div&gt; The registry location where the current Date/Time settings can be found is: &lt;div class="indent"&gt;&lt;b&gt;HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation&lt;/b&gt;&lt;/div&gt;&lt;p class="topOfPage"&gt;&lt;a href="http://support.microsoft.com/kb/221542#top"&gt;&lt;img src="http://support.microsoft.com/library/images/support/kbgraphics/public/en-us/uparrow.gif" alt="" /&gt;Back to the top&lt;/a&gt;&lt;/p&gt;&lt;h3 id="tocHeadRef"&gt;Step-by-step example&lt;/h3&gt;&lt;script type="text/javascript"&gt;loadTOCNode(2, 'moreinformation');&lt;/script&gt; The code sample below requires a form with a listbox. The listbox is loaded with the possible time zone values that the user can select with a double-click to change the time zone. It will show a messagebox that, once dismissed, will change the system settings back to their original values.&lt;table class="list ol"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="number"&gt;1.&lt;/td&gt;&lt;td class="text"&gt;Create a new Standard EXE project. Form1 is created by default.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;2.&lt;/td&gt;&lt;td class="text"&gt;Add a Listbox control to Form1.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;3.&lt;/td&gt;&lt;td class="text"&gt;Add the following code to the General Declarations section of Form1:&lt;br /&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="code"&gt;&lt;div class="code"&gt;&lt;br /&gt;&lt;br /&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;' Operating System version information declares&lt;br /&gt;&lt;br /&gt;Private Const VER_PLATFORM_WIN32_NT = 2&lt;br /&gt;Private Const VER_PLATFORM_WIN32_WINDOWS = 1&lt;br /&gt;&lt;br /&gt;Private Type OSVERSIONINFO&lt;br /&gt;dwOSVersionInfoSize As Long&lt;br /&gt;dwMajorVersion As Long&lt;br /&gt;dwMinorVersion As Long&lt;br /&gt;dwBuildNumber As Long&lt;br /&gt;dwPlatformId As Long&lt;br /&gt;szCSDVersion As String * 128 ' Maintenance string&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Declare Function GetVersionEx Lib "kernel32" _&lt;br /&gt;Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long&lt;br /&gt;&lt;br /&gt;' Time Zone information declares&lt;br /&gt;&lt;br /&gt;Private Type SYSTEMTIME&lt;br /&gt;wYear As Integer&lt;br /&gt;wMonth As Integer&lt;br /&gt;wDayOfWeek As Integer&lt;br /&gt;wDay As Integer&lt;br /&gt;wHour As Integer&lt;br /&gt;wMinute As Integer&lt;br /&gt;wSecond As Integer&lt;br /&gt;wMilliseconds As Integer&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Type REGTIMEZONEINFORMATION&lt;br /&gt;Bias As Long&lt;br /&gt;StandardBias As Long&lt;br /&gt;DaylightBias As Long&lt;br /&gt;StandardDate As SYSTEMTIME&lt;br /&gt;DaylightDate As SYSTEMTIME&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Type TIME_ZONE_INFORMATION&lt;br /&gt;Bias As Long&lt;br /&gt;StandardName(0 To 63) As Byte ' used to accommodate Unicode strings&lt;br /&gt;StandardDate As SYSTEMTIME&lt;br /&gt;StandardBias As Long&lt;br /&gt;DaylightName(0 To 63) As Byte ' used to accommodate Unicode strings&lt;br /&gt;DaylightDate As SYSTEMTIME&lt;br /&gt;DaylightBias As Long&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Const TIME_ZONE_ID_INVALID = &amp;amp;HFFFFFFFF&lt;br /&gt;Private Const TIME_ZONE_ID_UNKNOWN = 0&lt;br /&gt;Private Const TIME_ZONE_ID_STANDARD = 1&lt;br /&gt;Private Const TIME_ZONE_ID_DAYLIGHT = 2&lt;br /&gt;&lt;br /&gt;Private Declare Function GetTimeZoneInformation Lib "kernel32" _&lt;br /&gt;(lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function SetTimeZoneInformation Lib "kernel32" _&lt;br /&gt;(lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long&lt;br /&gt;&lt;br /&gt;' Registry information declares&lt;br /&gt;Private Const REG_SZ As Long = 1&lt;br /&gt;Private Const REG_BINARY = 3&lt;br /&gt;Private Const REG_DWORD As Long = 4&lt;br /&gt;&lt;br /&gt;Private Const HKEY_CLASSES_ROOT = &amp;amp;H80000000&lt;br /&gt;Private Const HKEY_CURRENT_USER = &amp;amp;H80000001&lt;br /&gt;Private Const HKEY_LOCAL_MACHINE = &amp;amp;H80000002&lt;br /&gt;Private Const HKEY_USERS = &amp;amp;H80000003&lt;br /&gt;&lt;br /&gt;Private Const ERROR_SUCCESS = 0&lt;br /&gt;Private Const ERROR_BADDB = 1&lt;br /&gt;Private Const ERROR_BADKEY = 2&lt;br /&gt;Private Const ERROR_CANTOPEN = 3&lt;br /&gt;Private Const ERROR_CANTREAD = 4&lt;br /&gt;Private Const ERROR_CANTWRITE = 5&lt;br /&gt;Private Const ERROR_OUTOFMEMORY = 6&lt;br /&gt;Private Const ERROR_ARENA_TRASHED = 7&lt;br /&gt;Private Const ERROR_ACCESS_DENIED = 8&lt;br /&gt;Private Const ERROR_INVALID_PARAMETERS = 87&lt;br /&gt;Private Const ERROR_NO_MORE_ITEMS = 259&lt;br /&gt;&lt;br /&gt;Private Const KEY_ALL_ACCESS = &amp;amp;H3F&lt;br /&gt;&lt;br /&gt;Private Const REG_OPTION_NON_VOLATILE = 0&lt;br /&gt;&lt;br /&gt;Private Declare Function RegOpenKeyEx Lib "advapi32.dll" _&lt;br /&gt;Alias "RegOpenKeyExA" ( _&lt;br /&gt;ByVal hKey As Long, _&lt;br /&gt;ByVal lpSubKey As String, _&lt;br /&gt;ByVal ulOptions As Long, _&lt;br /&gt;ByVal samDesired As Long, _&lt;br /&gt;phkResult As Long) _&lt;br /&gt;As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function RegQueryValueEx Lib "advapi32.dll" _&lt;br /&gt;Alias "RegQueryValueExA" ( _&lt;br /&gt;ByVal hKey As Long, _&lt;br /&gt;ByVal lpszValueName As String, _&lt;br /&gt;ByVal lpdwReserved As Long, _&lt;br /&gt;lpdwType As Long, _&lt;br /&gt;lpData As Any, _&lt;br /&gt;lpcbData As Long) _&lt;br /&gt;As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function RegQueryValueExString Lib "advapi32.dll" _&lt;br /&gt;Alias "RegQueryValueExA" ( _&lt;br /&gt;ByVal hKey As Long, _&lt;br /&gt;ByVal lpValueName As String, _&lt;br /&gt;ByVal lpReserved As Long, _&lt;br /&gt;lpType As Long, _&lt;br /&gt;ByVal lpData As String, _&lt;br /&gt;lpcbData As Long) _&lt;br /&gt;As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function RegEnumKey Lib "advapi32.dll" _&lt;br /&gt;Alias "RegEnumKeyA" ( _&lt;br /&gt;ByVal hKey As Long, _&lt;br /&gt;ByVal dwIndex As Long, _&lt;br /&gt;ByVal lpName As String, _&lt;br /&gt;ByVal cbName As Long) _&lt;br /&gt;As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function RegCloseKey Lib "advapi32.dll" ( _&lt;br /&gt;ByVal hKey As Long) _&lt;br /&gt;As Long&lt;br /&gt;&lt;br /&gt;' Registry Constants&lt;br /&gt;Const SKEY_NT = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"&lt;br /&gt;Const SKEY_9X = "SOFTWARE\Microsoft\Windows\CurrentVersion\Time Zones"&lt;br /&gt;&lt;br /&gt;' The following declaration is different from the one in the API viewer.&lt;br /&gt;' To disable implicit ANSI&lt;-&gt;Unicode conversion, it changes the&lt;br /&gt;' variable types of lpMultiByteStr and lpWideCharStr to Any.&lt;br /&gt;'&lt;br /&gt;Private Declare Function MultiByteToWideChar Lib "kernel32" ( _&lt;br /&gt;ByVal CodePage As Long, _&lt;br /&gt;ByVal dwFlags As Long, _&lt;br /&gt;lpMultiByteStr As Any, _&lt;br /&gt;ByVal cchMultiByte As Long, _&lt;br /&gt;lpWideCharStr As Any, _&lt;br /&gt;ByVal cchWideChar As Long) As Long&lt;br /&gt;&lt;br /&gt;' The above Declare and the following Constants are used to make&lt;br /&gt;' this sample compatible with Double Byte Character Systems (DBCS).&lt;br /&gt;Private Const CP_ACP = 0&lt;br /&gt;Private Const MB_PRECOMPOSED = &amp;amp;H1&lt;br /&gt;Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _&lt;br /&gt;ByRef Destination As Any, _&lt;br /&gt;ByRef Source As Any, _&lt;br /&gt;ByVal numbytes As Long)&lt;br /&gt;Dim SubKey As String&lt;br /&gt;&lt;br /&gt;Private Sub Form_Load()&lt;br /&gt;Dim lRetVal As Long, lResult As Long, lCurIdx As Long&lt;br /&gt;Dim lDataLen As Long, lValueLen As Long, hKeyResult As Long&lt;br /&gt;Dim strvalue As String&lt;br /&gt;Dim osV As OSVERSIONINFO&lt;br /&gt;&lt;br /&gt;' Win9x and WinNT have a slightly different registry structure. Determine&lt;br /&gt;' the operating system and set a module variable to the correct subkey.&lt;br /&gt;&lt;br /&gt;osV.dwOSVersionInfoSize = Len(osV)&lt;br /&gt;Call GetVersionEx(osV)&lt;br /&gt;If osV.dwPlatformId = VER_PLATFORM_WIN32_NT Then&lt;br /&gt;SubKey = SKEY_NT&lt;br /&gt;Else&lt;br /&gt;SubKey = SKEY_9X&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;lRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, SubKey, 0, _&lt;br /&gt;                  KEY_ALL_ACCESS, hKeyResult)&lt;br /&gt;&lt;br /&gt;If lRetVal = ERROR_SUCCESS Then&lt;br /&gt;&lt;br /&gt;lCurIdx = 0&lt;br /&gt;lDataLen = 32&lt;br /&gt;lValueLen = 32&lt;br /&gt;&lt;br /&gt;Do&lt;br /&gt; strvalue = String(lValueLen, 0)&lt;br /&gt; lResult = RegEnumKey(hKeyResult, lCurIdx, strvalue, lDataLen)&lt;br /&gt;&lt;br /&gt; If lResult = ERROR_SUCCESS Then&lt;br /&gt;    List1.AddItem Left(strvalue, lValueLen)&lt;br /&gt; End If&lt;br /&gt;&lt;br /&gt; lCurIdx = lCurIdx + 1&lt;br /&gt;&lt;br /&gt;Loop While lResult = ERROR_SUCCESS&lt;br /&gt;&lt;br /&gt;RegCloseKey hKeyResult&lt;br /&gt;Else&lt;br /&gt;List1.AddItem "Could not open registry key"&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub List1_DblClick()&lt;br /&gt;Dim TZ As TIME_ZONE_INFORMATION, oldTZ As TIME_ZONE_INFORMATION&lt;br /&gt;Dim rTZI As REGTIMEZONEINFORMATION&lt;br /&gt;Dim bytDLTName(32) As Byte, bytSTDName(32) As Byte&lt;br /&gt;Dim cbStr As Long, dwType As Long&lt;br /&gt;Dim lRetVal As Long, hKeyResult As Long, lngData As Long&lt;br /&gt;&lt;br /&gt;lRetVal = RegOpenKeyEx(HKEY_LOCAL_MACHINE, SubKey &amp;amp; "\" &amp;amp; List1.Text, _&lt;br /&gt;                   0, KEY_ALL_ACCESS, hKeyResult)&lt;br /&gt;&lt;br /&gt;If lRetVal = ERROR_SUCCESS Then&lt;br /&gt;lRetVal = RegQueryValueEx(hKeyResult, "TZI", 0&amp;amp;, ByVal 0&amp;amp;, _&lt;br /&gt;                          rTZI, Len(rTZI))&lt;br /&gt;&lt;br /&gt;If lRetVal = ERROR_SUCCESS Then&lt;br /&gt; TZ.Bias = rTZI.Bias&lt;br /&gt; TZ.StandardBias = rTZI.StandardBias&lt;br /&gt; TZ.DaylightBias = rTZI.DaylightBias&lt;br /&gt; TZ.StandardDate = rTZI.StandardDate&lt;br /&gt; TZ.DaylightDate = rTZI.DaylightDate&lt;br /&gt;&lt;br /&gt; cbStr = 32&lt;br /&gt; dwType = REG_SZ&lt;br /&gt;&lt;br /&gt; lRetVal = RegQueryValueEx(hKeyResult, "Std", _&lt;br /&gt;             0&amp;amp;, dwType, bytSTDName(0), cbStr)&lt;br /&gt;&lt;br /&gt; If lRetVal = ERROR_SUCCESS Then&lt;br /&gt;    Call MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, _&lt;br /&gt;       bytSTDName(0), cbStr, TZ.StandardName(0), 32)&lt;br /&gt; Else&lt;br /&gt;    RegCloseKey hKeyResult&lt;br /&gt;    Exit Sub&lt;br /&gt; End If&lt;br /&gt;&lt;br /&gt; cbStr = 32&lt;br /&gt; dwType = REG_SZ&lt;br /&gt;&lt;br /&gt; lRetVal = RegQueryValueEx(hKeyResult, "Dlt", _&lt;br /&gt;             0&amp;amp;, dwType, bytDLTName(0), cbStr)&lt;br /&gt;&lt;br /&gt; If lRetVal = ERROR_SUCCESS Then&lt;br /&gt;    Call MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, _&lt;br /&gt;       bytDLTName(0), cbStr, TZ.DaylightName(0), 32)&lt;br /&gt; Else&lt;br /&gt;    RegCloseKey hKeyResult&lt;br /&gt;    Exit Sub&lt;br /&gt; End If&lt;br /&gt;&lt;br /&gt; lRetVal = GetTimeZoneInformation(oldTZ)&lt;br /&gt;&lt;br /&gt; If lRetVal = TIME_ZONE_ID_INVALID Then&lt;br /&gt;    MsgBox "Error getting original TimeZone Info"&lt;br /&gt;    RegCloseKey hKeyResult&lt;br /&gt;    Exit Sub&lt;br /&gt; Else&lt;br /&gt; If TZ.DaylightDate.wMonth &lt;&gt; 0 And TZ.DaylightBias &lt;&gt; 0 Then&lt;br /&gt;    lRetVal = SetTimeZoneInformation(TZ)&lt;br /&gt; Else&lt;br /&gt;   Call CopyMemory(TZ.DaylightName(0), TZ.StandardName(0), 64)&lt;br /&gt;   TZ.DaylightBias = 0&lt;br /&gt;   lRetVal = SetTimeZoneInformation(TZ)&lt;br /&gt; End If&lt;br /&gt;    MsgBox "Time Zone Changed, Click OK to restore"&lt;br /&gt;    lRetVal = SetTimeZoneInformation(oldTZ)&lt;br /&gt; End If&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;RegCloseKey hKeyResult&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;/div&gt;  &lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;4.&lt;/td&gt;&lt;td class="text"&gt;Run the program, and note that the listbox displays all of the available time zones.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;5.&lt;/td&gt;&lt;td class="text"&gt;Select a time zone, and then double-click it. Your system locale is changed to the selected zone. You receive the following message: &lt;div class="message"&gt;Time Zone Changed, Click OK to restore&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;6.&lt;/td&gt;&lt;td class="text"&gt;In Control Panel, double-click the &lt;strong class="uiterm"&gt;Date/Time&lt;/strong&gt; icon. You can also reach this dialog by double-clicking the clock in the system tray. Click the &lt;strong class="uiterm"&gt;Time Zone&lt;/strong&gt; tab and observe that the time zone has been changed.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="number"&gt;7.&lt;/td&gt;&lt;td class="text"&gt;Close the &lt;strong class="uiterm"&gt;Date/Time Properties&lt;/strong&gt; dialog box and click &lt;strong class="uiterm"&gt;OK&lt;/strong&gt; on the message box displayed by your application. Repeat the previous step to confirm that the time zone information has been restored.&lt;br /&gt;&lt;br /&gt;Source: &lt;a href="http://support.microsoft.com/kb/221542"&gt;Microsoft&lt;/a&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33002948-791373501641733429?l=undim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://undim.blogspot.com/feeds/791373501641733429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://undim.blogspot.com/2007/12/how-to-change-time-zone-information-by.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/791373501641733429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/791373501641733429'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/2007/12/how-to-change-time-zone-information-by.html' title='How to change time zone information by using Visual Basic'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33002948.post-5573896497393939038</id><published>2007-09-16T03:13:00.000-07:00</published><updated>2007-09-16T03:15:02.849-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='visual'/><category scheme='http://www.blogger.com/atom/ns#' term='processes'/><category scheme='http://www.blogger.com/atom/ns#' term='list'/><category scheme='http://www.blogger.com/atom/ns#' term='basic'/><category scheme='http://www.blogger.com/atom/ns#' term='running'/><title type='text'>List all running processes in Visual Basic</title><content type='html'>1. Create a new Standard Exe project in Visual Basic. Form1 is created by default.&lt;br /&gt;2. Add a CommandButton to Form1.&lt;br /&gt;3. Add a ListBox to Form1.&lt;br /&gt;4. Copy the following code to Form1:&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;      Option Explicit&lt;br /&gt;&lt;br /&gt;      Private Sub Command1_Click()&lt;br /&gt;      List1.Clear&lt;br /&gt;      Select Case getVersion()&lt;br /&gt;&lt;br /&gt;      Case 1 'Windows 95/98&lt;br /&gt;&lt;br /&gt;         Dim f As Long, sname As String&lt;br /&gt;         Dim hSnap As Long, proc As PROCESSENTRY32&lt;br /&gt;         hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)&lt;br /&gt;         If hSnap = hNull Then Exit Sub&lt;br /&gt;         proc.dwSize = Len(proc)&lt;br /&gt;         ' Iterate through the processes&lt;br /&gt;         f = Process32First(hSnap, proc)&lt;br /&gt;         Do While f&lt;br /&gt;           sname = StrZToStr(proc.szExeFile)&lt;br /&gt;           List1.AddItem sname&lt;br /&gt;           f = Process32Next(hSnap, proc)&lt;br /&gt;         Loop&lt;br /&gt;&lt;br /&gt;      Case 2 'Windows NT&lt;br /&gt;&lt;br /&gt;         Dim cb As Long&lt;br /&gt;         Dim cbNeeded As Long&lt;br /&gt;         Dim NumElements As Long&lt;br /&gt;         Dim ProcessIDs() As Long&lt;br /&gt;         Dim cbNeeded2 As Long&lt;br /&gt;         Dim NumElements2 As Long&lt;br /&gt;         Dim Modules(1 To 200) As Long&lt;br /&gt;         Dim lRet As Long&lt;br /&gt;         Dim ModuleName As String&lt;br /&gt;         Dim nSize As Long&lt;br /&gt;         Dim hProcess As Long&lt;br /&gt;         Dim i As Long&lt;br /&gt;         'Get the array containing the process id's for each process object&lt;br /&gt;         cb = 8&lt;br /&gt;         cbNeeded = 96&lt;br /&gt;         Do While cb &lt;= cbNeeded&lt;br /&gt;            cb = cb * 2&lt;br /&gt;            ReDim ProcessIDs(cb / 4) As Long&lt;br /&gt;            lRet = EnumProcesses(ProcessIDs(1), cb, cbNeeded)&lt;br /&gt;         Loop&lt;br /&gt;         NumElements = cbNeeded / 4&lt;br /&gt;&lt;br /&gt;         For i = 1 To NumElements&lt;br /&gt;            'Get a handle to the Process&lt;br /&gt;            hProcess = OpenProcess(PROCESS_QUERY_INFORMATION _&lt;br /&gt;               Or PROCESS_VM_READ, 0, ProcessIDs(i))&lt;br /&gt;            'Got a Process handle&lt;br /&gt;            If hProcess &lt;&gt; 0 Then&lt;br /&gt;                'Get an array of the module handles for the specified&lt;br /&gt;                'process&lt;br /&gt;                lRet = EnumProcessModules(hProcess, Modules(1), 200, _&lt;br /&gt;                                             cbNeeded2)&lt;br /&gt;                'If the Module Array is retrieved, Get the ModuleFileName&lt;br /&gt;                If lRet &lt;&gt; 0 Then&lt;br /&gt;                   ModuleName = Space(MAX_PATH)&lt;br /&gt;                   nSize = 500&lt;br /&gt;                   lRet = GetModuleFileNameExA(hProcess, Modules(1), _&lt;br /&gt;                                   ModuleName, nSize)&lt;br /&gt;                   List1.AddItem Left(ModuleName, lRet)&lt;br /&gt;                End If&lt;br /&gt;            End If&lt;br /&gt;          'Close the handle to the process&lt;br /&gt;         lRet = CloseHandle(hProcess)&lt;br /&gt;         Next&lt;br /&gt;&lt;br /&gt;      End Select&lt;br /&gt;      End Sub&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;      &lt;br /&gt;&lt;br /&gt;5. Add a Standard Module to the Project. Module1 is created.&lt;br /&gt;6. Paste the following code into Module1.&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;      Public Declare Function Process32First Lib "kernel32" ( _&lt;br /&gt;         ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long&lt;br /&gt;&lt;br /&gt;      Public Declare Function Process32Next Lib "kernel32" ( _&lt;br /&gt;         ByVal hSnapshot As Long, lppe As PROCESSENTRY32) As Long&lt;br /&gt;&lt;br /&gt;      Public Declare Function CloseHandle Lib "Kernel32.dll" _&lt;br /&gt;         (ByVal Handle As Long) As Long&lt;br /&gt;&lt;br /&gt;      Public Declare Function OpenProcess Lib "Kernel32.dll" _&lt;br /&gt;        (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, _&lt;br /&gt;            ByVal dwProcId As Long) As Long&lt;br /&gt;&lt;br /&gt;      Public Declare Function EnumProcesses Lib "psapi.dll" _&lt;br /&gt;         (ByRef lpidProcess As Long, ByVal cb As Long, _&lt;br /&gt;            ByRef cbNeeded As Long) As Long&lt;br /&gt;&lt;br /&gt;      Public Declare Function GetModuleFileNameExA Lib "psapi.dll" _&lt;br /&gt;         (ByVal hProcess As Long, ByVal hModule As Long, _&lt;br /&gt;            ByVal ModuleName As String, ByVal nSize As Long) As Long&lt;br /&gt;&lt;br /&gt;      Public Declare Function EnumProcessModules Lib "psapi.dll" _&lt;br /&gt;         (ByVal hProcess As Long, ByRef lphModule As Long, _&lt;br /&gt;            ByVal cb As Long, ByRef cbNeeded As Long) As Long&lt;br /&gt;&lt;br /&gt;      Public Declare Function CreateToolhelp32Snapshot Lib "kernel32" ( _&lt;br /&gt;         ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long&lt;br /&gt;&lt;br /&gt;      Public Declare Function GetVersionExA Lib "kernel32" _&lt;br /&gt;         (lpVersionInformation As OSVERSIONINFO) As Integer&lt;br /&gt;&lt;br /&gt;      Public Type PROCESSENTRY32&lt;br /&gt;         dwSize As Long&lt;br /&gt;         cntUsage As Long&lt;br /&gt;         th32ProcessID As Long           ' This process&lt;br /&gt;         th32DefaultHeapID As Long&lt;br /&gt;         th32ModuleID As Long            ' Associated exe&lt;br /&gt;         cntThreads As Long&lt;br /&gt;         th32ParentProcessID As Long     ' This process's parent process&lt;br /&gt;         pcPriClassBase As Long          ' Base priority of process threads&lt;br /&gt;         dwFlags As Long&lt;br /&gt;         szExeFile As String * 260       ' MAX_PATH&lt;br /&gt;      End Type&lt;br /&gt;&lt;br /&gt;      Public Type OSVERSIONINFO&lt;br /&gt;         dwOSVersionInfoSize As Long&lt;br /&gt;         dwMajorVersion As Long&lt;br /&gt;         dwMinorVersion As Long&lt;br /&gt;         dwBuildNumber As Long&lt;br /&gt;         dwPlatformId As Long           '1 = Windows 95.&lt;br /&gt;                                        '2 = Windows NT&lt;br /&gt;&lt;br /&gt;         szCSDVersion As String * 128&lt;br /&gt;      End Type&lt;br /&gt;&lt;br /&gt;      Public Const PROCESS_QUERY_INFORMATION = 1024&lt;br /&gt;      Public Const PROCESS_VM_READ = 16&lt;br /&gt;      Public Const MAX_PATH = 260&lt;br /&gt;      Public Const STANDARD_RIGHTS_REQUIRED = &amp;HF0000&lt;br /&gt;      Public Const SYNCHRONIZE = &amp;H100000&lt;br /&gt;      'STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &amp;HFFF&lt;br /&gt;      Public Const PROCESS_ALL_ACCESS = &amp;H1F0FFF&lt;br /&gt;      Public Const TH32CS_SNAPPROCESS = &amp;H2&amp;&lt;br /&gt;      Public Const hNull = 0&lt;br /&gt;&lt;br /&gt;      Function StrZToStr(s As String) As String&lt;br /&gt;         StrZToStr = Left$(s, Len(s) - 1)&lt;br /&gt;      End Function&lt;br /&gt;&lt;br /&gt;      Public Function getVersion() As Long&lt;br /&gt;         Dim osinfo As OSVERSIONINFO&lt;br /&gt;         Dim retvalue As Integer&lt;br /&gt;         osinfo.dwOSVersionInfoSize = 148&lt;br /&gt;         osinfo.szCSDVersion = Space$(128)&lt;br /&gt;         retvalue = GetVersionExA(osinfo)&lt;br /&gt;         getVersion = osinfo.dwPlatformId&lt;br /&gt;      End Function&lt;br /&gt;&lt;/div&gt;   &lt;br /&gt;&lt;br /&gt;7. Run the project and click the Command button on Form1. You should see a listing of the currently running processes.&lt;br /&gt;8. If you are running Windows 95/98, try running the example project on Windows NT or vice versa. The processes should be listed regardless of operating system version.&lt;br /&gt;&lt;br /&gt;Source : &lt;a href="http://support.microsoft.com/kb/q187913/" target="_blank"&gt;Microsoft&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33002948-5573896497393939038?l=undim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://undim.blogspot.com/feeds/5573896497393939038/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://undim.blogspot.com/2007/09/list-all-running-processes-in-visual.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/5573896497393939038'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/5573896497393939038'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/2007/09/list-all-running-processes-in-visual.html' title='List all running processes in Visual Basic'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33002948.post-5367250214570572209</id><published>2007-07-07T22:30:00.000-07:00</published><updated>2007-11-07T22:31:20.435-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NETWORK_ALIVE_LAN'/><category scheme='http://www.blogger.com/atom/ns#' term='NETWORK_ALIVE_WAN'/><category scheme='http://www.blogger.com/atom/ns#' term='IsDestinationReachable'/><title type='text'>Undocumented : How to check if a website (or your blog) is alive</title><content type='html'>Use this undocumented method IsDestinationReachable located in sensapi.dll to check if your blog or a website in general is alive.&lt;br /&gt;&lt;br /&gt;The debug window will display the connection path, the speed and True or False if the  site destination is reachable.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Private Type QOCINFO&lt;br /&gt;  dwSize As Long&lt;br /&gt;  dwFlags As Long&lt;br /&gt;  dwInSpeed As Long&lt;br /&gt;  dwOutSpeed As Long&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Public MonInterval As Long&lt;br /&gt;&lt;br /&gt;Private Const NETWORK_ALIVE_LAN As Long = &amp;amp;H1 'active LAN cards&lt;br /&gt;Private Const NETWORK_ALIVE_WAN As Long = &amp;amp;H2 'active RAS connections&lt;br /&gt;Private Const NETWORK_ALIVE_AOL As Long = &amp;amp;H4 'connected to AOL (Win95/98 only)&lt;br /&gt;                                            &lt;br /&gt;Private Declare Function IsDestinationReachable Lib "sensapi.dll" _&lt;br /&gt;               Alias "IsDestinationReachableA" (ByVal lpszDestination As String, _&lt;br /&gt;               lpQOCInfo As QOCINFO) As Long&lt;br /&gt;Public Function CheckSite(ByVal strHTTPSite As String) As Boolean&lt;br /&gt;  Dim gRes As Long&lt;br /&gt;  Dim structqoc As QOCINFO&lt;br /&gt;&lt;br /&gt;  structqoc.dwSize = Len(structqoc)&lt;br /&gt;    &lt;br /&gt;  gRes = IsDestinationReachable(strHTTPSite, structqoc)&lt;br /&gt;&lt;br /&gt;  With structqoc&lt;br /&gt;     Select Case .dwFlags&lt;br /&gt;        Case NETWORK_ALIVE_LAN: Debug.Print "LAN"&lt;br /&gt;        Case NETWORK_ALIVE_WAN: Debug.Print "RAS"&lt;br /&gt;        Case NETWORK_ALIVE_AOL: Debug.Print "AOL"&lt;br /&gt;        Case Else: Debug.Print "Unknown"&lt;br /&gt;     End Select&lt;br /&gt;&lt;br /&gt;     Debug.Print "IN:" &amp;amp; FormatNumber((.dwInSpeed / 1000), 0) &amp;amp; " kbps OUT:" &amp;amp; FormatNumber((.dwOutSpeed / 1000), 0) &amp;amp; " kbps"&lt;br /&gt;  End With&lt;br /&gt;  &lt;br /&gt;  CheckSite = CBool(gRes)&lt;br /&gt; &lt;br /&gt;End Function&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Visual Basic still rocks :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33002948-5367250214570572209?l=undim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://undim.blogspot.com/feeds/5367250214570572209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://undim.blogspot.com/2007/07/undocumented-how-to-check-if-website-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/5367250214570572209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/5367250214570572209'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/2007/07/undocumented-how-to-check-if-website-or.html' title='Undocumented : How to check if a website (or your blog) is alive'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33002948.post-5900650655753344084</id><published>2007-03-23T15:00:00.000-07:00</published><updated>2007-10-23T15:01:45.264-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='random'/><category scheme='http://www.blogger.com/atom/ns#' term='rnd'/><category scheme='http://www.blogger.com/atom/ns#' term='Randomize'/><category scheme='http://www.blogger.com/atom/ns#' term='numbers'/><title type='text'>Easily generating random numbers</title><content type='html'>From &lt;a href="mailto:jrslaughter@sisna.com"&gt;John Slaughter&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you use random numbers to a large extent, you probably get tired of always having to put in Randomize and then the equation. This simple subroutine handles both chores for you. First, put the following routine in your project's main module.&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;Public Function GenRndNumber(Upper As Integer, Lower As Integer) As Integer&lt;br /&gt;     Randomize&lt;br /&gt;     GenRndNumber = Int((Upper - Lower + 1) * Rnd + Lower)&lt;br /&gt;End Function&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;To get a random number between 99 and -99, just enter:&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;RandomNumber = GenRndNumber(99, -99)&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You can get a random letter between "A" and "M" with this:&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;RandomLetter = Chr$(GenRndNumber(asc("M"), asc("A")))&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You can eliminate the middle of a range by putting the call to GenRndNumber inside a DO Loop. The following will get a random number from 50 to 99 or -50 to -99.&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;'Initialize the number to be generated within the area you want excluded.&lt;br /&gt;RandomNumber = 0&lt;br /&gt;Do Until Abs(RandomNumber) &amp;gt; 49&lt;br /&gt; RandomNumber = GenRndNumber (99, -99)&lt;br /&gt;Loop&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Be sure to declare RandomNumber and RandomLetter as appropriate. This procedure has a minor benefit for anyone who uses a lot of calls to the random number generator. It actually generates slightly less machine code than calls to the RND function. While not generally a concern nowadays, there may be times when a programmer will need to find a way to cut down on the amount of generated machine code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33002948-5900650655753344084?l=undim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://undim.blogspot.com/feeds/5900650655753344084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://undim.blogspot.com/2007/10/easily-generating-random-numbers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/5900650655753344084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/5900650655753344084'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/2007/10/easily-generating-random-numbers.html' title='Easily generating random numbers'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33002948.post-115600110626675792</id><published>2006-08-19T08:24:00.000-07:00</published><updated>2007-10-23T14:57:35.757-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='RasConnectionNotification'/><category scheme='http://www.blogger.com/atom/ns#' term='WaitForMultipleObjects'/><category scheme='http://www.blogger.com/atom/ns#' term='createevent'/><title type='text'>Simulate multithreading with WaitForMultipleObjects (eg. How ICQ monitors connection state)</title><content type='html'>&lt;p&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;I have used extensivly the event driven mechanism that Windows provide in manydifferent programming aspects&lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;(RDO, ADO, ODBC, Windows Sockets, Winlogon, mutexes, semaphores etc) and usedWaitForSingleObject when&lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt; i was in need of an event monitor API command. &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;The WaitForSingleObject is located in kernel32.dll and waits until a specific event object gets signaled or when a time limit is r&lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;eached. It accepts two parameters; a handle to the event object and a time-out interval.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;i&gt;**&lt;/i&gt;&lt;i&gt;The main benefit of this function is that it uses no processor time while waiting for the object state &lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;i&gt;&lt;/i&gt;&lt;i&gt;to become signaled or the time-out interval to elapse.&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Hereis the declaration :&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;div class="code"&gt;Public Declare Function&lt;/span&gt; WaitForSingleObject&lt;span style="color:#0000ff;"&gt; Lib &lt;/span&gt;"kernel32" &lt;span style="color:#0000ff;"&gt;Alias &lt;/span&gt;"WaitForSingleObject"&lt;span style="color:#0000ff;"&gt; _&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;(ByVal&lt;/span&gt; hHandle&lt;span style="color:#0000ff;"&gt; As Long, ByVal &lt;/span&gt;dwMilliseconds&lt;span style="color:#0000ff;"&gt; As Long) As Long&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Let's see an example of this command's usage :&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;In this example we are going to run the Windows calculator. &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;We will open this shelled process and we will monitor the process handle; &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;if it gets 0 then the process was ended.&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; WAIT_FAILED = &amp;HFFFFFFFF &lt;span style="color:#008000;"&gt;'Our WaitForSingleObject failed to wait and returned -1&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Const &lt;/span&gt;WAIT_OBJECT_0 = &amp;amp;H0&amp; &lt;span style="color:#008000;"&gt;'The waitable object got signaled&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; WAIT_ABANDONED = &amp;amp;H80&amp; &lt;span style="color:#008000;"&gt;'We got out of the waitable object&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; WAIT_TIMEOUT = &amp;amp;H102&amp; &lt;span style="color:#008000;"&gt;'the interval we used, timed out.&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; STANDARD_RIGHTS_ALL = &amp;amp;H1F0000 &lt;span style="color:#008000;"&gt;'No special user rights needed to open this process&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; OpenProcess &lt;span style="color:#0000ff;"&gt;Lib&lt;/span&gt; "kernel32" (&lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; dwDesiredAccess&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; bInheritHandle&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; dwProcessId&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;)&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; WaitForSingleObject &lt;span style="color:#0000ff;"&gt;Lib&lt;/span&gt;"kernel32" (&lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; hHandle &lt;span style="color:#0000ff;"&gt;AsLong&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; dwMilliseconds &lt;span style="color:#0000ff;"&gt;AsLong&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; CloseHandle &lt;span style="color:#0000ff;"&gt;Lib&lt;/span&gt; "kernel32" (&lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; hObject&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Sub &lt;/span&gt;ShelledAPP()&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;Dim &lt;/span&gt;shProcID&lt;span style="color:#0000ff;"&gt; As Long&lt;br /&gt;Dim &lt;/span&gt;hProcess&lt;span style="color:#0000ff;"&gt; As Long&lt;br /&gt;Dim &lt;/span&gt;WaitRet&lt;span style="color:#0000ff;"&gt; As Long&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;shProcID =&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;Shell("calc.exe", vbNormalFocus)&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;hProcess = OpenProcess(STANDARD_RIGHTS_ALL, &lt;span style="color:#0000ff;"&gt;False&lt;/span&gt;, shProcID)&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#008000;"&gt;&lt;br /&gt;&lt;br /&gt;'This is the proper and optimized way to use the WaitForSingleObject function.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;'&lt;/span&gt;&lt;span style="color:#008000;"&gt;Isaw many programmers use the INFINITE constant as &lt;/span&gt;&lt;span style="color:#008000;"&gt;forthe dwMilliseconds field. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'If&lt;i&gt;dwMilliseconds&lt;/i&gt; is INFINITE, the function's time-out interval neverelapses.&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'That'swrong 'cause the program won't refresh thus giving the impression that is a hungapplication.&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'InWindows XP specially you might see a popup screen informing you about this.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;'The problem also appears when you apply WaitForSingleObject with &lt;/span&gt;&lt;span style="color:#008000;"&gt;INFINITE &lt;/span&gt;&lt;span style="color:#008000;"&gt;in an application that &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;uses windows. &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'Always use a reasonable number of milliseconds and always use DoEvents to refresh the program's message queue&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Do&lt;br /&gt;&lt;/span&gt;WaitRet = WaitForSingleObject(hProcess, 10) &lt;span style="color:#008000;"&gt;'wait for 10ms to see if the hProcess was signaled&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;Select Case &lt;/span&gt;WaitRet&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Case &lt;/span&gt;WAIT_TIMEOUT &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;'The first case must always be WAIT_TIMEOUT 'cause it is the most used option&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;DoEvents &lt;span style="color:#008000;"&gt;'until the shelled process terminates &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;Case &lt;/span&gt;WAIT_FAILED or WAIT_ABANDONED&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;MsgBox "Wait failed or abandoned"&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;Exit Do&lt;br /&gt;&lt;br /&gt;Case &lt;/span&gt;WAIT_OBJECT_0 &lt;span style="color:#008000;"&gt;'The object got signaled soinform user and get out of the loop&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;&lt;/span&gt;MsgBox "The shelled application has ended"&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;Exit Do&lt;br /&gt;&lt;br /&gt;End Select&lt;br /&gt;Loop&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Call&lt;/span&gt;CloseHandle(hProcess)&lt;br /&gt;&lt;span style="color:#008000;"&gt;'Close the process handle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;&lt;br /&gt;Call &lt;/span&gt;CloseHandle(shProcID) &lt;span style="color:#008000;"&gt;'Close the process id handle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;DoEvents &lt;span style="color:#008000;"&gt;'free any pending messages from the message queue&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Now what if we had to monitor two or more shelled applications? are we going to use multithreading?&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;I haven't yet implemented multithreading api in a vb.net project of mine but as you most&lt;br /&gt;know,&lt;/span&gt; &lt;span style="font-family:Tahoma;font-size:85%;"&gt;ultithreading is lethal (basically for those who will implement the CreateThread API function) when used within Visual Basic 6 (or prior).&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Crashes, unexpected terminations, exceptions&lt;/span&gt; &lt;span style="font-family:Tahoma;font-size:85%;"&gt;and many other "beautifull" encounters are some of the experiences a programmer can get.&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;The answer comes from WaitForMultipleObjects API function which is also included in kernel32.dll&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Here is the declaration :&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; WaitForMultipleObjects&lt;span style="color:#0000ff;"&gt; Lib&lt;/span&gt; "kernel32" &lt;span style="color:#0000ff;"&gt;Alias&lt;/span&gt; "WaitForMultipleObjects"(&lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; nCount &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;, lpHandles&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; bWaitAll&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;, ByVal dwMilliseconds &lt;span style="color:#0000ff;"&gt;AsLong&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;it accepts four values :&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;b&gt;nCount&lt;br /&gt;&lt;/b&gt;as the maximum number of events to monitor,&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;b&gt;lpHandles&lt;br /&gt;&lt;/b&gt;as the array of different event handles (not multiple copies of the same one),&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;b&gt;bWaitAll&lt;/b&gt; (True/False) True if it must return when the state of all objects is signaled, &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;False if it must return when the state of any one of these objects gets signaled,&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;b&gt;dwMilliseconds&lt;/b&gt;&lt;br /&gt;as a maximum time-out interval&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Like WaitForSingleObject, WaitForMultipleObjects can accept event handles of any of the following object types &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;in&lt;br /&gt;the &lt;i&gt;lpHandles&lt;/i&gt; : Change notification, Console input, Waitable timer,Event, Job, Mutex, Process, Semaphore&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;and Threads. &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;In the following example we are going to try something else than monitoring multiple shelled apps; &lt;/span&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Those of you that have ICQ installed, have noticed that "red flower" icon, placed on the system tray.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;When you are not connected on the internet, ICQ makes this icon look like inactive.&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Now when you connect, it suddently starts to get one by one of it's leaf green,meaning that it tries to &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;connect&lt;br /&gt;to it's main server and when the connection completes, the flower get's green.&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;How do they do it? I mean. do they have an IsConnected() function on a timer with some interval?&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Definetly no!&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;What they do is take advantage of WaitForMultipleObjects with another function located in rasapi32.dll; RasConnectionNotification &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;The RasConnectionNotification function specifies an event object that the system sets to the signaled state when &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;a RAS connection is created or terminated. &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;The function accepts three values :&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;b&gt;hrasconn&lt;/b&gt;as the handle to a RAS connection &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;b&gt;hEvent&lt;/b&gt; as the handle to an event object &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;b&gt;dwFlags&lt;/b&gt;as the type of event to receive notifications for (RASCN_Connection or RASCN_Disconnection)&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;Nowwe are going to use WaitForMultipleObjects to monitor both events&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; RASCN_Connection = &amp;H1 &lt;span style="color:#008000;"&gt;'Our two flags&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; RASCN_Disconnection = &amp;amp;H2&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; WAIT_FAILED = &amp;HFFFFFFFF&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; WAIT_OBJECT_0 = &amp;amp;H0&amp;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; WAIT_ABANDONED = &amp;amp;H80&amp;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Const&lt;/span&gt; WAIT_TIMEOUT = &amp;amp;H102&amp;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Type&lt;/span&gt; SECURITY_ATTRIBUTES&lt;br /&gt;nLength &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;lpSecurityDescriptor &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;bInheritHandle &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;End Type&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; CreateEvent &lt;span style="color:#0000ff;"&gt;Lib&lt;/span&gt; "kernel32" &lt;span style="color:#0000ff;"&gt;Alias&lt;/span&gt;"CreateEventA" (lpEventAttributes &lt;span style="color:#0000ff;"&gt;As&lt;/span&gt;SECURITY_ATTRIBUTES, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; bManualReset &lt;span style="color:#0000ff;"&gt;AsLong&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; bInitialState &lt;span style="color:#0000ff;"&gt;AsLong&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; lpName &lt;span style="color:#0000ff;"&gt;AsString&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; RasConnectionNotification &lt;span style="color:#0000ff;"&gt;Lib&lt;/span&gt; "rasapi32.dll"&lt;span style="color:#0000ff;"&gt; Alias&lt;/span&gt; "RasConnectionNotificationA" (hRasConn &lt;span style="color:#0000ff;"&gt;AsLong&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; hEvent &lt;span style="color:#0000ff;"&gt;AsLong&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; dwFlags &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; WaitForMultipleObjects &lt;span style="color:#0000ff;"&gt;Lib&lt;/span&gt; "kernel32" (&lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; nCount&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;, lpHandles &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;,&lt;span style="color:#0000ff;"&gt; ByVal&lt;/span&gt; bWaitAll &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;,&lt;span style="color:#0000ff;"&gt; ByVal&lt;/span&gt; dwMilliseconds &lt;span style="color:#0000ff;"&gt;AsLong&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; ResetEvent &lt;span style="color:#0000ff;"&gt;Lib&lt;/span&gt; "kernel32"(&lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; hEvent &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;)&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Public Declare Function&lt;/span&gt; CloseHandle &lt;span style="color:#0000ff;"&gt;Lib&lt;/span&gt; "kernel32" (&lt;span style="color:#0000ff;"&gt;ByVal&lt;/span&gt; hObject&lt;span style="color:#0000ff;"&gt; As Long&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Public Sub&lt;/span&gt; MonitorRASStatusAsync()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Dim&lt;/span&gt; hEvents(1) &lt;span style="color:#0000ff;"&gt;As Long &lt;/span&gt;&lt;span style="color:#008000;"&gt;'Array of event handles. Since there are two events we'd like to monitor, i have already&lt;br /&gt;dimention it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Dim&lt;/span&gt; RasNotif &lt;span style="color:#0000ff;"&gt;As Long &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Dim&lt;/span&gt; WaitRet &lt;span style="color:#0000ff;"&gt;As Long &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Dim&lt;/span&gt; sd &lt;span style="color:#0000ff;"&gt;As&lt;/span&gt; SECURITY_ATTRIBUTES&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Dim&lt;/span&gt; hRasConn &lt;span style="color:#0000ff;"&gt;As Long&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;hRasConn = 0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#008000;"&gt;'We are going to create and register two event objects with CreateEvent API function&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'There aren't any special treated events that need any kind of security attributes sowe just initialize the structure&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;With&lt;/span&gt; sd&lt;br /&gt;.nLength = Len(sd) &lt;span style="color:#008000;"&gt;'we pass the length of sd &lt;/span&gt;&lt;br /&gt;.lpSecurityDescriptor = 0&lt;br /&gt;.bInheritHandle = 0&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;End With&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'We create the event by passing in CreateEvent any security attributes, &lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'we want to manually reset the event after it gets signaled,&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'we also want it's initial state not signaled assuming that we don't have yet any connection to the internet,&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;'last but not least we give the event a name (RASStatusNotificationObject1)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;hEvents(0) = CreateEvent(sd, &lt;span style="color:#0000ff;"&gt;True&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;False&lt;/span&gt;, "RASStatusNotificationObject1")&lt;br /&gt;&lt;span style="color:#008000;"&gt;'If the returned value was zero, something went wrong so exit the sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;If&lt;/span&gt; hEvents(0) = 0&lt;span style="color:#0000ff;"&gt; Then&lt;/span&gt; MsgBox "Couldn't assign an event handle": &lt;span style="color:#0000ff;"&gt;Exit Sub&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'If we succesfully created the first event object we pass it toRasConnectionNotification&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'with the flag RASCN_Connection so that this event will monitor for internet connection&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;RasNotif = RasConnectionNotification(ByVal hRasConn, hEvents(0), RASCN_Connection)&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;If&lt;/span&gt; RasNotif &lt;&gt; 0 &lt;span style="color:#0000ff;"&gt;Then&lt;/span&gt; MsgBox "Ras Notification failure":&lt;span style="color:#0000ff;"&gt; GoTo&lt;/span&gt; ras_TerminateEvent&lt;br /&gt;&lt;span style="color:#008000;"&gt;'We create the second event object exactly like the first one&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'but we name it &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;RASStatusNotificationObject2&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;hEvents(1) = CreateEvent(sd,&lt;span style="color:#0000ff;"&gt;True&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;False&lt;/span&gt;, "RASStatusNotificationObject2")&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;If&lt;/span&gt; hEvents(1) = 0 &lt;span style="color:#0000ff;"&gt;Then&lt;/span&gt; MsgBox "Couldn't assignan event handle": &lt;span style="color:#0000ff;"&gt;Exit Sub&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'If we succesfully created the second event object too, we pass it toRasConnectionNotification&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'with the flag RASCN_Disconnection. This event will monitor for disconnection&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;RasNotif = RasConnectionNotification(ByVal hRasConn, hEvents(1), RASCN_Disconnection)&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;If &lt;/span&gt;RasNotif &lt;&gt; 0 &lt;span style="color:#0000ff;"&gt;Then&lt;/span&gt; MsgBox "Ras Notification failure":&lt;span style="color:#0000ff;"&gt; GoTo&lt;/span&gt; ras_TerminateEvent&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'We then issue the loop&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'Notice that we have put hEvents array to it's first array item.&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'and we used False cause we want to get notifications&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;'whenany of the two events occur.&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Do&lt;/span&gt;&lt;br /&gt;WaitRet = WaitForMultipleObjects(2, hEvents(0),&lt;span style="color:#0000ff;"&gt;False&lt;/span&gt;, 20)&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Select Case&lt;/span&gt; WaitRet&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Case&lt;/span&gt; WAIT_TIMEOUT&lt;br /&gt;DoEvents&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Case&lt;/span&gt; WAIT_FAILED &lt;span style="color:#0000ff;"&gt;Or&lt;/span&gt; WAIT_ABANDONED&lt;span style="color:#0000ff;"&gt;Or&lt;/span&gt; WAIT_ABANDONED + 1&lt;br /&gt;GoTo ras_TerminateEvent&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Case &lt;/span&gt;WAIT_OBJECT_0&lt;br /&gt;MsgBox "Connected"&lt;br /&gt;&lt;br /&gt;ResetEvent hEvents(0)&lt;span style="color:#008000;"&gt; 'Reset the event to avoid a second message box &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;DoEvents &lt;span style="color:#008000;"&gt;'Free any pending messages&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Case&lt;/span&gt; WAIT_OBJECT_0 + 1&lt;br /&gt;MsgBox "Disconnected"&lt;br /&gt;ResetEvent hEvents(1) &lt;span style="color:#008000;"&gt;'Reset the event to place it in nosignal state (Manual reset, remember?)&lt;/span&gt;&lt;br /&gt;DoEvents&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;End Select&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Loop&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;ras_TerminateEvent:&lt;br /&gt;&lt;span style="color:#008000;"&gt;'Close all event handles&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;color:#008000;"&gt;'For more than two events you could apply a For.. Next&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;Call&lt;/span&gt;CloseHandle(hEvents(1))&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;Call&lt;/span&gt; CloseHandle(hEvents(0))&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;br /&gt;DoEvents &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;&lt;span style="color:#008000;"&gt;'Free any pending messages from the application message queue&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Now imagine that you could monitor events from different objects like &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;a file or folder change, along with connection status, shelled applications, &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;multiple printer objects, different processes and threads etc etc etc.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;(64 maximum event objects i think)&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;I twill appear that you program is multithreading but the truth behind that, is &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;that you will be taking advantage of WaitForMultipleObjects internal &lt;/span&gt;&lt;span style="font-family:Tahoma;font-size:85%;"&gt;multithreading mechanism.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="MARGIN: 0px; WORD-SPACING: 0px; TEXT-INDENT: 0px; LINE-HEIGHT: 100%" align="left"&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33002948-115600110626675792?l=undim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://undim.blogspot.com/feeds/115600110626675792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://undim.blogspot.com/2006/08/simulate-multithreading-with.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/115600110626675792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/115600110626675792'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/2006/08/simulate-multithreading-with.html' title='Simulate multithreading with WaitForMultipleObjects (eg. How ICQ monitors connection state)'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33002948.post-115599900994582406</id><published>2006-08-19T06:50:00.001-07:00</published><updated>2007-10-23T14:56:01.420-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GetInputState'/><category scheme='http://www.blogger.com/atom/ns#' term='GetQueueStatus'/><category scheme='http://www.blogger.com/atom/ns#' term='doevents'/><title type='text'>DoEvents evolution; the API approach.</title><content type='html'>&lt;p&gt;Many of us have used several times DoEvents, to supply a bit of air to our App, on heavy-duty times such as loops for updates or inserts on recordsets etc. As we most know, DoEvents processes Windows messages currently in the message queue. But what if we wanted to execute DoEvents only in times, when we want to allow user (Keyboard and Mouse) input?&lt;br /&gt;&lt;br /&gt;If there was such a function to inspect the message queue for user input, we would have a main benefit:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;We would speed up our loops ‘cause we would process all the messages in&lt;br /&gt;the queue (with DoEvents) only on user input. It’s &lt;u&gt;faster&lt;/u&gt; to check for&lt;br /&gt;a message than to process all messages every time.&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;API provides us with such a function: It’s called GetInputState and you can locate it in user32 library.&lt;br /&gt;&lt;br /&gt;Here is the declaration: &lt;/p&gt;&lt;p&gt;Public Declare Function GetInputState Lib"user32" () As Long&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The GetInputState function determines whether there are mouse-button or keyboard messages in the calling thread's message queue. If the queue contains one or more new mouse-button or&lt;br /&gt;keyboard messages, the return value is nonzero else if there are no new mouse-button or keyboard messages in the queue, the return value is zero.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;So we can create an improved DoEvents with a Subroutine&lt;br /&gt;like this :&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;div class="code"&gt;Public Sub newDoEvents()&lt;br /&gt;      If GetInputState() &lt;&gt; 0 then DoEvents&lt;br /&gt;End Sub &lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;You can use GetInputState() with many variations for example : &lt;/p&gt;&lt;br /&gt;&lt;div class="code"&gt;uCancelMode = False&lt;br /&gt;&lt;br /&gt;Do until rs.Eof&lt;br /&gt;&lt;br /&gt;Rs.AddNew&lt;br /&gt;&lt;br /&gt;(..your source here)&lt;br /&gt;&lt;br /&gt;Rs.Update&lt;br /&gt;&lt;br /&gt;Rs.MoveNext&lt;br /&gt;&lt;br /&gt;If GetInputState() &amp;lt;&amp;gt; 0 then&lt;br /&gt;&lt;br /&gt;DoEvents&lt;br /&gt;&lt;br /&gt;If uCancelMode Then Exit Do&lt;br /&gt;&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;Loop&lt;br /&gt;&lt;br /&gt;Msgbox “Finished.”&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;…or&lt;br /&gt;&lt;br /&gt;we could use it in a ScreenSaver e.t.c.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Let’s go a little further now and see what exactly is behind GetInputState().&lt;br /&gt;&lt;br /&gt;It is another API function located in User32 as well; GetQueueStatus()&lt;br /&gt;The GetQueueStatus function indicates the type of messages found in the calling thread's message queue. Here are the flags that GetQueueStatus uses :&lt;br /&gt;&lt;/p&gt;&lt;p&gt;QS_ALLEVENTS An input, WM_TIMER, WM_PAINT, WM_HOTKEY, or posted message is in the queue. &lt;/p&gt;&lt;p&gt;QS_ALLINPUT Any message is in the queue.&lt;br /&gt;&lt;br /&gt;QS_ALLPOSTMESSAGE A posted message (other than those listed here) is in the queue.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;QS_HOTKEY A WM_HOTKEY message is in the queue.&lt;br /&gt;&lt;br /&gt;QS_INPUT An input message is in the queue.&lt;br /&gt;&lt;br /&gt;QS_KEY A WM_KEYUP, WM_KEYDOWN, WM_SYSKEYUP, or WM_SYSKEYDOWN&lt;br /&gt;message is in the queue.&lt;br /&gt;&lt;br /&gt;QS_MOUSE A WM_MOUSEMOVE message or mouse-button message (WM_LBUTTONUP, M_RBUTTONDOWN, and so on).&lt;br /&gt;&lt;br /&gt;QS_MOUSEBUTTON A mouse-button message (WM_LBUTTONUP, WM_RBUTTONDOWN, and so on).&lt;br /&gt;&lt;br /&gt;QS_MOUSEMOVE A WM_MOUSEMOVE message is in the queue.&lt;br /&gt;&lt;br /&gt;QS_PAINT A WM_PAINT message is in the queue.&lt;br /&gt;&lt;br /&gt;QS_POSTMESSAGE A posted message (other than those listed here) is in the queue.&lt;br /&gt;&lt;br /&gt;QS_SENDMESSAGE A message sent by another thread or application is in the queue.&lt;br /&gt;&lt;br /&gt;QS_TIMER A WM_TIMER message is in the queue.&lt;br /&gt;&lt;br /&gt;(I believe that GetInputState() is a GetQueueStatus(QS_HOTKEY Or QS_KEY Or QS_MOUSEBUTTON))&lt;br /&gt;&lt;br /&gt;With these constants you can create your own GetInputState function that fits your needs. For example you can create a custom function that issues DoEvents when it’ll detects not only a Keyboard or Mouse Key input, but also a WM_PAINT signal.&lt;br /&gt;Why’s that? ‘cause in your loop you might need to update the screen so you must let your custom function process the specific signal.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Look at this :&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;Public Const QS_HOTKEY = &amp;H80&lt;br /&gt;Public Const QS_KEY = &amp;amp;H1&lt;br /&gt;Public Const QS_MOUSEBUTTON = &amp;H4&lt;br /&gt;Public Const QS_MOUSEMOVE = &amp;amp;H2&lt;br /&gt;Public Const QS_PAINT = &amp;H20&lt;br /&gt;Public Const QS_POSTMESSAGE = &amp;amp;H8&lt;br /&gt;Public Const QS_SENDMESSAGE = &amp;H40&lt;br /&gt;Public Const QS_TIMER = &amp;amp;H10&lt;br /&gt;Public Const QS_ALLINPUT = (QS_SENDMESSAGE Or QS_PAINT Or _ &lt;br&gt; QS_TIMER Or QS_POSTMESSAGE Or QS_MOUSEBUTTON Or QS_MOUSEMOVE Or _ &lt;br&gt;  QS_HOTKEY Or QS_KEY)&lt;br /&gt;Public Const QS_MOUSE = (QS_MOUSEMOVE Or QS_MOUSEBUTTON)&lt;br /&gt;Public Const QS_INPUT = (QS_MOUSE Or QS_KEY)&lt;br /&gt;Public Const QS_ALLEVENTS = (QS_INPUT Or QS_POSTMESSAGE Or QS_TIMER Or QS_PAINT Or QS_HOTKEY)&lt;br /&gt;&lt;br /&gt;Public Declare Function GetQueueStatus Lib "user32" (ByVal qsFlags As Long) As Long&lt;br /&gt;&lt;br /&gt;Public Function cGetInputState() &lt;/p&gt;&lt;p&gt;Dim qsRet As Long&lt;br /&gt;qsRet = GetQueueStatus(QS_HOTKEY Or QS_KEY Or QS_MOUSEBUTTON Or QS_PAINT)&lt;br /&gt;cGetInputState = qsRet&lt;br /&gt;End Function&lt;/div&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;With this function you can trigger the DoEvents to be executed only when the message queue contains Key input, Mouse button or a WM_PAINT signal.&lt;br /&gt;&lt;br /&gt;Call it like this….&lt;br /&gt;&lt;div class="code"&gt;&lt;br /&gt;. . if cGetInputState() &lt;&gt; 0&lt;br /&gt;then DoEvents&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33002948-115599900994582406?l=undim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://undim.blogspot.com/feeds/115599900994582406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://undim.blogspot.com/2006/08/doevents-evolution-api-approach.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/115599900994582406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/115599900994582406'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/2006/08/doevents-evolution-api-approach.html' title='DoEvents evolution; the API approach.'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33002948.post-115599705735090278</id><published>2006-08-19T06:50:00.000-07:00</published><updated>2006-08-19T07:37:45.620-07:00</updated><title type='text'>Hello to all of you inspired coders.</title><content type='html'>You have just landed to planet Visual Basic :-)&lt;br /&gt;&lt;br /&gt;This is an attempt for source code tips in Visual Basic, a language most favourite for most of the coders worldwide for it's easy to use and develop concept.&lt;br /&gt;&lt;br /&gt;Well, some times it can be rough. Real rough! (e.g. multithreading? windows services? errrr...) but in general, a coder can produce a really nice and easy solution.&lt;br /&gt;&lt;br /&gt;My first programming language was BASIC. I remember the early 80's having my first ZX81 by Sinclair with a memory expansion chip that upgraded it's memory to 64k (whoaaaa!!!)&lt;br /&gt;I wrote huge listings of BASIC just to play Centipede or Owlhunter (really cool games at that time). My storage media was a one hour cassette being played at my cassette player (Sinclair released some time later the ZX Spectrum having it's own cassette player) that took half an hour to load a decent game.... What a romantic decade of coding... (Macho finger muscles, i tell you)&lt;br /&gt;&lt;br /&gt;Then from Visual Basic 3 ( Windows 3.1), to Visual Basic 5 with component development to Visual Basic 6. Loads of options for the developer but still a huge gap in programming options.&lt;br /&gt;&lt;br /&gt;Microsoft did a large step in moving Visual Basic to a java-like form but still has lot to do regarding it's supported platforms, it's compiler and garbage collector etc etc etc....!&lt;br /&gt;&lt;br /&gt;Anyway, please welcome this effort and post your thoughts and opinions or your coding tips freely. Help us grow in inspiration :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33002948-115599705735090278?l=undim.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://undim.blogspot.com/feeds/115599705735090278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://undim.blogspot.com/2006/08/hello-to-all-of-you-inspired-coders.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/115599705735090278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33002948/posts/default/115599705735090278'/><link rel='alternate' type='text/html' href='http://undim.blogspot.com/2006/08/hello-to-all-of-you-inspired-coders.html' title='Hello to all of you inspired coders.'/><author><name>Admin</name><uri>http://www.blogger.com/profile/06500767688441008998</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos1.blogger.com/blogger/7125/3183/200/eye.0.jpg'/></author><thr:total>5</thr:total></entry></feed>
