|
|
|
|
|
|
|
GetFilebaseName - Retrieve the base portion in a file name
|
Total Hit (1659) |
«Code LangId=1»' Retrieve a file's base name
' if the second argument is true, the result include the file's path
Function GetFileBaseName(FileName As String, Optional ByVal IncludePath As _
Boolean) As String
Dim i As Long, startPos As Long, endPos As Long
startPos = 1
....Read More |
Rating
|
|
|
GetRoshHashanah - Get the date of Rosh Hashanah (Jewish calendar)
|
Total Hit (2936) |
«Code LangId=1»' Returns the date that Rosh Hashanah begins
' for the requested year. It is important to note that
' Rosh Hashanah is based on the Lunar cycle so the Holiday
' actually begins at sunset of the day before the date
' returned by this function.
' Note: Many dates in the Jewish
....Read More |
Rating
|
|
|
|
Reduce context overhead for COM+ components
|
Total Hit (1547) |
Instances of configured components, that is, components configured in COM+, get runtime services owing to context objects. When you instantiate a COM+ component, your instance will live in a context object. When you call a method of your instance, the call will go through the context and that is whe
....Read More |
Rating
|
|
|
Display the Windows Shortcut Wizard
|
Total Hit (2705) |
You can programmatically start the Shortcut Wizard from your code, to give the end user the capability to create a new shortcut:
«Code LangId=1»
Shell "rundll32.exe AppWiz.Cpl, NewLinkHere " & App.Path, 1
«/Code»
|
Rating
|
|
|
Creating help string for Enum constants
|
Total Hit (3117) |
I've been trying to find a way to assign helpstrings for Enums in Visual Basic. The Class builder utility does that only for methods, events, and properties, but not for Enums.
The IDL source code that corresponds to an Enum in a type library looks something like follws, and you can run the MIDL
....Read More |
Rating
|
|
|
Updating records in DataList and ADO Data Controls
|
Total Hit (4045) |
If you use a DataList control linked to an ADO Data Control and if you want to add a record, you have to create a command button with this code:
«Code LangId=1»
Private Sub cmdAdd_Click()
On Error GoTo AddErr
datPrimaryRS.Recordset.AddNew
txtNew.SetFocus
Exit Sub
AddErr:
MsgBox
....Read More |
Rating
|
|
|
Selecting an entire row in a ListView
|
Total Hit (3790) |
The ListView control that comes with VB6 lets you select an entire row by setting its FullRowSelect property to True. If you are working with VB5 or you're using VB6 with the old version of the Microsoft Windows Controls this capability isn't avaible, but if you have installed the comctl32.dll versi
....Read More |
Rating
|
|
|
Highlight the contents of a control on entry
|
Total Hit (1873) |
Here's a simple way to highlight the current word in a TextBox control (i.e. the word where the caret is):
«Code LangId=1»
Text1.SetFocus
SendKeys "^{LEFT}+^{RIGHT}"
«/Code»
Similarly, you can highlight the current line in a multiline TextBox control as follows: «Code LangId=1»
Text1.SetFo
....Read More |
Rating
|
|
|
Avoid beeps on forms without a default button
|
Total Hit (4069) |
If a form contains one CommandButton control whose Default property is set to True, the Enter key activates the CommandButton. If the form doesn't contain any default CommandButton control, however, pressing the Enter key when the focus is inside a TextBox control (and a few other controls as well)
....Read More |
Rating
|
|
|
|
Print a Text File
|
Total Hit (2520) |
Module
«Code LangId=1» Option Explicit
Public Sub PrintTXTFile(FileName As String)
Dim x As Integer
Dim s As String
x = FreeFile
On Error GoTo HandleError
Open FileName For Input As x
Do While Not EOF(x)
Line Input #x, s
Printer.Print s
L
....Read More |
Rating
|
|
|
Print Dialogbox without using Common Dialogbox ActiveX control
|
Total Hit (5016) |
This code will show you use of PrintDialog API to show print dialogbox.
«b»Step-By-Step Example«/b»
- Create a standard exe project
- Add one class module
- Rename it to clsPrnDlg
- Add one command button on form1
- Place the following code in form1
«code LangId=1»Private Sub Command1_C
....Read More |
Rating
|
|
|
|
|
How to enumerate available monitor on your system ?
|
Total Hit (4143) |
If you are working with multiple monitors then this example will show you how to enumerate available monitors on your sytem and retrive properties of monitor.
«b»Step-By-Step Example«/b»
- Create a standard exe project
- Add one Module to project
- Place one textbox on form1, set MultiLine=T
....Read More |
Rating
|
|
|
How to display balloon style tooltip (Updated)
|
Total Hit (16950) |
Using api you can create ballon style tooltip. You can also set varous parameter for tooltip i.e. Delay time, Style, Color, font etc...
I have used IFont to get font handle from StdFont but IFont may create problem sometimes. Check the following article to convert StdFont to APIFont
«a href='h
....Read More |
Rating
|
|
|
How to shutdown remote machine on a network using API.
|
Total Hit (4960) |
This demo will show you how to shutdown remote machine in a specified interval. When you shutdown machine you will see following warning message.
«BR»«P Align=center»«img src='/Main/Articles/Lang1/Cat3/Code3580/image3580_1.gif'/»«/P»«BR»
«b»For Quick Demo«/b»
1. Start a new project in Vis
....Read More |
Rating
|
|
|
Tutorial - ListView Control Introduction
|
Total Hit (1779) |
The list view control is basically and advanced ListBox. This control allows you to add rows of data, but it also supports large and small icons, multiple columns, automatic label edit, column re-order, hot-tracking, the four main modes that you see in explorer:
Icon - Displays items with large i
....Read More |
Rating
|
|
|
Using GetDiskFreeSpaceEx on 32-bit Windows
|
Total Hit (1431) |
This page presents four key wrapper routines for the data returned by the GetDiskFreeSpaceEx API. It works on both Win95 and Win95 OSR2, as well as Win98, NT4 Windows 2000 and Windows XP. By checking for the proc address of the GetDiskFreeSpaceExA API in kernel32.dll, which will only return a valid
....Read More |
Rating
|
|
|
Browsing in Win32/NT4 - An Overview
|
Total Hit (1741) |
Details on the ITEMIDLIST, SHITEMID, BROWSEINFO structures, and the SHGetSpecialFolderLocation, SHGetPathFromIDList and SHBrowseForFolder APIs.
|
Rating
|
|
|
Colour Depth Control
|
Total Hit (662) |
In VB, you cannot change the colour depth of a bitmap. This article presents classes allowing you to reduce or increase the colour depth using a number of different methods and also to save the resulting image to disk as a bitmap with the specified colour depth.
....Read More |
Rating
|
|
|
Getting the Correct Filename for a Shortcut
|
Total Hit (2422) |
If your application creates or otherwise manipulates shortcuts then you should use the Operating System to determine what the filename for the shortcut should be, as the extension is subject to i18n. This article demonstrates how to use the SHGetNewLinkInfo API call to do this, and also provides a h
....Read More |
Rating
|
|
|
Tutorial : Retrieving FTP directory listing
|
Total Hit (2367) |
This tutorial will show you how to use the CFtpClient class in order to retrieve FTP directory listing and navigate between FTP directories. We'll improve the sample application that we're creating in the previous tutorials by adding the ListView control that will display content of the current FTP
....Read More |
Rating
|
|