|
|
|
|
|
|
AlwaysOnTheTop - Move a form on top of all other windows
|
Total Hit (2178) |
«Code LangId=1»
Private Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_SHOWW
....Read More |
Rating
|
|
|
|
Monday - retrieving the date of the Monday for a specified week
|
Total Hit (2703) |
«Code LangId=1»
' Return the date of the Monday for a specified week..
' This function can be tweaked to return any weekday. I use it in Access to
' subdivide reports into weekly units, since Access displays only a number
' between 1 and 53 for the week when you group dates by week.
'
' Note
....Read More |
Rating
|
|
|
TimeToString - Convert time to a descriptive string
|
Total Hit (3774) |
«Code LangId=1»' convert a date value into a string in the format
' YY years, MM months, DD days, HH hours, MM minutes, SS.HH seconds)
' you can also opt for time short format (HH h, MM m, SS s)
Function TimeToString(ByVal aDate As Date, Optional ShortTimeFormat As Boolean, _
Optional
....Read More |
Rating
|
|
|
JoinQuoted - A Join variant that encloses string values in quotes
|
Total Hit (1598) |
«Code LangId=1»' Join variant that works with arrays of any type
' and that encloses string values between quotes
'
' ARR is the array whose element must be joined
' SEPARATOR is the separator char (default is comma)
' QUOTED is the character used to quote string values
' use a two-char st
....Read More |
Rating
|
|
|
|
Setting authentication across different domains
|
Total Hit (1423) |
COM doesn't have a built in security mechanism, but relies on Windows authentication services (Security Service Providers). When you access a resource or invoke a method in a remote DCOM server (or MTS package / COM+ Application), security checks cannot be performed in the standard way if the client
....Read More |
Rating
|
|
|
How did Windows start?
|
Total Hit (2971) |
If you need to know how Windows was started you have just to call an API function: GetSystemMetrics. Passing the SM_CLEANBOOT constant as parameter, the function returns a Long value with this meaning:
«Code LangId=1»
0 = Normal boot
1 = Fail-safe boot
2 = Fail-safe with network boot
«/Code»
....Read More |
Rating
|
|
|
Check whether the current user is an administrator
|
Total Hit (5008) |
This function will determine whether or not a thread is running in the user context of the local Administrator account. You need to examine the access token associated with that thread using the GetTokenInformation() API, since this access token represents the user under which the thread is running.
....Read More |
Rating
|
|
|
Test for Leap Year
|
Total Hit (3208) |
As long as you trust VB's IsDate function (and you can, trust me), here's the shorted and fastest method to check if a year is a leap year or not:
«Code LangId=1»
Function IsLeapYear(year As Integer) As Boolean
IsLeapYear = IsDate("2/29/" & CStr(year))
End Function
«/Code»
Here's is anot
....Read More |
Rating
|
|
|
The number of dimensions of an array
|
Total Hit (4011) |
Using "pure" VB, the only way to build a generic routine that returns the number of dimensions of an array passed as an argument is using a loop that repeatedly tests the LBound (o UBound) function until it fails:
«Code LangId=1»
Function ArrayDims(arr As Variant) As Integer
Dim i As Intege
....Read More |
Rating
|
|
|
|
|
|
|
Locking Removable Media Devices Using DeviceIoControl
|
Total Hit (1507) |
Using DeviceIoControl, together with the PREVENT_MEDIA_REMOVAL data user-defined type and the IOCTL_STORAGE_MEDIA_REMOVAL control code, it is possible for WinNT/Win2000 users to lock and unlock any removable device. A removable device might include, as it does on my system, CD-ROMs and LS-120 drive
....Read More |
Rating
|
|
|
Obtaining Processor Information using WMI
|
Total Hit (1316) |
Windows Script Host is built into Microsoft Windows 98, 2000, ME and XP. If you are running Windows 95 or NT4, you can download Windows Script Host from the Microsoft Windows Script Technologies Web site at http://msdn.microsoft.com/scripting/. Some information is not returned on non-NT-based system
....Read More |
Rating
|
|
|
|
Enumerating the Available Display Resolutions
|
Total Hit (1605) |
This routine uses Windows' EnumDisplaySettings API to retrieve all the available screen resolutions supported by the display. The results are populated to a ListView showing colour depths, resolutions and frequencies supported. In addition, the current system resolution is determined and flagged.
....Read More |
Rating
|
|
|
|
Add a Check Box to the Left Hand Side of a Drop-Down Combo Box
|
Total Hit (1776) |
In Microsoft's Outlook Express, there is a find window which allows you to set a date range to search in. You turn this date range on and off by clicking a check box which is embedded in the left hand side of the combo box. The text of the combo box is moved to the left to accommodate the check box.
....Read More |
Rating
|
|
|
|
Using Popup Menu ActiveX DLL to create SysTray Menus with Icons
|
Total Hit (2452) |
This sample shows how to use the newly introduced ShowPopupAbsolute method of the PopupMenu ActiveX DLL to implement a icon menu in the SysTray.
The code expands upon the "SysTray the Easy Way" sample. Essentially this project uses a VB form as a class which exposes an easy to use interface for a
....Read More |
Rating
|
|
|
Enabling Mouse Gestures with a WH_MOUSE hook
|
Total Hit (2246) |
Use of mouse gestures to control application is becoming increasingly common in the more sophisticated web browsers. This sample demonstrates how you can support a range of mouse gestures in a Visual Basic application using a Windows Hook.
|
Rating
|
|
|