ISMagazine.com

Developers Corner

May, 1999

Printers and Fonts Folders in Visual Basic 4.0

Include the Printers of Fonts folders in Win95 for your application; use the following syntax for Printers:

x = Shell("C:\windows\rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder", 1)

For Fonts:

x = Shell("C:\windows\rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL FontsFolder", 1)

The Recycle Bin inVisual Basic

The Recycle Bin is great for stopping files for permanently being deleted off your hard disk. To use this inside your VB code, create a new form and paste the code below into the General Declarations section of the form. To delete a file, just call the DeleteFileToRecycleBin procedure with the filename as a parameter, e.g. Call DeleteFileToRecycleBin("C:\temp\filetodelete.tmp")

Private Type SHFILEOPSTRUCT

hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As Long

End Type

Private Declare Function SHFileOperation Lib "shell32.dll" Alias _
"SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long

Private Const FO_DELETE = &H3
Private Const FOF_ALLOWUNDO = &H40
Private Const FOF_NOCONFIRMATION = &H10
Private Const FOF_SLIENT = &H4
Private Sub DeleteFileToRecycleBin(ByVal Filename As String)
Dim op As SHFILEOPSTRUCT
Dim Ret As Long

With op
.wFunc = FO_DELETE
.pFrom = Filename
.fFlags = FOF_ALLOWUNDO
End With

Ret = SHFileOperation(op)

End Sub

National Book eXchange

The Online College Book Exchange

Exchange your college textbooks with students from across the country and around the world. Post your current books, old edition books, classroom materials, and optional study guides for any college course.

Determine the price you want or negotiate through email with interested students


www.angelfire.com/biz/nationalbx

1 2 3 4 5 6 7 8 9 11 12 13 14 15 16