|
|
|
|
|
|
|
|
MakePath - Create a nested directory
|
Total Hit (1833) |
«Code LangId=1»' create a nested directory
'
' it's similar to MkDir, but it also creates
' all intermediary sub-directories
Sub MakePath(ByVal path As String)
Dim i As Integer, ercode As Long
On Error Resume Next
Do
' get the next path chunk
i = InStr(i
....Read More |
Rating
|
|
|
|
TimeToString - Convert time to a descriptive string
|
Total Hit (3780) |
«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
|
|
|
|
Setting authentication across different domains
|
Total Hit (1425) |
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
|
|
|
Play an AVI movie
|
Total Hit (5117) |
If you want to play an AVI movie from VB you can use MCI functions. The main MCI function is mciSendString, that sends command strings to the system and execute them:
«Code LangId=1»
Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal _
lpstrCommand As String, ByVal lps
....Read More |
Rating
|
|
|
Check whether the current user is an administrator
|
Total Hit (5017) |
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
|
|
|
The number of dimensions of an array
|
Total Hit (4022) |
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
|
|
|
Fixed-length strings allocate and deallocate faster
|
Total Hit (2692) |
Fixed-length strings are generally slower than conventional strings, because all VB string functions and operators only recognize conventional strings, thus all fixed-length strings must be transparently converted to and from conventional strings.
However, arrays of fixed-length strings occupy a
....Read More |
Rating
|
|
|
Taking advantage of EFS (Encrypted File System) APIs in Win2K/XP
|
Total Hit (4921) |
The Encrypted File System, or EFS, was introduced in version 5 of NTFS to provide an additional level of security for files and directories. It provides cryptographic protection of individual files on NTFS volumes using a public-key system. Typically, the access control to file and directory objects
....Read More |
Rating
|
|
|
Interprocess communication using DDE (Dynamic Data Exchange) - Part2
|
Total Hit (9855) |
In our previous article «b»«a href='CodeDetail.aspx?CodeId=3767'»Interprocess communication using DDE (Dynamic Data Exchange) - Part1«/a»«/b» of this this series we learned about basic concept of DDE and we also saw that how to implement DDE Server using DDEML Apis. Now in this article I will show y
....Read More |
Rating
|
|
|
|
|
|
|
Locking Removable Media Devices Using DeviceIoControl
|
Total Hit (1514) |
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
|
|
|
Customizing the ListView's Appearance via API
|
Total Hit (1562) |
Once again, the SendMessage API, in conjunction with the new extended style flags for the ListView control, provides a means to customize the appearance of the listview common control in a Visual Basic application.
By combining the new LVBKIMAGE structure (Type), and specifying the LVBKIF_SOURCE_U
....Read More |
Rating
|
|
|
How to Add Checkboxes to a ListView
|
Total Hit (1245) |
This page demonstrates adding the ability to have checkmarks to the left of the item icon in report view. Under Win95 the check boxes are not not pretty.
By setting a ListView extended style bit using the API SendMessage with the message LVS_EX_CHECKBOXES, the ListView rows will have a left-most
....Read More |
Rating
|
|
|
Enumerating the Available Display Resolutions
|
Total Hit (1612) |
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
|
|
|
|
Detecting Windows Settings Changes
|
Total Hit (2396) |
This tip demonstrates how to detect windows settings changes in your application. You will need to have installed and registered the Subclassing and Timer Assistant (SSubTmr.DLL for VB5 and SSubTmr6.DLL for VB6), available from this site at Subclassing without the crashes to run this sample.
....Read More |
Rating
|
|
|
|
Storing and Showing HTML Resources in a VB Application
|
Total Hit (1575) |
Since Internet Explorer 4, it is has been possible to display HTML directly from application resources using the res:// protocol. This article demonstrates how to embed HTML files and images into your application resources to use this function and encapsulate HTML files.
....Read More |
Rating
|
|