Enumerate Services to Collection

Here is a class and module that enumerates the services on a Windows computer. It gets each service and puts its info into a public collection which can be used anywhere in the program. The attached ZIP file contains the full class module, as well as the standard module. Usage Option Explicit Private Sub Command1_Click()   Dim x As clsService   Dim… Read More »

Start, Stop, Pause and Get Status of Services

Using the Windows API, you can easily work with Windows services. This module makes it even easier, allowing you to query status, stop, start, and pause services, on the local machine or remote computers. Option Explicit ‘API ConstantsPublic Const SERVICES_ACTIVE_DATABASE = “ServicesActive”‘ Service ControlPublic Const SERVICE_CONTROL_STOP = &H1Public Const SERVICE_CONTROL_PAUSE = &H2’ Service State – for CurrentStatePublic Const… Read More »

Logoff, Shutdown or Restart via API

This handy module will let you perform end-of-session functions,such as logging off the current user, shutting down or restarting the computer. Option Explicit ‘API constantsPrivate Const EWX_LOGOFF = 0Private Const EWX_SHUTDOWN = 1Private Const EWX_REBOOT = 2Private Const EWX_FORCE = 4Private Const TOKEN_ADJUST_PRIVILEGES = &H20Private Const TOKEN_QUERY = &H8Private Const SE_PRIVILEGE_ENABLED = &H2Private Const ANYSIZE_ARRAY = 1Private Const… Read More »

Initiate Shutdown or Restart of Specified Computer

Explains how to initiate a shutdown or restart of a local or remote machine. Note that you have to run this with an account that has permission to execute the shutdown/restart on the specified machine. If dwTimeout is not zero, InitiateSystemShutdown displays a dialog box on the specified computer. The dialog box displays the name of the user… Read More »

Search Engine

Searches various files on the hard disk depending on the search criteria entered by the user. See the attachement for the zip containing the project files. Attachments File Uploaded Size 967-20190822-115749-searchengine.zip 8/22/2019 11:57:49 AM 39782

Remove Extra Spaces from a String

Here is a quick little function to remove extra spaces from within in a string, which might be of help when processing user inputs. Public Function RemoveExtraSpaces(str As String) As String   str = Trim(str)   Dim L As Integer, i As Integer  Dim S As String  Dim Prev_char As String * 1   S = “”   L = Len(str)  i = 1  Do    Prev_char =… Read More »

Protect Form from Accidental Unloading

When you want ot protect the form unload in accidently you can use this following code. In this code, the action is When a form is prepared to unload The unload event was automatically raised on that event there is an parameter named “Cancel” which in the data type integer. When the unload event is raised the “cancel”… Read More »

Determine Even/Odd and Primeness

This is a simple demonstration of one way to determine if a number is even/odd, or prime/not prime. There is very minimal error checking, and the demo can only handle numbers in the range of a long integer. It’s a pretty simple program, meant for beginners to get an idea of how to accomplish this. If you have… Read More »

Simple 3D Text on a Form

Here is some simple code that makes the printed text look sorta 3d, with no OCX or API. Private Sub Form_Load()    Dim ShadowX   Dim ShadowY            ‘Clear Form1   Form1.ScaleMode = 3      ‘Set Scalemode to pixel   Form1.ForeColor = vb3DShadow ‘Change the Forecolor of            ‘Form1 to Shadow Color (Dark grey)   ShadowY = 5         ‘Set The Top of the Shadow   ShadowX = 5      ‘Set The Left of the Shadow   For I = 0… Read More »

11 API Functions for VB6

Here is another handy module from extreme-vb.net. This one covers eleven (11) API-based functions. Notice This content originally appeared on on extreme-vb.net. Permission from Bob Schwarz has been granted to included it here for archival purposes. We can’t reach the future without a bridge to the past. The below table contains a list of the functions, along with… Read More »