
Cut, copy, and paste using API functions
Copying and pasting text and images programmatically isn’t difficult at all, using the methods of the Clipboard object. However, implementing a generic Edit menu that copies and pastes the highlighted

Copying and pasting text and images programmatically isn’t difficult at all, using the methods of the Clipboard object. However, implementing a generic Edit menu that copies and pastes the highlighted

If a form contains a RichTextBox control and other controls that are capable to receive the input focus, when the focus is on the RichTextBox and the user presses the

Private Declare Function SendMessage Lib “user32” Alias “SendMessageA” (ByVal _ hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _ lParam As Any) As LongPrivate Const WM_USER As

In some cases you might want to activate a form given its name, but VB doesn’t let you do it directly. However, it is easy to create a function that

Private Declare Function SetFileAttributes Lib “kernel32” Alias _ “SetFileAttributesA” (ByVal lpFileName As String, ByVal dwFileAttributes As _ Long) As Long’ Associate an icon to a folder, by creating a desktop.ini

Private Const HKEY_CLASSES_ROOT = &H80000000Private Const HKEY_CURRENT_CONFIG = &H80000005Private Const HKEY_CURRENT_USER = &H80000001Private Const HKEY_LOCAL_MACHINE = &H80000002Private Const HKEY_USERS = &H80000003’Save the specified registry’s key and (optionally) its subkeys to

‘ Load the specified REG file in the registryPrivate Sub ApplyRegFile(ByVal sRegFile As String) On Error Resume Next ‘first of all, check if the file exists If Not (GetAttr(sRegFile) And

Private Type PRINTER_INFO_2 pServerName As String pPrinterName As String pShareName As String pPortName As String pDriverName As String pComment As String pLocation As String pDevMode As Long pSepFile As String

‘ Open a single pane Explorer window’ sRoot is the root folder to open’ bUpwardAllowed specifies whether the user will be allowed to navigate ‘ upward the root” Example:’ OpenSinglePaneExplorer