SSH Client using VBA

This post is a mixture or this one from Excely and this other one from MyEngineeringWorld, and has been completed with IP detectors, and download links for referred software.

 

 

SSH client and secure file transfer

On a day-to-day basis, it becomes necessary to upload/download files from/to the remote server. First of all, access to the server is need. It can be set up through FTP and SSH protocols by using such programs as PuTTY (is an opensource SSH and telnet client) or WinSCP (is an SFTP client and FTP client for Microsoft Windows). They will allow you to remotely connect a server to a PC and transfer files within the established network.

Let’s have a look at the example of using simple SSH client for uploading and downloading files based on Excel. It is possible to modify it to ease the automation of tasks on the remote server.

To access the server, we need to know the following:

  • IP address
  • Username
  • Password
  • SSH port (22 by default)

Graphical example can be found on a picture below:

ssh-client[1]

As it can be seen from above, there are three main functions used in the program: connection to the server, uploading and downloading files to/from the server

How to connect to SFTP

SFTP (Secure File Transfer Protocol) is similar to SSH protocol. However, it enables secure connection for transferring files not only remotely but locally as well. As the SSH protocol, SFTP has the same method of authentication. You will need to know:

  • Host name of the server;
  • Protocol of the server (SFTP, FTP, etc.);
  • Username;
  • Password.

Enter the data in the login dialog window to connect to SFTP.

How to upload files through SFTP

Before you start uploading files, make sure that your user account is connected to the SFTP server. To upload/download files, you might do the following: drag and drop icons (files) from one PC file system to another one; use copy/paste or choose an option “Send to” in a context menu.

Any changes relating SFTP settings can be made in the SFTP commander interface.

Calling PuTTY from Excel VBA

PuTTY which is a file transfer application can be opened manually or automatically depending on settings. To start PuTTY session from VBA, you will need a VBA command line. To open current VBA session in PuTTY, it is needed to enter following details in the login window:

  • Host name you are connecting to;
  • Username;
  • Password;
  • And press “Start PuTTY”.

All settings can be found in PuTTY configuration window

Download SSH Client (35 Kb)

Custom Message Box Buttons

This post came from Excely

To change the button caption for the Message Box (MsgBox) you need to use Windows Hooking API in your Excel VBA:

  • You must create a CBT hook
  • Run a Message Box with CBT hook
  • Catch a HCBT_ACTIVATE message in the Hook procedure
  • Set new cputions for the buttons using the SetDlgItemText function
    (example below changes “Yes” and “No” captions to smiles: “:-)” and “:-(” )
  • Release the CBT hook

Try this code to show a custom Msgbox with 🙂 and 🙁 as buttons:

[sourcecode language=’vb’]

Option Explicit
 
' Import
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
 
Private Declare Function SetDlgItemText Lib "user32" _
    Alias "SetDlgItemTextA" _
    (ByVal hDlg As Long, _
     ByVal nIDDlgItem As Long, _
     ByVal lpString As String) As Long
 
Private Declare Function SetWindowsHookEx Lib "user32" _
    Alias "SetWindowsHookExA" _
    (ByVal idHook As Long, _
     ByVal lpfn As Long, _
     ByVal hmod As Long, _
     ByVal dwThreadId As Long) As Long
 
Private Declare Function UnhookWindowsHookEx Lib "user32" _
    (ByVal hHook As Long) As Long
 
' Handle to the Hook procedure
Private hHook As Long
 
' Hook type
Private Const WH_CBT = 5
Private Const HCBT_ACTIVATE = 5
 
' Constants
Public Const IDOK = 1
Public Const IDCANCEL = 2
Public Const IDABORT = 3
Public Const IDRETRY = 4
Public Const IDIGNORE = 5
Public Const IDYES = 6
Public Const IDNO = 7
 
Public Sub MsgBoxSmile()
    ' Set Hook
    hHook = SetWindowsHookEx(WH_CBT, _
                             AddressOf MsgBoxHookProc, _
                             0, _
                             GetCurrentThreadId)
 
    ' Run MessageBox
    MsgBox "Smiling Message Box", vbYesNo, "Message Box Hooking"
End Sub
 
Private Function MsgBoxHookProc(ByVal lMsg As Long, _
                                ByVal wParam As Long, _
                                ByVal lParam As Long) As Long
 
    If lMsg = HCBT_ACTIVATE Then
        SetDlgItemText wParam, IDYES, ":-)"
        SetDlgItemText wParam, IDNO, ":-("
 
        ' Release the Hook
        UnhookWindowsHookEx hHook
    End If
 
    MsgBoxHookProc = False
End Function
[/sourcecode]

Range to PIC (bmp, jpg)

There are quite a few procedures out there dealing with how to load a graphical file inside Excel, getting it shown as cells colored.

But it’s a bit harder to find the inverse procedure. I’ve managed to retrieve the PIC file from the colored cells. The file generated can be either BMP either JPG, via vba pure code. I’ve to give credit to Korejwa from PlanetSourceCode for his fantastic code to get JPG codification.

Also PNG, GIF or TIFF can be achieved directly if converted through a Picture control, but the interesting part is the BMP and the JPG code.

ToDo:

  • BMP block for reducing size of canvas (need a bicubic interpolation function).
    JPG implementation in VBA from BMP data.
  • For the BMP file:
Option Explicit

Private Type typHEADER
    strType As String * 2  ' Signature of file = "BM"
    lngSize As Long        ' File size
    intRes1 As Integer     ' reserved = 0
    intRes2 As Integer     ' reserved = 0
    lngOffset As Long      ' offset to the bitmap data (bits)
End Type

Private Type typINFOHEADER
    lngSize As Long        ' Size of InfoHeader
    lngWidth As Long       ' Height
    lngHeight As Long      ' Length
    intPlanes As Integer   ' Number of image planes in file
    intBits As Integer     ' Number of bits per pixel
    lngCompression As Long ' Compression type (set to zero)
    lngImageSize As Long   ' Image size (bytes, set to zero)
    lngxResolution As Long ' Device resolution (set to zero)
    lngyResolution As Long ' Device resolution (set to zero)
    lngColorCount As Long  ' Number of colors (set to zero for 24 bits)
    lngImportantColors As Long ' "Important" colors (set to zero)
End Type

Private Type typBITMAPFILE
    bmfh As typHEADER
    bmfi As typINFOHEADER
    bmbits() As Byte
End Type

Public Sub sExcelToBMP()
    fExcelToBMP "C:\Test.BMP"
End Sub

Private Function fExcelToBMP(ByVal strFullPathFile_BMP As String)
    Dim iFileOut As Integer
    Dim bmpFile As typBITMAPFILE
    Dim lngRowSize As Long
    Dim lngPixelArraySize As Long
    Dim lngFileSize As Long
    Dim j As Long
    Dim k As Long
    Dim l As Long
    Dim x As Long
    Dim bytRed As Byte, bytGreen As Byte, bytBlue As Byte
    Dim lgColor As Long
    'Dim lngRGBColor() As Long
    Dim lgPixH As Long
    Dim lgPixV As Long
    Dim lgBlockH As Long
    Dim lgBlockV As Long

    ' Get canvas min-max
    Dim rgCanvas As Excel.Range
    Dim rgCell As Excel.Range
    Dim lgRowStart As Long
    Dim lgRowEnd As Long
    Dim lgColStart As Long
    Dim lgColEnd As Long

    Set rgCanvas = Application.InputBox(Prompt:="Select range to capture", Title:="Select range", Default:=Selection.Address(True, True), Type:=8)

    With rgCanvas
        lgBlockV = 1
        lgBlockH = 1

        lgPixH = .Columns.Count
        lgPixV = .Rows.Count
        lgRowStart = .Row
        lgRowEnd = lgRowStart + lgPixV - 1
        lgColStart = .Column
        lgColEnd = lgColStart + lgPixH - 1
    End With

    With bmpFile
        With .bmfh
            .strType = "BM"
            .lngSize = 0
            .intRes1 = 0
            .intRes2 = 0
            .lngOffset = 54
        End With

        With .bmfi
            .lngSize = 40 '= len(.bmfi)
            .lngWidth = lgPixH
            .lngHeight = lgPixV
            .intPlanes = 1
            .intBits = 24
            .lngCompression = 0
            .lngImageSize = 0
            .lngxResolution = 0
            .lngyResolution = 0
            .lngColorCount = 0
            .lngImportantColors = 0
        End With
        'lngRowSize = Round(.bmfi.intBits * .bmfi.lngWidth / 32) * 4
        lngRowSize = WorksheetFunction.Ceiling(.bmfi.intBits * .bmfi.lngWidth / 32, 0.5) * 4
        lngPixelArraySize = lngRowSize * .bmfi.lngHeight

        ReDim .bmbits(lngPixelArraySize)
        ReDim lngRGBColor(1 To lgPixV, 1 To lgPixH)

        k = -1
        For j = lgPixV To 1 Step -lgBlockV
        ' For each row, starting at the bottom and working up...
            'each column starting at the left
            For x = 1 To lgPixH Step lgBlockH
                '!!!!!!!!!!!!!!!!
                ' ToDo:
                ' Blend color...
                ' when block size is not 1x1 pixels
                '!!!!!!!!!!!!!!!!

                Set rgCell = rgCanvas.Cells(j, x)
                lgColor = rgCanvas.Cells(j, x).Interior.Color
                bytRed = (lgColor And &HFF)
                bytGreen = (lgColor \ &H100 And &HFF)
                bytBlue = (lgColor \ &H10000 And &HFF)

                'Store color
                k = k + 1
                .bmbits(k) = bytBlue
                k = k + 1
                .bmbits(k) = bytGreen
                k = k + 1
                .bmbits(k) = bytRed
            Next x

            If (lgPixH * .bmfi.intBits / 8 < lngRowSize) Then   ' Add padding if required
                For l = lgPixH * .bmfi.intBits / 8 + 1 To lngRowSize
                    k = k + 1
                    .bmbits(k) = 0
                Next l
            End If
        Next j

        .bmfh.lngSize = Len(.bmfh) + Len(.bmfi) + lngPixelArraySize

        ' Output bmpFile
        iFileOut = VBA.FreeFile()
        Open strFullPathFile_BMP For Binary Access Write As #iFileOut Len = 1
            Put #iFileOut, 1, .bmfh
            Put #iFileOut, , .bmfi
            Put #iFileOut, , .bmbits
        Close #iFileOut

        ' Free memory
        Erase .bmbits()
     End With
End Function

For JPG, we need two Classes (cJpeg and cImage), one Module and three UserForms, I did not yet get it to work, as it was originally programmed for VB6, but code compiles Ok in the following Excel, near 10 lines left to port to VBA (marked as ‘!).

I have coded inside a BMP file just to be able to upload to WordPress.
Code to cypher/decypher follows:




 

 

Current IFC releases

The most popular open format dealing with BIM is IFC format, that it is maintained by buildingSMART association.

To date, there have been several releases for the format, most of them now obsoletes.

We can consider the IFC2x3 as the last ‘stable’ version, and the IFC4 as the ‘nightly’ builds. In the near future there is the IFC5 to come, but is still in early planning phase.

For the IFC4, the last one is called IFC4 Addendum 2 (plain: IFC4 Add2 and more informally IFC2x4), released in July 2016. Incorpores some improvements that had been requested before starting the IFC4 certification process, so it can be considered as buildingSMART Final Standard baseline for IFC Reference View V1.1 and IFC4 Design Transfer View V1.1. The express schema can be reached here, and the HTML documentation can be downloaded here.

 


First deal is to have converted all the EXP schema to VBA Functions/Enumerations/Entities, so it can be called from inside IDE. They’re nearly 90.000 lines of definitions, so it’s a huge work.

Second deal is to have Entities/Functions converted to somehow Graphical interface (Dinamo/GrassHoper alike), so they can be generated, linked, referred and programmed to do “things”.

 

 

VBA Interact with HTML + WebBrowser

The original idea from this post came from this another one. But I needed to have it extended to any other functions, and to deal with Gmail two steps login.

To interact with HTML pages and its controls we need to add two references in our Excel VBA.

  1. Microsoft HTML Object Library (mshtml.tlb): This library is required to access all HTML controls which can be present on your HTML page.
  2. Microsoft Internet Controls (ieframe.dll): This reference is required to do operations on Internet Explorer because to open an HTML page we need to access Internet Explorer.

How to Add Reference in Excel

  1. Go to VB Editor Screen (Alt+F11)
  2. Tools –> References…
  3. From the List of Available References Select your Reference Name which you want to add.
  4. Note: If you are not able to find the Reference Name in the list then Click on browse and select the dll name which is given for those Reference Names.
  5. Click OK

The VBA WebBrowser project

It will look something like these:

VBA_WebBrowser

ToDo: detect where is the mouse pressing down and find object in that X,Y position, so inner HTML code can be recalled and copied to clipboard.

Paste inside the UserForm code the following, and add the neccesary objects that warns when loaded.

'http://automatetheweb.net/vba-getelementsbytagname-method/

Option Explicit

Private bWebChange As Boolean

Private Type PointAPI
    X As Long
    Y As Long
End Type

Private oTmpHTMLDoc As HTMLDocument 'Reference to Microsoft HTML Object Library
Private oTmpHTML_Element As IHTMLElement
Private oTmpHTML_Element2 As IHTMLElement2
Private oTmpHTML_TagCol As IHTMLElementCollection
Private oTmpHTML_TagCol2 As IHTMLElementCollection2

Private Sub txtURL_Enter()
    Call cmdGo_Click
End Sub

Private Sub UserForm_Initialize()
'It's not the same to go from different webbrowser, site can change for each browser...
'Is is a multipage site?
    With Me
        .txtUsername.Text = ""
        .txtPassword.Text = ""
    End With
End Sub

Private Sub cmdGo_Click()
    With Me
        If .txtURL.Text = vbNullString Then Exit Sub
        
        If .txtURL.Text Like "http*//*" Then
            .txtURL.Text = .txtURL.Text
        ElseIf .txtURL.Text Like "www*" Then
            .txtURL.Text = "http://" & .txtURL.Text
        Else
            'count dot chars
            .txtURL.Text = "http://www." & .txtURL.Text
        End If
        .WebBrowser1.Navigate (.txtURL.Text)
    End With
End Sub

Private Sub cmdAction_Click()
' Always get "name" property
    With Me
        With .WebBrowser1
            If Not bWebChange Then Exit Sub 'Wait for completion
            
            ' Go to site and search <input for input box... get "name" property
            ' Go to site and search  "*button*" for buttons ...
            
            .Document.all("Email").Value = Me.txtUsername.Text
            
            bWebChange = False
            .Document.all("signIn").Click
                    
            If bWebChange Then
                'Wait until complete... go to next page
                .Document.all("Passwd").Value = Me.txtPassword.Text
                .Document.all("signIn").Click
            End If
        End With
    End With
End Sub

Private Sub cmdGetScreenCordinates_Click()
Call GetTable
Stop
    Dim oPoint As PointAPI
    
    With Me.WebBrowser1
        '.Silent = False
        '.Navigate Me.txtURL.Text
        '.Visible = True 'False
    
        'Call Browser_Complete
         
        Set oTmpHTMLDoc = .Document
        Set oTmpHTML_Element2 = oTmpHTMLDoc.getElementsByTagName("a")(0)
    
        oPoint = GetScreenCordinates(oTmpHTML_Element2, oTmpHTMLDoc)
    End With
End Sub

Private Function GetScreenCordinates(ByVal oHTML_Element As IHTMLElement, _
                                     ByVal oHTMLDoc As HTMLDocument) As PointAPI
    Dim oPoint As PointAPI
    
    oPoint.X = oHTML_Element.offsetLeft
    oPoint.Y = oHTML_Element.offsetTop
    Do While Not (oHTML_Element.offsetParent Is Nothing)
        oPoint.X = oPoint.X + oHTML_Element.offsetParent.offsetLeft
        oPoint.Y = oPoint.Y + oHTML_Element.offsetParent.offsetTop
        
        If (oHTML_Element = oHTMLDoc.getElementsByTagName("body")(0)) Then
            Exit Do
        Else
            Set oHTML_Element = oHTML_Element.offsetParent
        End If
    Loop
        
    GetScreenCordinates = oPoint
End Function

Private Sub ListAHRef_Click()
    On Error GoTo Err
    
    'Dim oBrowser As InternetExplorer
    Dim oHTMLDoc As HTMLDocument 'Reference to Microsoft HTML Object Library
    Dim oHTML_Element As IHTMLElement
    Dim oHTML_Element2 As IHTMLElement2
    Dim oHTML_Element3 As IHTMLElement3
    Dim oHTML_Element4 As IHTMLElement4
    Dim oHTML_TagCol As IHTMLElementCollection
    Dim oHTML_TagCol2 As IHTMLElementCollection2
    Dim oHTML_TagCol3 As IHTMLElementCollection3
    Dim oHTML_TagCol4 As IHTMLElementCollection4
    Dim lgItem As Long

    'Set oBrowser = Me.WebBrowser1 'New InternetExplorer
    'With oBrowser
    With Me.WebBrowser1
        '.Silent = False
        '.Navigate Me.txtURL.Text
        '.Visible = True 'False
    
        'Call Browser_Complete
         
        Set oHTMLDoc = .Document
        Set oHTML_TagCol2 = oHTMLDoc.getElementsByTagName("a")
        'N# items: oHTML_TagCol.length
        lgItem = lgItem + 1
        For Each oHTML_Element2 In oHTML_TagCol2
            lgItem = lgItem + 1

            With oHTML_Element2
                ActiveSheet.Cells(lgItem, 1).Value = .href
                ActiveSheet.Cells(lgItem, 2).Value = .innerText
                'ActiveSheet.Cells(lgItem, 3).Value = .offsetWidth
                'ActiveSheet.Cells(lgItem, 4).Value = .offsetHeight
                
                'Warning: If the element is in a frame, the coords are relative to the frame's origin, not the browsers.
                'ActiveSheet.Cells(lgItem, 5).Value = .getBoundingClientRect.Left
                'ActiveSheet.Cells(lgItem, 6).Value = .getBoundingClientRect.Top
                'ActiveSheet.Cells(lgItem, 7).Value = .getBoundingClientRect.Right
                'ActiveSheet.Cells(lgItem, 8).Value = .getBoundingClientRect.bottom
                
                'ActiveSheet.Cells(lgItem, 9).Value = .offsetParent.offsetLeft
                'ActiveSheet.Cells(lgItem, 10).Value = .offsetParent.offsetTop
            End With
        Next
        '.Visible = True
    End With
    
    'Debug.Print Me.WebBrowser1.Container.InsideHeight
    'Debug.Print Me.WebBrowser1.Container.InsideWidth
    
    'Debug.Print oHTMLDoc.body.ScrollWidth & "x" & oHTMLDoc.body.ScrollHeight
    'Debug.Print oHTMLDoc.body.ClientWidth & "x" & oHTMLDoc.body.ClientHeight
    
    'Set oHTML_Element2 = oHTMLDoc.elementFromPoint(444, 121)

ExitProc:
    Exit Sub

Err:
    MsgBox ("Error Occurred")
End Sub

Private Sub GetTable()
    Dim lgCell As Long
    Dim lgR As Long ' Row counter
    Dim lgC As Long ' Column counter
    Dim oHTML_ElementTable As IHTMLElement2
    Dim oHTML_ElementRow As IHTMLElement
    Dim oHTML_ElementCell As IHTMLElement

    'beeing Table HTML element with id 'myTable'
    'look at all the 'tr' elements in the 'table' ,
    'and evaluate each, one at a time, using 'ele' variable
    lgR = 1
    Set oHTML_ElementTable = Me.WebBrowser1.Document.getElementById("myTable")
    For Each oHTML_ElementRow In oHTML_ElementTable.getElementsByTagName("tr")
        'show the text content of 'tr' element being looked at
        'Debug.Print oHTML_ElementRow.innerText

        'each 'tr' (table row) element contains 4 children ('td') elements
        lgC = 0
        For lgCell = 0 To oHTML_ElementRow.Children.lenght
        'For Each oHTML_ElementCell In oHTML_ElementRow.Children
            'Debug.Print oHTML_ElementCell.innerText
            lgC = lgC + 1
            ActiveSheet.Cells(lgR, lgC).Value2 = oHTML_ElementCell.innerText
        'Next oHTML_ElementCell
        Next lgCell

        lgR = lgR + 1
    Next oHTML_ElementRow
End Sub

'Private Sub WebBrowser1_BeforeNavigate2(ByVal pDisp As Object, URL As Variant, Flags As Variant, TargetFrameName As Variant, PostData As Variant, Headers As Variant, Cancel As Boolean)
'' Get caller...
'Stop
'End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If pDisp Is Me.WebBrowser1.Application Then
        bWebChange = True
        '
        ' Now you can poke around the Document Object
        '
    End If
End Sub

Private Sub URL_Navigate(Optional ByRef strURL As String = vbNullString)
    With Me.WebBrowser1
        strURL = VBA.Trim$(strURL)
        If strURL = vbNullString Then
            strURL = VBA.Trim$(Me.txtURL.Text)
            
            Do While strURL = vbNullString
                strURL = VBA.Trim$(VBA.InputBox(Prompt:="Type URL", Default:="http://www.site.com"))
                strURL = VBA.Trim$(strURL)
            Loop
        End If
        
        .Navigate strURL
        .Visible = True 'False
    
        Call Browser_Complete
    End With
End Sub

Private Sub Browser_Complete(Optional ByVal TimeWait As Long = 3)
'wait for page to load
    With Me.WebBrowser1
        'Do While .Busy = True Or .ReadyState  4: DoEvents: Loop
        
        Do
        ' Wait till the Browser is loaded
            DoEvents
        Loop Until .ReadyState = READYSTATE_COMPLETE
    
        ' Once browser is fully loaded give few seconds.
        ' This is because sometimes even though the Browser State is Complete
        ' but still some of the controls are not ready completely.
        ' In such case your script may fail.
        ' That's why I have given a waiting time of 3 seconds after the page is loaded completely.
        Application.Wait DateAdd("s", TimeWait, Now)
    End With
End Sub

Private Sub cmdLogin_Click()
    On Error GoTo Err
    
    'Dim oBrowser As InternetExplorer
    Dim oHTMLDoc As HTMLDocument 'Reference to Microsoft HTML Object Library
    Dim oHTML_Element As IHTMLElement
    Dim oHTML_TagCol As IHTMLElementCollection

    'Set oBrowser = Me.WebBrowser1 'New InternetExplorer
    With Me.WebBrowser1
        '.Height = 1000
        '.Width = 1000
        
        Call URL_Navigate(Me.txtURL.Text)
         
        'Once browser is open with Gmail URL
        'Now we need to pass ID and password at the right
        'field. For this right click on the Gmail page
        'and click on View Code. Here check the "id" of
        'User Name and Password Textboxes.
        'For example if ID of the User Name textbox is "username"
        'then syntax to pass User name in that field would be:
        'oHTMLDoc.all.username.Value="your user name".
        'Same way I have passed user name and password as below
        Set oHTMLDoc = .Document
        oHTMLDoc.all.Email.Value = Me.txtUsername.Text 'yourUserName
        oHTMLDoc.all.Passwd.Value = Me.txtPassword.Text 'YourPassword
         
        'after entering email id and password
        'we need to search the button to Sign in gmail.
        'For this also we need to check the ID or name of that
        'button by right clicking and seeing the code.
        'Once you get the Name of that button then use the
        'below code to click on that.
        'Here for loop is necessary because if it is not able
        'to find the control in first time then it will go
        'and look for another button on that page.
        'Whichever button it is finding with the name as
        '"signIn", it will click and for loop will end.
         
        For Each oHTML_Element In oHTMLDoc.getElementsByName("signIn")
            If oHTML_Element.Type = "submit" Then oHTML_Element.Click: Exit For
        Next
         
        Call Browser_Complete
        
        .Visible = True
    End With
    
ExitProc:
    Exit Sub

Err:
    MsgBox ("Error Occurred")
End Sub

 

Some hints about how to deal with HTMLElements:
Debug.Print objIE.document.getElementsByTagName(“p”)(0).innerHTML ‘ displays inner HTML of 1st p element on a page.

Debug.Print objIE.document.getElementsByTagName(“p”)(4).textContent ‘ displays text content of 5th p element on a page.

‘clicks an input element that has a value equal to ‘Sign In’
For Each ele In objIE.document.getElementsByTagName(“input”)
If ele.Value = “Sign In” then ele.Click: Exit For
Next

‘gets the link element containing ‘wp-admin’ and navigates to it.
For Each ele In objIE.document.getElementsByTagName(“a”)
If InStr(ele.href, “wp-admin”) > 0 then objIE.navigate ele.href: Exit For
Next
 

 

Markdown language

Although it will be really nice to implement all the ítems in MultiMarkdown, I’ll only focus on what is on the following (short) cheat sheet:

The Markdown Cheat Sheet

Format Type Markdown Syntax
Basic Elements
H1 to H6
Headings
# Heading Text
## Heading Text
### Heading Text
#### Heading Text
##### Heading Text
###### Heading Text
Italics *This text is italicized*
Bold **This text is bold**
Blockquote > Blockquote paragraphs must have
> a right-arrow bracket at the start
> of every single line.
>
> Use a blank line for multiple paragraphs.
Unordered List - Bullet list item
- Bullet list item
- Bullet list item
- Use a two-space indent for nested lists
Ordered List 1. Bullet list item
2. Bullet list item
3. Bullet list item
1. Ordered lists can also be nested
Mixed List 1. Can you mix list types?
- Yes, you can!
Horizontal Line ---
***
___


Note: Either three hyphens, asterisks, or underscores.
Hyperlink This is an [example link](//www.makeuseof.com)
Image ![Alt Text](http://example.com/image/path.png)
Ignore Markdown Prefix Markdown characters with \*backslashes\* to ignore formatting.
Extended Elements
Code (Inline) `This is inline code`
Code (Block) ```
This is a block of code
It supports multiple lines
```
Strikethrough ~~This text is crossed out~~
Hard Line Break This is some text\
This text is a new line, not a new paragraph
Table | First Header | Second Header |
| ------------ | ------------- |
| Content cell 1 | Content cell 2 |
| Content column 1 | Content column 2 |
Note: Preceding blank line is necessary.
Task Lists - [x] Completed task item
- [ ] Unfinished task item
- [ ] \(Optional) Mark parentheses to be ignored
Mention You can mention @users and @teams on GitHub. Mainly useful when submitting or commenting on bugs and issues.
Emoji :emojicode:

Note: Emoji codes can be found in the emoji cheat sheet.

Planet-source-code (PSC interesting links)

A list of promissing VB6 posts.

Revised links up to 1510 of 16896


A VB6 Source Code Browser
By: Dave Carter

(Help File Update) A Program to READ VB6 Source Code from a VB6 Project. Select a VBP to start. It is a stand-alone executable not an Add-In. I use it as a companion tool to developing large VB6 projects because it is informative in a way that the VB6 IDE isn’t (without writing an Add-In).

The idea behind the main screen is that it has 3 view modes that are selected via the option buttons, bottom left from left to right:
1. Source Code View for reading source code.
2. Code Member Use is for finding where a code member is used.
3. Code Member List is for listing all code members in a project.

There several functions:
Source Code Review reports unused variables, parameters and private methods (e.g. functions, subs and properties).
Zip Viewer reads zipped VB6 Projects (perhaps from Planet Source Code) and can unzip them (Unzip32.dll required). It can also perform Search, Scan and source code review on the zipped project. Only unzips VBPs (not a general unzip facility).
Copy Project will copy just the development files and any others you specify to a new folder (helpful for de-cluttering a polished project). If you have Zip32.dll it can also zip the newly copied project. Also, checks for a ‘.manifest’ and copies this as well if found.
Copy Code Member (e.g. Subs, Functions, Properties, Types, Enums, Constants, API Declares…) can drill down into its target code to discover any and all other code members that are used then sort and list them referentially for quick copying into a new project.
Line Use reports at Code Member, Module and Project levels show a breakdown of the code lines into those that are empty, commented, declarative and those that start with a control statement.

There is more but too much to mention here, please use the Help File, press F1; the Help File describes most of the forms, why they are there and how to use them.

NOTES:
Unicode and ASM strings do not work; lost in conversion from plain text to Rich Text (affects text in quotes and comments).
Code Members need to be formally declared for things to function as best they can (e.g. use Option Explicit and Dim variables).
As mentioned, Unzip32.dll and Zip32.dll are required to get the full functionality available, the Help File has some possible links to get them but they need to be properly installed from Win8 onwards.
Release version developed on Win7 which may or may not affect the Project’s References, check the VBP for their paths and correct them as needed.

Acknoweldgements to Rde for Unzip to Memory, thanks Rohan 🙂

This was not an easy project but it was incredibly interesting and a lot of fun; Essentially, it’s an experiment for me to study Code Parsing so there’s a research bent to it all. There are some quirks but please remember this was hand written and tested by one bod on his own to suit his own needs at the time.

Included HTML and PDF versions of the Help file for those who do not have Winhelp.exe already installed. Best to use HTML version which first needs unzipping, load the file VBCBExp.HTML.

Download


Call CDECL DLL’s – impossible?
By: Paul Caton (from psc cd)

CDECL DLL functions cannot be called from Visual Basic… or so they’ll tell you… such dll’s use a incompatible technique for parameter stack cleanup. The included class uses VB+ASM to slay the “impossible” cdecl call dragon, even allowing ‘C’ style variable length/type parameter lists and the use of VB bas module functions as cdecl callback routines. The convention used with a cdecl function is that the caller cleans the stack on return; the stdcall convention is that the called function cleans the stack at function end. The advantage of stdcall is reduced program size, 6 calls to a function, one bit of cleanup code. The advantage of cdecl is that variable length/type parameter lists are “safe” because the caller, he who pushed the parameters onto the stack, cleans the stack… he knows exactly how many parameters he pushed and thus knows the required adjustment on function return. Years ago I worked on a team that lost a project because of our inability to speedily resolve this issue for a third-party dll – So, perhaps not the sexiest submission of the week, however, it might just save your a*s someday. The included sample demonstrates variable length/type parameter lists and callbacks routines, focusing on the std ‘C’ library qsort (quicksort) function.

Download


scintillaVbEditor

By: kin

Support multi-Text-Files edit, HighLight key words for VB/C++/html,Can compare texxt files etc…, using scilexer.dll.

Download


Debugging 32Bit Apps with API’s

By: A_X_O

Windows 10: API Debugging 32Bit Applications. (Not 64Bit) Using, DEBUG_EVENT, CREATE_PROCESS_DEBUG_INFO,CREATE_THREAD_DEBUG_INFO,EXCEPTION_DEBUG_INFO,EXIT_PROCESS_DEBUG_INFO,LOAD_DLL_DEBUG_INFO… Original Code By “The trick – Modified by A_X_O”

Download


Binary File Edit 3.2 by Herman C. Liu
By: Rde

BinFileEdit 3.2 – Fully functional Hex Editor
I have used several Hex Editors over the years. They all did the same thing but they also seemed to each lack some functionality I needed.
I found this Hex Editor here on PSC created by Herman C. Liu which I liked. It had the ability to print pages, had working search and goto, and was much faster than most at opening files and scrolling, so it seemed like a good starting point. I began to add features I wanted that it didn’t have, and refined its behavior, and is now a very useful tool.
Features include: Edit as Hex, Ascii, Binary or characters. Type directly from the keyboard just like any other editor. Search by Hex values or characters. Undo all changes. Open very large files quickly. Responsive scrolling, doesn’t stall or stutter even on large files. Select multiple hex bytes/characters and copy to clipboard. Open multiple files including drag-and-drop.
Like I said, Hex Editors all do basically the same thing, and this is not much different. However, it does everything I have ever needed from a Hex Editor, and more. For example, enter a Hex or Ascii value to get the Binary, or vice-versa.
I find this Hex Editor by Herman Liu to be extremely handy when I need it, and thought others might appreciate it also. Bug reports and suggestions for improvement welcome.
BinFileEdit remains copyright Herman C. Liu.
3.1 update improved Insert/Edit behavior.
Fit long file paths within Titlebar width.
3.2 update fixed minor bugs.

Download


Picture Enlarger

By: ICE

Please read all text first before you begin to make the program, This program will let you Enlarge Selected Area of a Picture with very little pix-elating or distortion, As you can see in the 2 pictures in the screenshot, I would say this program is sort of classified in the Drag & Drop category, I know there are lots of things that could be added to the program, But hey I like to see what others do with it or to it, Stuff that could be added…. A menu with the options to open and save the images, also could add a DriveListBox, a DirectoryListBox an a FileListBox, for searching for pictures an images to view in the program…. Now here is all you need to do to set the Form up, Open a new form make it large enough for your own viewing an for the size of your monitor,, Add 2 PictureBoxes,, the 1st one set it on the left side make it big as seen in the screenshots, Name it “picSelect”,,, The 2nd one goes on the right it does not have to be as big as the 1st one, Name it “picDisplay” ,,, Set Form Properties to, BorderStyle “2 Sizable” , set ScaleMode to 1- Twip… Set Both PictureBoxes “AutoRedraw & AutoSize”, to True,, I will include all VB6 parts, screenshots. this R M I , an a working EXE and the code .. I have marked 1 line so you could easily see it, Its a line that was causing an error, the program works fine as it is but you can try to smooth that line out…. I hope you learn from this or at-least pick a few things up.

Download


Jpeg Codec in VB 6.0
By: John Korejwa

A dependency free jpeg encoder and decoder for VB6 with advanced features. Supports sequential, progressive, and lossless modes, and huffman and arithmetic coding. (start-of-frame markers SOF0, SOF1, SOF2, SOF3, SOF9, SOF10, SOF11) Can write (file size) optimized jpg like mozjpeg, do lossless transforms and transcoding, steganography and steganalysis, and more.

Download


FFmpeg Video Crop

By: A_X_O

Crop Shop (A Frontend Application For FFmpeg)
Essential 3rd Party Software: FFmpeg available from https://www.ffmpeg.org/download.html
Crop Shop is a video cropping application. Designed to select a region of video and save the region as a new complete video.
Crop Shop uses:
FFprobe to extract the video Width, Height and Duration.
FFplay is used to Preview the Cropped Video Region before you save the Video
FFmpeg is used to perform the Video Cropping.
This project is meant to be a simple demonstration without any extra’s. “A Howto, Starting Point.”
Make sure FFmpeg, FFprobe and FFplay reside in the same directory as your project or nothing will work for you.
This updated version allows you to exit the FFmpeg Cropping Process, part way through, while still making the partially cropped video, playable.
The class file used in the project originates from this site.

Download


TCP Server/Client
By: John Bowles

Simple single server/client socket connection that sends & receives data on both client & server

Download


Chat Server & Client
By: Terry Olsen

chat program that allowed us to Instant Message each other before our employer got a similar commercial product. This uses sockets and win32 api to place an icon in the system tray when the server is minimized.

Download


https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=75256&lngWId=1Breadboard
By: Jos Dickmann

For designers who have electronics as a hobby, a breadboard with countless components

Download


Simple SMTP Server
By: Terry Olsen
SMTP server I wrote a long time ago to receive incoming emails for my BBS system. It can handle up to 6 connections. It saves the incoming emails as text files, which my BBS would grab and put in the destination user’s inbox.

Download


Dimer,Virtual Switch ARDUINO v1.0
By: Martin Grasso

Dimer gratuito para utilizar en Arduino y o en Microchip. Es un programa completo tanto la parte de cargar y descargar Archivos del Dimer,Virtual Switch ARDUINO v1.0 es un Dimer para controlar Led´s o motores servos etc,El programa es básicamente un Dimer con perillas controladoras en 8 Líneas de Tiempo, Que serían de 0 a 7 representadas con las letras de la A hasta H inclusive, donde se alojan los caracteres binarios de combinaciones de encendido y apagado de los bits, es decir un 0 representa Apagado y un 1 representa encendido, según la combinación de ceros y unos se crea un efecto visual de bits o electrones por milisegundo, se requiere un Arduino uno o versiones como Arduino Mega para definir más Pines de bits, el programa puede servir para hacer un Lineal para un Baile o fiesta, etc mediante módulos de relés, en este ejemplo se prueba con Led´s, por el costo económico del mismo. El pequeño motor de ejecución lo desarrolle aplicado mi conocimiento de Auxiliar de Electrónica. Con las perillas (+) y (–) se van elaborando los bits por milisegundo el programa lo cree en Ingles, mesclado con español ya que estoy aprendiendo un poco más del mismo por mi sueño de ir a estudiar a EE: UU, incluye un instalador para aquellas personas que no disponen del Compilador de Visual Basic, Tiene también un escáner de puertos USB para facilitar la comunicación eficiente con el Arduino,espero que lo disfruten Saludos, Canal de Youtube: http://zipansion.com/2QVcD Para Ayudar a la Causa y a Futuros proyectos: Sopport Me Patreon: http://zipansion.com/1xJpU Ayudame en Patreon :: http: //zipansion.com/1xJpU

Download


Easy Flip Rotate Picture
By: Kenneth Foster
easy code to rotate 90 , flip vertical , flip horizontal , a picture in picturebox. Hope this will save you time trying to find something on net.

Download


FileSync 1.3
By: Rde
Complete synchronize backups and remove duplicates utility … Has option to test for exact matches using asm compare routine; this can help in situations where time stamps are different but files are still identical … Added ability to do batch jobs, and added option to create activity log in the source folder … Saves job settings … Updated Win9x/VB5 version to current … *Very fast*, limited only by the speed of removable drive access … Revision 8 ignores system files and folders, and no longer includes the FileSync.log files in backups … Revision 9 adds much faster as$embler CRC algorithm for lightning fast file comparisons … Revision 10 bug fix – during Delete Duplicates operation progress percentage error when no more files exist in target folder … Revision 11 sanity check – improved target path validation and user confirmation when removing files and sub-folders. It is now much less likely to delete files by mistake … Revision 12 bug fix – fixed minor bug when target folder is drive root … Lucky Revision 13 – fixed bug that ignored Cancel button

Download


CoCreateGuid Example
By: Nicholas Forystek

Globally Unique Identifier generate function as well as a IsGuid() function to test if the GUID is a string representation seemingly of one. Updated to copy and paste run in the vb4 debugger if the msvbvm60.dll is on the system

'**************************************
' Name: CoCreateGuid Example
' Description:Globally Unique Identifier generate function as well as a IsGuid() function to test if the GUID is a string representation seemingly of one. Updated to copy and paste run in the vb4 debugger if the msvbvm60.dll is on the system.
' By: Nicholas Forystek
'**************************************

Option Explicit
Option Compare Binary
Option Private Module
Private Type GuidType '16
A4 As Long '4
B2 As Integer '2
C2 As Integer '2
D8(0 To 7) As Byte '8
End Type
Private Declare Function CoCreateGuid Lib "ole32" (ByVal pGuid As Long) As Long
Private Const GPTR = &H40
Private Const GMEM_MOVEABLE = &H2
Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalUnlock Lib "kernel32" (ByVal hMem As Long) As Long
Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
Private Declare Sub RtlMoveMemory Lib "kernel32" (Left As Any, Pass As Any, ByVal Right As Long)
Private Declare Function VarPtr Lib "msvbvm60.dll" (var As Any) As Long
Private Function Padding(ByVal Length As Long, ByVal Value As String, Optional ByVal PadWith As Variant) As String
If IsMissing(PadWith) Then PadWith = " "
Padding = String(Abs((Length * Len(PadWith)) - (Len(Value) \ Len(PadWith))), PadWith) & Value
End Function
Public Function GUID() As String
Dim lpGuid As Long
lpGuid = GlobalAlloc(GMEM_MOVEABLE And VarPtr(lpGuid), 4)
If lpGuid  0 Then
Dim lgGuid As GuidType
Dim toggle As Integer
If CoCreateGuid(VarPtr(lgGuid)) = 0 Then
RtlMoveMemory lgGuid, ByVal lpGuid, 4&
Dim lcGuid As Long
lcGuid = GlobalLock(lpGuid)
If lcGuid = lpGuid Then
Dim ba(0 To 15) As Byte '16
RtlMoveMemory ByVal VarPtr(ba(0)), ByVal VarPtr(lgGuid.A4) + 0, 16
RtlMoveMemory ByVal VarPtr(ba(0)), ByVal VarPtr(ba(1)), 1
RtlMoveMemory ByVal VarPtr(ba(1)), ByVal VarPtr(lgGuid.A4) + 1, 15
RtlMoveMemory ByVal VarPtr(ba(1)), ByVal VarPtr(ba(2)), 1
RtlMoveMemory ByVal VarPtr(ba(2)), ByVal VarPtr(lgGuid.A4) + 2, 14
RtlMoveMemory ByVal VarPtr(ba(2)), ByVal VarPtr(ba(3)), 1
RtlMoveMemory ByVal VarPtr(ba(3)), ByVal VarPtr(lgGuid.A4) + 3, 13
RtlMoveMemory ByVal VarPtr(ba(3)), ByVal VarPtr(ba(4)), 1
GlobalUnlock lcGuid
RtlMoveMemory ByVal VarPtr(ba(4)), ByVal VarPtr(lgGuid.B2) + 0, 12
RtlMoveMemory ByVal VarPtr(ba(4)), ByVal VarPtr(ba(5)), 1
RtlMoveMemory ByVal VarPtr(ba(5)), ByVal VarPtr(lgGuid.B2) + 1, 11
RtlMoveMemory ByVal VarPtr(ba(5)), ByVal VarPtr(ba(6)), 1
lcGuid = GlobalLock(lpGuid)
RtlMoveMemory ByVal VarPtr(ba(6)), ByVal VarPtr(lgGuid.C2) + 0, 10
RtlMoveMemory ByVal VarPtr(ba(6)), ByVal VarPtr(ba(7)), 1
RtlMoveMemory ByVal VarPtr(ba(7)), ByVal VarPtr(lgGuid.C2) + 1, 9
RtlMoveMemory ByVal VarPtr(ba(7)), ByVal VarPtr(ba(8)), 1
GlobalUnlock lcGuid
RtlMoveMemory ByVal VarPtr(ba(7)), ByVal VarPtr(lgGuid.D8(0)), 1
RtlMoveMemory ByVal VarPtr(ba(8)), ByVal VarPtr(ba(9)), 1
RtlMoveMemory ByVal VarPtr(ba(6)), ByVal VarPtr(lgGuid.D8(1)), 1
RtlMoveMemory ByVal VarPtr(ba(9)), ByVal VarPtr(ba(10)), 1
lcGuid = GlobalLock(lpGuid)
RtlMoveMemory ByVal VarPtr(ba(5)), ByVal VarPtr(lgGuid.D8(2)), 1
RtlMoveMemory ByVal VarPtr(ba(10)), ByVal VarPtr(ba(11)), 1
RtlMoveMemory ByVal VarPtr(ba(4)), ByVal VarPtr(lgGuid.D8(3)), 1
RtlMoveMemory ByVal VarPtr(ba(11)), ByVal VarPtr(ba(12)), 1
RtlMoveMemory ByVal VarPtr(ba(3)), ByVal VarPtr(lgGuid.D8(4)), 1
RtlMoveMemory ByVal VarPtr(ba(12)), ByVal VarPtr(ba(13)), 1
RtlMoveMemory ByVal VarPtr(ba(2)), ByVal VarPtr(lgGuid.D8(5)), 1
RtlMoveMemory ByVal VarPtr(ba(13)), ByVal VarPtr(ba(14)), 1
RtlMoveMemory ByVal VarPtr(ba(1)), ByVal VarPtr(lgGuid.D8(6)), 1
RtlMoveMemory ByVal VarPtr(ba(14)), ByVal VarPtr(ba(15)), 1
RtlMoveMemory ByVal VarPtr(ba(0)), ByVal VarPtr(lgGuid.D8(7)), 1
RtlMoveMemory ByVal VarPtr(ba(15)), ByVal VarPtr(ba(0)), 0
GlobalUnlock lcGuid
End If
GUID = Padding(2, Hex(ba(0)), "0") & Padding(2, Hex(ba(1)), "0") & _
Padding(2, Hex(ba(2)), "0") & Padding(2, Hex(ba(3)), "0") & "-" & _
Padding(2, Hex(ba(4)), "0") & Padding(2, Hex(ba(5)), "0") & "-" & _
Padding(2, Hex(ba(6)), "0") & Padding(2, Hex(ba(7)), "0") & "-" & _
Padding(2, Hex(ba(8)), "0") & Padding(2, Hex(ba(9)), "0") & "-" & _
Padding(2, Hex(ba(10)), "0") & Padding(2, Hex(ba(11)), "0") & _
Padding(2, Hex(ba(12)), "0") & Padding(2, Hex(ba(13)), "0") & _
Padding(2, Hex(ba(14)), "0") & Padding(2, Hex(ba(15)), "0")
End If
GlobalFree lpGuid
Else
Debug.Print "Error: GlobalAlloc " & Err.Number & " " & Err.Description
End If
End Function
Public Function IsGuid(ByVal Value As Variant, Optional ByVal Acolyte As Variant) As Boolean
If IsMissing(Acolyte) Then Acolyte = True
If Not (Len(Value) = 36) And (InStr(Value, ".") = 0) Then
IsGuid = False
ElseIf Mid(Value, 9, 1) = "-" And _
 Mid(Value, 14, 1) = "-" And _
 Mid(Value, 19, 1) = "-" And _
Mid(Value, 24, 1) = "-" Then
Dim tmp As Variant
tmp = Value
Dim cnt As Byte
For cnt = Asc("0") To Asc("9")
tmp = Replace(tmp, Chr(cnt), "")
Next
For cnt = Asc("A") To Asc("F")
tmp = Replace(UCase(tmp), Chr(cnt), "")
Next
IsGuid = (tmp = "----") Or (tmp = "---")
End If
End Function
Public Sub Main()
Do While True
Debug.Print GUID
DoEvents
Loop
End Sub

Load-a-Pic
By: John Bowles

to load a picture without the need for the commondialog.ocx . instead, it uses api in a .bas module. it is somewhat commented in the module but is pretty straight forward. it will only work with .jpg, .gif & .bmp which is a limitation of vb6 to only handle those 3 formats. I did not include a picture as it only uses an imagebox (because it stretches to fit images) & a command button on a form. this is the bare minimum. if you wanted you could add save its there in the module but do not remove as I have already striped down and those functions rely on each other to load the picture to be seen.hope it helps Note: a couple of things i would like to add is that this is great because I use this in several of the progs i have uploaded here so you can see that it can be built on & used in many apps without the annoyance of the cmndlg and that with but a simple change in the filter, you can use it for not only pics but any files ex: .txt, .doc, .pdf or if you want you can use *.* which covers all types

Download


Advanced Web Browser
By: Telefon

It has all the features that a normal browser might have. Advanced Web Browser

Download


IP & Connection Checker
By: ICE
shows a little bit about Winsock, checking your IP & if you’re connected to the internet, it also shows a bit on OptionButtons and making the Captions changes on a CommanfButton, and a few other little things can be done with VB6… just red the text om thr I-Face and the code.

Download


ReSize
By: ICE

Resize form by the inch, You can see in the screenshot the 2 different sizes that I took screenshots to show it,,, there is some information given in the screenshot, Hope you like this 1 an hope it can help you or come in useful somewhere down the line.

Download


QR-code
By: Jos Dickmann
I have not been able to fully prepare this program, but the main one is there.

Download


Fixed ReUpLoaded
By: ICE
Listen to port…

Download


CRC Calculator and Modifier
By: John Korejwa

Calculate crc values of files, strings, and byte arrays. Works with CRC32, 95 other presets, or arbitrary parametered crcs of sizes up to 32 bits. Fast, thanks to precompiled assembler. Can also modify a crc value by either appending a few bytes, or toggling bits at user defined locations in the data. Multiple crc values can be set; for example, you can assign both desired CRC32 and crc16 values for the same file.

Download


Resize multiple pictures
By: Krzysiek
resize multiple pictures. Put your images into ‘IMAGES IN’ folder and press ‘REFRESH’ to see them on list on the left. Chose size in textboxes and press ‘RESIZE’. Resized pictures will be visible on right list and saved into ‘IMAGES OUT’ folder of program. Accepted extensions are: bmp, jpg, gif. Pictures saved have .bmp format

Download


Arduino .exe Timbre escolar Programable
By: Martin Grasso

Sistema de control completo, para Escuelas Universidades y toda aquella institución que requiera de un automatismo computarizado mediante interfaz de Hardware Arduino o Intel Computer case. Timbres detonaciones etc* en el fichero .exe se encuentran el código fuente tanto como los ficheros de Arduino, + el código anterior en la carpeta de destino de la instalación tanto como el setup anterior a Timeline + ficheros de código fuente Compilable con Microsoft Visual Basic 6.0 Arduino mediante Java Lenguaje.

Download


CSocketMaster 1.2 & CSocketPlus 1.1 – Winsock classes
By: Emiliano Scavuzzo (from psc cd)
CSocketMaster class is a winsock control substitute. It has the same interface and behavior winsock has so don’t worry about having to learn how to use it. If you know how winsock works then you already know how CSocketMaster works. You can use a socket in a form, user control or class without external dependencies or huge memory leaking OCXs. This new version has some bugs fixed including the binding problem when you have more than one internet interface; now the client sockets bind to the default gateway. With CSocketPlus you can accomplish the same things CSocketMaster does plus you can create sockets at runtime. You can use a long value or a string as an index and create socket arrays very fast. Both are IDE safe, so you can press the end button without crashing the program. Take a look at the readme file for more info. Both classes are based on CSocket by Oleg Gdalevich that can be found on www.vbip.com. Keywords: socket, winsock, tcp, udp, internet, lan.

Download


Kokoro’s Downloader 1.3 – Game downloader
By:
Emiliano Scavuzzo (from psc cd)
Officially Kokoro’s Downloader is a professional game downloader powered by CSocketMaster 1.2 that lets you choose from a periodically updated list of games, where you can see the game information and a preview image before downloading. But it’s much more than that. Here is the list of what you can learn from this project: how to get free unlimited web space with unlimited bandwidth to share whatever you want, how to skin your form and at the same time keep an icon on the taskbar button and the system menu (not found anywhere else), how to download (and upload) files, how to work with transparent forms, splash windows, personal buttons, label links, proxies, update systems, windows registry, tabstrips, imagelist, personal tooltips, help files, winsock APIs, how to deal with microsoft listview bugs and more. You can upload your own files and share them with the world, NO FILE SIZE LIMIT. All the content shared on KD is legal, and I don’t take any responsibility for what kind of material you share. Credits: Leo Barsukov, button control, Kaustubh Zoal, tooltip class, ArthurW, translucent code. This is my third and last post on VB, so I thought I could leave sharing one of my best codes

Download


Entries by jorge flores p..
By: Entries by jorge flores p..

Fractal-Rocks

Download

Fractal-Mountain

Download

Textures-Texturas2d
source code of textures in polygons, very useful for 3d polygons. Codigo fuente de texturas

Download

vb3dGridMeshV2
source code of a small 3d editor, uses a grid and allows to deform. Codigo fuente de un editor 3d.


Download

Mountain3d-V1
source code about mountain in 3d, another different version, personal ideas about landscapes.

Download

graphics-3d-basic
source graphics in 3d basic-intermediate, 3D models, objects and arrangements, code performs graphic square objects, triangles and a cross, source code to improve, the program is unfinished and remove some functions, but function throughout the programming is unused directx

Download

Fractal-Mandelbrot-Varios
source code on several types of fractals, type Biomorph, the program allows the option to change the complex equation, mandelbrot and others. In addition, the new lighting and shade technique, with vectors and normalization and complex values

Download

fractal-Biomorph

Download

Face–3d–v1
Program about the face of a person, this is the first version, and it is for study of the programming of graphics in 3d, uses polygons, vectors, and ordering of objects

Download

Cube3D-prj3Dvn5
source code of graphics in 3d, basic cuabos, some small changes in basic lighting, normal, normalize, and arrangement of objects.

Download

City3dV2
Program in 3d about a city, with many buildings … cubes, and with lighting technique, order objects, and fill polygons with paint, this is the second version, there is another with random buildings after uploading

Download


simple HTML editor and viewer
By: Krzysiek
Program saves text in index.htm and shows it in webbrowser control

Download


Create a dll in windows format
By: Galactus
Utility that allows you to create a DLL with the Def file. This def file allows the VB5 or VB6 compiler to do a Dll in windows format

Download


Async Download with Features
By: Quake
Asynchronous Download with many features. Including: Time Remaining, Download Speed, Many Size formats, Choose force or Resync. Update your VB6 OCX’s/DLL’s while you’re at it

Download


Dolly v1.2 – [AI Talking Programme]
By: PGB Prasanna
This is a Chatterbot I developed in VB6 a long time ago for entertainment and it was very popular among my colleagues at that time. I just thought to share it with you, VB Classic community at least for an idea for a chatterbot. Otherwise this would have just gone to the history. So if you have anything to ask regarding this just let me know. Long live VB6!!!

Dolly is a chatterbot application, which you can make a conversation via textual inputs. Most of its intelligence is based on simple pattern matching for best possibilities from a database, which acts as a part of the brain of Dolly. Further Dolly has a kind of learning ability in such a way that it can remember the simple things for you.

The followings are some of the important things you should know about Dolly.

1. Ask almost anything from Dolly – Dolly will try to answer you.
(You can talk with Dolly for hours without any boring becasuse
Dolly is intelligent and has thousands of ways and patterns to talk
with you, don’t take my words, just go for it and see.)
What you have to do is to just type anything you want to ask
from Dolly and press Enter key.

2. To search something on the Internet, just type what is to be
searched after the word search.
(Eg: if you want to search on the word ‘education’, just type
‘search education’ as Dolly’s input text.)

3. To open a program from your computer, just type the programe name
followed by the word open. Dolly may try to open it for you if Dolly can find it.
(Eg: if you want to open powerdvd just type ‘open powerdvd’ as Dolly’s input.)

4. Dolly has a bit of learning ability. So Dolly can keep phone numbers, email addresses
if you ask Dolly to remember them.
(Eg: If a person’s name is ‘abc’ and his/her phone number is ‘1234567891’, just type
‘abc’s phone number is 1234567891’, Dolly will remember it for you and you can ask
‘what’s abc’s phone number’ from Dolly later. Same applies to emails addresses also.

5. Don’t repeat the same thing in a row because Dolly may not be interested
in such behaviors.

6. Please don’t communicate Dolly with BAD words, because Dolly may hate you and
treat you the same way.

7. If you don’t ask something from Dolly for some considerable period Dolly may not like it.

8. Enjoy. But don’t LOVE her. I repeat don’t LOVE her.

Download


Virtual Machine
By: Rakov
Virtual machine for a home made bytecode language. Contains: – Interpreter (with stack trace functionality, so you’ll be able to follow the execution of the code in detail). – A code builder class to simplify coding. -A few example programmes. Uses RakovLib, available on PSC: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=75126&lngWId=1

Download


download picture from url
By: Krzysiek
Paste picture url (example: http://domaingang.com/wp-content/uploads/2012/02/example.png) into textbox then press command button for download image to project path

Download


Convertidor de Archivos Multimedia 7_30
By: Martin Grasso
Convertidor de Archivos Multimedia 7_30 utilizando: FFmpeg es una colección de software libre que puede grabar, convertir (transcodificar) y hacer streaming de audio y vídeo. Incluye libavcodec, una biblioteca de códecs. FFmpeg está desarrollado en GNU/Linux, pero puede ser compilado en la mayoría de los sistemas operativos, incluyendo Windows. El proyecto comenzó por Gerard Lantau, un seudónimo de Fabrice Bellard, y ahora es mantenido por Michael Niedermayer. Es destacable que la mayoría de los desarrolladores de FFmpeg lo sean también del proyecto MPlayer (más un miembro del proyecto Xine), y que FFmpeg esté hospedado en el servidor del proyecto MPlayer. FFmpeg está liberado bajo una licencia GNU Lesser General Public License 2.1+ o GNU General Public License 2+ (dependiendo de qué bibliotecas estén incluidas).2 Los desarrolladores recomiendan utilizar el último snapshot de Subversion ya que mantienen constantemente una versión estable. FFmpeg es un programa bastante sencillo y muy fácil de usar, orientado tanto a personas con conocimientos avanzados como usuarios novatos. Es capaz de elegir el códec con sólo escribir la extensión. Por ejemplo, FFmpeg usará x264 si elegimos .mp4, mpeg4 si usamos .avi, VP8 si usamos .webm, etc…

Download


Extract links from google search
By: Professor Pickles
Search on google using the web browser control and extract ALL links found

<a href="
“>Download


Easy Translate
By:
Stephen Malekar
Translates the PDF to any language of choice, Uses Google Translate, Thanks to Google and Salty Brine Softwares, for their PDF Library for VB (Excellent work) Thanks to many others… mentioned in the Readme Now this has a paragraph check code, finds the paragraphs in the page. Earlier it extracted only specified numbers of characters, but now complete paragraph, so we get completed meaning of text and translation is approximately accurate. This code is for Education purpose not commercial….

Download


USE XML for INI Files
By: Ben128
using XML files to store config information

Download


MyPad – complete PHP Editor with syntax colorizing and much more
By: Sebastian T
MyPad is an PHP editor with the following features: PHP/HTML Syntax Colorizing (written in VB only and still fast, NO ADDITIONAL OCXs NEEDED!) * line numbering * unlimited Undo/Redo * INI File Support * Search and Replace * MRU file list * Single Document Interface for better use with your favorite file manager * command line support * read only mode * support for the PHP online help-system. See the readme.txt for credits! If you just want to have the binaries, get a setup file from my homepage: http://www.sebthom.de

Download


Gnutella P2P CLient
By: Antonio Gomez Machorro

Download


Terminal Velocity
By: Ian Ippolito (PSC)
This Program is intended to help teach movement velocity collision and redirection, It can be used for many different things but it may be very handy for games like Tennis, Racing Games, and I am sure a lot more too…The screen shot lost a bit of color but I hope all can see the words on Form2 on the screen shot,,, I may add more to this, As it is now I did leave a few things off of it , BUT I did completely show how to add what I left off, Kinda like a puzzle for those who download to work or to see if they can follow along But I did help and leave a help in there for you and for the stuff I did not really help with it is all right their if you can read and follow along then you will finish this little progyz work that I could have easily added put chose to let yous put the finishing touches on it,,, YES it is all in there and very easy for users to finish it in a few minutes,,, call it a slight test LOL Inside the zipped file you will find a working example that works to the point where I left it up to the users to finish the addons ( which are in there too & fully explained too ) also you will find a note pad with the complete code, a video of the program getting made ( only up to where I stopped for the users to finish the codes LOL that is the addons ) and proect1 with all the forms

Download


kiCrypt cipher demo 20-Jul-2017
By: Kenaso
Multiple ciphers demonstrated using ArcFour, Base64, Blowfish, Gost, Rijndael, serpent, Skipjack, Twofish.Hashing includes MS CryptoAPI, Tiger3 (my version), Whirlpool. === 20-Jul-2017 Updated support modules and documentation. Updated Blowfish cipher to make pass key more dynamic

Download


Gears
By: Emilio P.G. Ficara
Program written in VB6 starting from a graphical example found on Gambas2 (Linux Visual Basic). The original program shows an animation of moving gears and I had the idea to make a new program to generate the G-Code for a CNC machine to create a physical gear. I made in the past a program to generate very simple gears in GFA-Basic under Win3.1 (16 bits); you can find it navigating my web site. Respect to the previous one, this VB6 program generates a different shape and a bit ‘more “refined” teeth. The input boxes allows to define the number of teeth, its height, the radius of the central hole and the gear outer radius. The Z axis movements are not generated in the output file, but there is a remark in the output list (the G-Code) that indicates where to place UP and DOWN movements of Z axis. The output file is generated when you click the GO button, on the same directory where the executable is placed. The “gear-nn.cnc” file is generated, where nn is the number of teeth set for gear. The output of the program has been tested with NCPlot v1.1, software downloaded from the Internet. The measures (inches or millimeters) depend on the machine settings. In the program they are used in absolute numbers (three decimal places). The gear center always has coordinates X = 0, Y = 0; the minimum number of teeth 5 is accepted.

Download


Serial monitoring for arduino
By: batosai007
To export data from serial monitor arduino and export it to excel file ,.. csv file

Download


SSL – SSLv2 and SSLv3 ( tls ) socket winsock
By: Michiel
I found this very hard to find source at the internet to use SSLv3 with a windows plain winsock for VB6 Ive included SSLv2 and SSLv3. SSLv2 is only included to give you a idea about SSL, it is not used anymore at any websites. I dont want any information about SSLv2. SSLv3 is what i want to have fixed, the problem is: For my Windows XP machine the code runs perfect to get the index.html from https://www.google.com (althought it will show some error boxes), but it does not for https://www.paypal.com , or https://www.thepiratebay.se, it will show (trappable) errors. BUT when i run this same project at my Windows 8.1 system, it will show errors even for https://www.google.com and it does not get the index.html. PURPOSE: I would like to use a plain windows api socket or mswinsock ocx to my projects, and tell it what HTTPS file it must GET, without the need of the Inet control or the WinHttp.WinHttpRequest. All the methods that you need to do a handshake with a HTTPS server are included and to decrypt the data, but the project itself is very buggy. All we would like to have is a plain ms winsock, and to add the Crypto layer to it to connect to any HTTPS server Ive searched 2 days for this example, it was really very hard to find. But it need big improvements. PS: I did not change the SSLv3 project, the example i found was ment to turn on a server + client to use SSLv3, i just left the server part with it, mayble it can help you understand things better. I only got it working perfect for https://www.google.com , it did give me the html information, but it does not work for Windows 8. If you can make this work in a plain and simple way and share it with us in here, you see it will have HUGE potential.

Download


TTScript
By: idbeholda
TTScript is a stackless, interpreted scripted hobbyist langauge. The artificial environment is similar to that of TI-8x graphing calculators.

Download


WiFi and LAN-Name, Signal Strength, etc…
By: TigerM
A LOT of researched info on WiFi, signal strength, which adapter is connected to wireless, how to override to use LAN if cable plugged in, which of the wireless connections has the lowest metric, etc… I suggest you visit each of the URLs for your own benefit. Note all URLs are included… Borrowed from various sources, and all noted. The one by Techni Rei Myoko no longer exists in PSC (Returns the Wifi signal strength in bars (1 to 5, 5 being good). Placed as generic source for you to use the pieces that you choose… Kindly vote, noting that all info has been researched and collated into one place…

'**************************************
' Name: WiFi and LAN-Name, Signal Strength, etc...
' Description:A LOT of researched info on WiFi, signal strength, which adapter is connected to wireless, how to override to use LAN if cable plugged in, which of the wireless connections has the lowest metric, etc... 
I suggest you visit each of the URLs for your own benefit. Note all URLs are included... Borrowed from various sources, and all noted. The one by Techni Rei Myoko no longer exists in PSC (Returns the Wifi signal strength in bars (1 to 5, 5 being good). 
Placed as generic source for you to use the pieces that you choose...
Kindly vote, noting that all info has been researched and collated into one place...
' By: TigerM
'**************************************

Option Explicit
'WiFi and LAN - Name, Signal Strength, etc...
'------------------------------------------------------------------------------------
'An easy way to test a user's Internet connection with the API
'------------------------------------------------------------------------------------
'Private Declare Function InternetGetConnectedState Lib "wininet" (ByRef dwFlags As Long, _
ByVal dwReserved As Long) As Long
'The function returns 1 if a connection exists and 0 if not. You can easily convert these values to their Boolean equivalents in VB. After the test, the dwflags parameter will indicate what type of connection the user has. You use bitwise comparisons to test for specific values. The dwflags constants are as follows:
Private Const CONNECT_LAN As Long = &H2
Private Const CONNECT_MODEM As Long = &H1
Private Const CONNECT_PROXY As Long = &H4
Private Const CONNECT_OFFLINE As Long = &H20
Private Const CONNECT_CONFIGURED As Long = &H40
' added - Tiger
Private Const CONNECT_RAS As Long = &H10
Private Const CONNECT_MODEM_BUSY As Long = &H8
'------------------------------------------------------------------------------------
'An easy way to test a user's Internet connection with the API
'------------------------------------------------------------------------------------
' ===========================================================================
'http://vbnet.mvps.org/index.html?code/network/internetgetconnectedstate.htm
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Private Sub TestHowConnectedToLanRASetc()
'
'Text1.Text = IsNetConnectViaLAN()
'Text2.Text = IsNetConnectViaModem()
'Text3.Text = IsNetConnectViaProxy()
'Text4.Text = IsNetConnectOnline()
'Text5.Text = IsNetRASInstalled()
'Text6.Text = GetNetConnectString()
'
'End Sub
Private Function IsNetConnectViaLAN() As Boolean
Dim dwFlags As Long
 'pass an empty variable into which the API will
 'return the flags associated with the connection
Call InternetGetConnectedState(dwFlags, 0&)
 'return True if the flags indicate a LAN connection
IsNetConnectViaLAN = dwFlags And INTERNET_CONNECTION_LAN
 
End Function
Private Function IsNetConnectViaModem() As Boolean
Dim dwFlags As Long
 'pass an empty variable into which the API will
 'return the flags associated with the connection
Call InternetGetConnectedState(dwFlags, 0&)
 'return True if the flags indicate a modem connection
IsNetConnectViaModem = dwFlags And INTERNET_CONNECTION_MODEM
 
End Function
Private Function IsNetConnectViaProxy() As Boolean
Dim dwFlags As Long
 'pass an empty variable into which the API will
 'return the flags associated with the connection
Call InternetGetConnectedState(dwFlags, 0&)
 'return True if the flags indicate a proxy connection
IsNetConnectViaProxy = dwFlags And INTERNET_CONNECTION_PROXY
 
End Function
Private Function IsNetConnectOnline() As Boolean
 'no flags needed here - the API returns True
 'if there is a connection of any type
IsNetConnectOnline = InternetGetConnectedState(0&, 0&)
 
End Function
Private Function IsNetRASInstalled() As Boolean
Dim dwFlags As Long
 'pass an empty variable into which the API will
 'return the flags associated with the connection
Call InternetGetConnectedState(dwFlags, 0&)
 'return True if the flags include RAS installed
IsNetRASInstalled = dwFlags And INTERNET_RAS_INSTALLED
 
End Function
Private Function GetNetConnectString() As String
Dim dwFlags As Long
Dim Msg As String
 'build a string for display
If InternetGetConnectedState(dwFlags, 0&) Then
 
 If dwFlags And INTERNET_CONNECTION_CONFIGURED Then
 Msg = Msg & "You have a network connection configured." & vbCrLf
 End If
 If dwFlags And INTERNET_CONNECTION_LAN Then
 Msg = Msg & "The local system connects to the Internet via a LAN"
 End If
 
 If dwFlags And INTERNET_CONNECTION_PROXY Then
 Msg = Msg & ", and uses a proxy server. "
 Else
 Msg = Msg & "."
 End If
 
 If dwFlags And INTERNET_CONNECTION_MODEM Then
 Msg = Msg & "The local system uses a modem to connect to the Internet. "
 End If
 
 If dwFlags And INTERNET_CONNECTION_OFFLINE Then
 Msg = Msg & "The connection is currently offline. "
 End If
 
 If dwFlags And INTERNET_CONNECTION_MODEM_BUSY Then
 Msg = Msg & "The local system's modem is busy with a non-Internet connection. "
 End If
 
 If dwFlags And INTERNET_RAS_INSTALLED Then
 Msg = Msg & "Remote Access Services are installed on this system."
 End If
Else
 
 Msg = "Not connected to the internet now."
End If
GetNetConnectString = Msg
End Function
Public Function RtnNetConnectionString() As String
Dim dwFlags As Long
Dim Msg As String
 Msg = ""
 'build a string for display
If InternetGetConnectedState(dwFlags, 0&) Then
 
 Msg = ""
 
 'If dwflags And INTERNET_CONNECTION_CONFIGURED Then
 'msg = msg & "Configured network connection." & vbCrLf
 'End If
 If dwFlags And INTERNET_CONNECTION_LAN Then
 Msg = Msg & "LAN"
 End If
 
 If dwFlags And INTERNET_CONNECTION_PROXY Then
 Msg = Msg & "(proxy)"
 End If
 
 If dwFlags And INTERNET_CONNECTION_MODEM Then
 If Msg  "" Then Msg = Msg & "."
 Msg = Msg & "MODEM"
 End If
 
 If dwFlags And INTERNET_CONNECTION_OFFLINE Then
 If Msg  "" Then Msg = Msg & "."
 Msg = Msg & "Offline"
 End If
 
 'If dwflags And INTERNET_CONNECTION_MODEM_BUSY Then
 'msg = msg & "modem busy - non-Internet connection. "
 'End If
 
 'If IsNetConnectOnline = True Then msg = msg & "Online."
 
 If Msg = "" Then Msg = "UNKNOWN."
 
 'If dwflags And INTERNET_RAS_INSTALLED Then
 'msg = msg & "Remote Access Services installed."
 'End If
Else
 
 Msg = "Offline"
End If
RtnNetConnectionString = Msg
End Function
' ===========================================================================
Private Sub ForceToUseLANOverWirelessWhenConnectedToBoth()
'https://community.spiceworks.com/scripts/show/1643-force-workstation-to-use-lan-over-wireless-when-connected-to-both
'This script increases the Route metric to a number specified (on line 6).
'I found this on a Microsoft Support site a while
'back: http://support.microsoft.com/kb/894564
'This can (and should?) be used as part of your login scripts that
'are deployed through GPO.
'Please refer to my How to for other ideas on managing wireless and
'wired connections here:
'http://community.spiceworks.com/how_to/show/14437-how-to-bring-harmony-to-your-mixed-wired-and-wireless-networks
''VBS
'strComputer = "."
'Set objWMIService = GetObject("winmgmts:" _
'& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'
'regValueDataMetric = "500"
'
'Set colItems = objWMIService.ExecQuery _
'("Select * From Win32_NetworkAdapter Where NetConnectionID = 'Wireless Network Connection'")
'
'For Each objItem In colItems
'strMACAddress = objItem.MACAddress
'Wscript.Echo "MACAddress: " & strMACAddress
'Next
'
'Set colNetCard = objWMIService.ExecQuery _
'("Select * From Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
'
'For Each objNetCard In colNetCard
'If objNetCard.MACAddress = strMACAddress Then
'For Each strIPAddress In objNetCard.IPAddress
'Wscript.Echo "Description: " & objNetCard.Description
'Wscript.Echo "IP Address: " & strIPAddress
'Wscript.Echo "IPConnectionMetric: " & objNetCard.IPConnectionMetric
'' this sets the value... objNetCard.SetIPConnectionMetric (regValueDataMetric)
'Next
'End If
'Next
'
'' set stuff to nothing here....
'
End Sub
Private Sub DisplayInfoOnAllNICs()
'http://www.visualbasicscript.com/m97503-print.aspx
Dim objWMIService As Object
Dim colItems As Object, objItem As Object
Const wbemFlagReturnImmediately = &H10
Const wbemFlagForwardOnly = &H20
Dim strComputer As String
strComputer = "."
' Wireless
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID = 'Wireless Network Connection[/style]'", "WQL", _
 wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
 'ws.Cells(intRowToUse, 10).value = "" & objItem.Description
 'ws.Cells(intRowToUse, 11).value = "" & objItem.MACAddress
Next
Set colItems = Nothing
Set objWMIService = Nothing
' LAN
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID = 'Local Area Connection[/style]'", "WQL", _
 wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
'ws.Cells(intRowToUse, 12).value = "" & objItem.Description
'ws.Cells(intRowToUse, 13).value = "" & objItem.MACAddress
Next
Set colItems = Nothing
Set objWMIService = Nothing
End Sub
'https://www.promixis.com/forums/showthread.php?15714-Help-With-Visual-Basic-Script
Private Sub ShowAllWirelessAdapters()
On Error Resume Next
Dim objWMIService As Object, colItems As Object, objItem As Object
Dim strComputer As String
Dim regValueDataMetric
Dim ConnectionStatus
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
regValueDataMetric = "35"
ConnectionStatus = 7
Do While ConnectionStatus  2
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapter Where NetConnectionID = 'Wireless Network Connection'")
If colItems.Count = 0 Then
MsgBox "No Wireless Adapter Present!"
ConnectionStatus = 2
Else
For Each objItem In colItems
If objItem.NetConnectionStatus = 2 Then
MsgBox "Name: " & vbTab & vbTab & objItem.Name & vbCrLf _
& "Description: " & vbTab & objItem.Description & vbCrLf _
& "AdapterType: " & vbTab & objItem.AdapterType & vbCrLf _
& "MACAddress: " & vbTab & objItem.MACAddress & vbCrLf _
& "ConnectionStatus: " & vbTab & objItem.NetConnectionStatus & vbCrLf _
& "NetConnectionID: " & vbTab & objItem.NetConnectionID, , "IsConnected.vbs"
'Set GirderEvent = CreateObject("Girder.GirderEvent")
'GirderEvent.Device = 18
'GirderEvent.EventString = "Start Xlobby"
'GirderEvent.Send()
ConnectionStatus = 2
End If
Next
End If
'WScript.Sleep 1000
Loop
End Sub
'**************************************
' Name: WiFi Signal Strength
' Description:Returns the Wifi signal strength in bars (1 to 5, 5 being good)
' By: Techni Rei Myoko
' http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=71872&lngWId=1
'**************************************
Public WiFiHardwareName As String, WiFiDecibals As Long
Public objWMIServiceGlobal As Object
Public isSet As Boolean
Public Declare Function InternetGetConnectedState Lib "Wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Public Enum ConnectedState
INTERNET_CONNECTION_MODEM = &H1
INTERNET_CONNECTION_LAN = &H2
INTERNET_CONNECTION_PROXY = &H4
INTERNET_CONNECTION_MODEM_BUSY = &H8
INTERNET_RAS_INSTALLED = &H10
INTERNET_CONNECTION_OFFLINE = &H20
INTERNET_CONNECTION_CONFIGURED = &H40
End Enum
' ===========================================================================
' ===========================================================================
' ??? uses isset, as default compilation var as false...
' ??? calls InternetGetConnectedState - with default flags value...
Public Function RtnWiFiSignalStrength(Optional Computer As String = ".") As Long
On Error Resume Next
Dim colItems As Object, objItem As Object
Dim WiFiSignalStrength As Long
WiFiSignalStrength = IIf(isConnected, 5, 0)
If Not isSet Then
 Set objWMIServiceGlobal = GetObject("winmgmts:\\" & Computer & "\root\wmi")
 isSet = True
End If
Set colItems = objWMIServiceGlobal.ExecQuery("Select * From MSNdis_80211_ReceivedSignalStrength")
 For Each objItem In colItems
WiFiDecibals = objItem.NDIS80211ReceivedSignalStrength
WiFiHardwareName = objItem.InstanceName
Select Case WiFiDecibals
Case 0: WiFiHardwareName = "Ethernet": WiFiSignalStrength = 5
Case Is > -57: WiFiSignalStrength = 5 ' -56 to 0
Case Is > -68: WiFiSignalStrength = 4 '-67 to -57
Case Is > -72: WiFiSignalStrength = 3 '-71 to -68
Case Is > -80: WiFiSignalStrength = 2 '-79 to -72
Case Is > -90: WiFiSignalStrength = 1 '-89 to -80
Case Else: WiFiSignalStrength = 0
End Select
 Next
Set colItems = Nothing
RtnWiFiSignalStrength = WiFiSignalStrength
End Function
'Connection
Public Function isConnected() As Boolean
Dim dwFlags As Long, RetVal As Long
RetVal = InternetGetConnectedState(dwFlags, 0&)
isConnected = RetVal = 1
End Function
' ===========================================================================
' ===========================================================================
'http://www.experts-exchange.com/questions/28350821/Getting-Wireless-Connection-Name-Through-VBA.html
Function GetNameOfActiveConnection(ByRef AllConnectionNamesCSV As String) As String
Dim strComputer As String
Dim objWMIService As Object
Dim colLAN As Object
Dim colWiFi As Object
Dim objWifi As Object
Dim objLAN As Object
Dim ConnectionName As String
ConnectionName = ""
AllConnectionNamesCSV = ""
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colLAN = objWMIService.ExecQuery("Select * From Win32_NetworkAdapter Where NetConnectionID like 'Local Area Connection' and PhysicalAdapter='True'")
''''Set colLAN = objWMIService.ExecQuery("Select * From Win32_NetworkAdapter Where PhysicalAdapter='True'")
'Set colWiFi = objWMIService.ExecQuery("Select * From Win32_NetworkAdapter Where NetConnectionID =" & "'" & GetWirelessName & "'" & "and PhysicalAdapter='True' ")
'For Each objWifi In colWiFi
'If objWifi.Netconnectionstatus = 2 Then
'ConnectionName = objWifi.Name
'AllConnectionNamesCSV = AllConnectionNamesCSV & ", " & ConnectionName
'End If
'Next
For Each objLAN In colLAN
If objLAN.NetConnectionStatus = 2 Then
ConnectionName = objLAN.Name
AllConnectionNamesCSV = AllConnectionNamesCSV & ", " & ConnectionName
End If
Next
'Set colWiFi = Nothing
Set colLAN = Nothing
Set objWMIService = Nothing
' remove any leading commas in CSV string before returning PARM value...
If AllConnectionNamesCSV  "" Then
 If Left$(AllConnectionNamesCSV, 1) = "," Then
AllConnectionNamesCSV = Right$(AllConnectionNamesCSV, Len(AllConnectionNamesCSV) - 1)
AllConnectionNamesCSV = Trim$(AllConnectionNamesCSV)
 End If
End If
' neaten up...
'dbug
ConnectionName = ""
ConnectionName = Trim$(ConnectionName)
GetNameOfActiveConnection = ConnectionName
End Function
'===========================================================================
' ===========================================================================
Public Function GetDNSQualifiedComputerName(ByRef DomainName As String, ByRef hostname As String) As String
Dim buffer As String
Dim SIZE As Long
Dim network_and_computer As String
Dim network_name As String
On Error Resume Next
' make 3 calls - rather than extract pieces out...
SIZE = 255
buffer = Space(SIZE)
GetComputerNameEx ComputerNameDnsDomain, buffer, SIZE
DomainName = Left$(buffer, SIZE) & ""
DomainName = Trim$(DomainName)
SIZE = 255
buffer = Space(SIZE)
GetComputerNameEx ComputerNameDnsHostname, buffer, SIZE
hostname = Left$(buffer, SIZE) & ""
hostname = Trim$(hostname)
SIZE = 255
buffer = Space(SIZE)
GetComputerNameEx ComputerNameDnsFullyQualified, buffer, SIZE
'network_and_computer = Left$(buffer, size)
'MsgBox network_and_computer
'network_name = Right(network_and_computer, Len(network_and_computer) - InStr(1, network_and_computer, ".", vbTextCompare))
GetDNSQualifiedComputerName = Trim$(Left$(buffer, SIZE) & "")
End Function
' ===========================================================================
'http://stackoverflow.com/questions/3282760/using-wmi-to-determine-which-adapters-is-connected-to-the-internet
'Using Win32_NetworkAdapterConfiguration find the network device that has the
'lowest IPConnectionMetric, this will be the first device used for
'internet access.
' ===========================================================================
Public Function GetInternetAdapterName() As String
Dim objWMIService As Object
Dim colItems As Object, objItem As Object
Dim metric As Long
Dim Description As String
Dim strComputer As String' should pass in PARM???? ....
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration")
metric = 500
Description = ""
For Each objItem In colItems
If (objItem.IPConnectionMetric = 0) Then
metric = objItem.IPConnectionMetric
Description = objItem.Description
End If
Next
Set colItems = Nothing
Set objWMIService = Nothing
GetInternetAdapterName = Description
End Function
' ===========================================================================
Dim AllWiFiConnectionNamesCSV As String
Dim WiFiSignalStrength As Long
Private Sub tmrDateTime_Timer()
Dim DateTimeStr As String
Dim WiFiConnectionName As String
Dim AllWiFiConnectionNamesCSV As String
Dim NetworkName As String
Dim DomainName As String, hostname As String
Dim InternetAdapterName As String
Dim NetConnectionString As String
Dim BattLifePerc As Long
Dim BattLifeTime As String
Dim BattFullLifeTime As String
Dim BattPowerLineSource As String
Dim BattStatus As String
Dim p As Long
Static TenCounter As Long
' roll over from 1 to 10...
If TenCounter > 10 Then TenCounter = 0
If TenCounter < 0 Then TenCounter = 0
TenCounter = TenCounter + 1
 
' Do WiFi things...
' this is every second...
WiFiSignalStrength = RtnWiFiSignalStrength
			 'dbug...
			WiFiSignalStrength = RtnRndBetween(0, 6)
			 If WiFiSignalStrength = 6 Then WiFiSignalStrength = 5
Call DisplayWifiStrengthPic(WiFiSignalStrength)
' every ten seconds, determine the provider...
' this will also allow it to display on first time...
 If (TenCounter = 1) Then
AllWiFiConnectionNamesCSV = ""
WiFiConnectionName = GetNameOfActiveConnection(AllWiFiConnectionNamesCSV)
If WiFiConnectionName = "" Then
' determine network name and domain...eg (computer.hostname.nz.ca)
DomainName = ""
hostname = ""
NetworkName = GetDNSQualifiedComputerName(DomainName, hostname)
WiFiConnectionName = DomainName
p = InStr(1, WiFiConnectionName, ".", vbBinaryCompare)
If p  0 Then
 WiFiConnectionName = Left$(WiFiConnectionName, p - 1)
End If
End If
' debug...
If WiFiConnectionName = "" Then WiFiConnectionName = "MTN" ' GetNameOfActiveConnection(AllWiFiConnectionNamesCSV)
If AllWiFiConnectionNamesCSV  "" Then
 ' do whatever necessary, if we have more than one provider...
End If
WiFiConnectionName = UCase$(WiFiConnectionName)
Call DisplayWifiNamePic(WiFiConnectionName)
' determine network name and domain...eg (machinename.hostname.nz.ca)
'DomainName = ""
'Hostname = ""
'NetworkName = GetDNSQualifiedComputerName(DomainName, Hostname)
'MsgBox "Network name : " & NetworkName & vbCrLf & _
'"Domain Name name : " & DomainName & vbCrLf & _
'"Hostname name : " & Hostname
' Display Internet connectionName
InternetAdapterName = GetInternetAdapterName
'Call DisplayWifiNamePic(InternetAdapterName)
'''''''MsgBox InternetAdapterName
' determine how we are connected (LAN, modem, proxy,etc)
NetConnectionString = RtnNetConnectionString
'MsgBox NetConnectionString
Call DisplayWifiConnectionTypePic(NetConnectionString)
 End If
 
 
 
End Sub
Public Function RtnDateTimeStrFormmated() As String
Dim DateTimeStr As String
 DateTimeStr = Trim$(CStr(Now))
 RtnDateTimeStrFormmated = Mid$(DateTimeStr, 12, 5) & " " & Right$(DateTimeStr, 2)
End Function
Public Function RtnRndBetween(X As Long, Y As Long) As Long
Dim MyValue
 Randomize
 MyValue = Int((Y * Rnd) + X)' Generate random value between 1 and 6.
 RtnRndBetween = MyValue
End Function

WRAT – Work Remote Admin Tool
By: BradleyS
I worked on this in my downtime while at work — it’s purpose was to be a remote administration tool for my own use at work. This project is nowhere near complete and I don’t have the time to continue it in VB6. I’ve decided to move up to a more modern language as VB6 is not well suited for this kind of project. Some features work, such as file transfers and killing or starting processes, but some features were only barely implemented, such as the “plugin” system, or not even started yet, such as “payloads.” The client/server can be used with either TCP or UDP. I used UDP primarily because it was used on my work network. The clients are able to talk to eachother with UDP broadcasts and will “cry” if they are unable to communicate with the server, and if one client has a new address for the server they will share it between eachother and connect. The client tells the server each time a new process starts or stops, browse the file system (however, large folders like the Windows folder cause issues due to large packet size and I never bothered to resolve it). More information in the zip file, see the text file.

Download


Interpolation of surfaces from scattered data points (made in VB6)
By: VB6
This is a software made in the great Visual Basic 6.0 programming language (advanced stuff). It contains routines for interpolation of surfaces from scattered data points. It includes the interpolation “kriging”, with the quadratic method of Shepard and MASUB routine.

Download


Debuggy v2
By: VB6
Debuggy v2 is a Windows (any Windows platform) debugger, disassembler, Windows resource extractor, file hex editor, window sniffer and API spy all rolled into one. This is made in the great Visual Basic 6.0 language.

Download


Bezier – Data points approximated by a polynomial (B-Spline, C spline, T-Spline)
By:
(Automated translation from Italian). The coordinates of the points to be interpolated or approximated may be changed to: 1) selecting, with the mouse cursor, the point to move and dragging it to the desired position. 2) Selecting, in the table, the coordinate to edit and write the new value in the Text box. Clicking an ‘other box or by pressing the’ Enter to confirm the new value; the Escape key restores the previous value. 3) Import a data file, generated by an other application with the menu command “Curve / Read to be interpolated” File of points.

Download


Model Conv (3D car) VB6
By: The View button toggles the display 3D modes. In Single mode only seen subset marked by the cursor (dotted line), Poly mode displays all marked subset. When clicking the Save button marked subset stored in the .mesh file. Read this too: http://www.vbforums.com/showthread.php?680924-Access-of-Speed-2-Race-Game Read this too: http://www.vbforums.com/showthread.php?605201-RESOLVED-Use-DX9-with-VB6!&daysprune=365 Thanks Mikle !

Download


VB-ACAD_Find_Polygon_Center
By: CADFX
Finds the center point of a polyline polygon in AutoCAD using VB. When I needed this function it took me a while to finally find the formula to accomplish this. So I cobbled this together to save someone else the time it took me, if they should need to do the same thing in AutoCAD to find the center point of a polyline defined polygon.

Download


MonsterofModelSpace
By: CADFX
This is for AutoCAD VB and VBA programmers to see many examples of controlling AutoCAD entities and drawing s with Visual Basic. This is reuploaded now after the data loss event.

Download


CADWebSpinnerX
By: CADFX
C A D W e b S p i n n e r X 10-27-2010 Purpose: Create basic web page layouts from the quicker precision in AutoCAD layouts. This allows geometry in an AutoCAD drawing like the sample here, to be the basis of size and Positioning of html DIV, IMG tagged graphics Can you create web pages from AutoCAD? Yes. This program demonstrates a technique for laying out geometries in an AutoCAD drawing and creating HTML tags for DIV (Web ”page dividers), IMG (Web page image tags), Paragraphs (P Paragraph tags). Layout whole div structure. Tips: 1. Use enclosed AutoCAD drawing sample to see the concept of laying out a web screen as an AutoCAD drawing. 2. Draw polygonal rectangles and squares so the first vertex is in the upper left corner, e.g., drag the the polygon from left top, to bottom right with the ”RECTANGLE command, or draw polylines with the same orientation to keep the geometry relative. 3. Set the drawing origin 0,0, to your upper left on screen, with a unit such as DECIMAL which allows 1 unit to represent 1 pixel in a web environment layout. 4. Put all supporting images in the root directory of your ”test creation web tags, so when you paste code into the html body section, images can be found.

Download


Land Survey
By: N.E.Good
Input and process data obtained while doing land survey. Save and open job files. Can be used by office or party chief checking work. Actually very basic, but ir would have filled my needs as a party chief for 30+ years. Tried to create a mapping form, but got lost due to failure to re-orient the xy coordinates. Hopefully some with more experience may add to that, so a map of the survey may be seen. Written with VB6 Re-submitting in to VB6 category, as I had inadvertently submitted in VB Net previously.

Download


htmltags
By:
basic html editor in a text box. inserts html tags around selected text, save and open file, change text box fonts, and more. much more could be added, but for me at least, these are the most used html tags. many thanks to many other programmers with tips and trick that help to refresh my memory in coding. Had a bad tag I missed in first submission. This edit fixes that. 11/11/2015

Download


Integrate Google Drive into VBA applications
By: Dang Dinh Ngoc
Allow simple user to interact with Google Drive objects using VBA code. Since there was not much resource assisting VBA’s interaction with Google APIs, thanks to Kyle Beachill, Bruce Mc Pherson and Tim Hall at http://ramblings.mcpher.com/Home/excelquirks/guests/oauth2. Inspired from their code on OAuth2, I decided to copy, past stuff around the Net and put into this small Access Application to demonstrate the VBA interaction with Google Drive Apis. I hope this would be of help for whom of interst. The application is written in Vietnamese but comments are made in English. Also, I used zlib class, Json class from some other authors. (My original idea was using rclone with access but finally I don’t need them. You can also file the old version using shell and rcclone here http://www.sfdp.net/thuthuataccess/demo/democAuth_old.rar?attredirects=0&d=1) Hope you would enjoy this.
Download


moving and resizing picture on another picture
By: Jos Dickmann
This is my solution about moving, resizing and paste pictures on another picture width… flip horizontal picture, flip vertical picture, 4 pictureboxes, 3 buttons and 3 labels. More free software and sources on my website… http://www.dickmann.org (jos@dickmann.org)

Download


Convert Excel Data to Access Database
By: Cathalea360
XLS to MDB Converter program created in Visual Basic 6.0. It converts excel files to access database.

Download


JS Engine+Debugger (QTScript)
By: dzzie
Test project for using the QTScript Javascript engine and debugger UI from VB6. Including ability to integrate with VB form objects and COM controls.


The QT framework includes its own Javascript engine, QTScript,
which supports a debugger protocol. It even includes a full
javascript debugger UI built in.

We can use this from VB6 to add javascript and debugging
features to our apps.

Just the javascript engine will run about 2mb in dll dependancies.
If you want the full debugger interface support too, then add
another 10mb. But its pretty easy
to use.

The source repository is here:

https://github.com/dzzie/libs/tree/master/qtscript4vb

I have also designed a way to allow it access to VB host objects
and arbitrary (host provided) ActiveX objects. The example repo linked
above just uses a very basic integration of this feature (the main
test here is for the QT integration)

A more comprehensive implementation that allows you to do things
like the following is available:

var ts = fso.OpenTextFile(fpath,1); v = ts.ReadAll();alert(v)

Below is a video overview of it and shows it in action:

(set quality to HD for best viewing note the video is a little old
and a couple bugs in it have already been fixed)

https://www.youtube.com/watch?v=FM81NBBJu6Q

And spoiler alert..my next post will be for another JS engine +
debugger with only 400k runtime dependancy (Duktape JS Engine).
Here the debugger is tightly integrated with a native VB6 GUI.

Blog post with more info here.


JS Engine + Debugger (DukTape)
By: dzzie
Javascript engine + debugger that is tightly integrated with VB6 and includes a mechanism for COM support with host objects.


This project uses the DukTape Javascript engine from VB6.
This engine compiles to about 400k in release mode and includes a
built in debugger protocol.

The debugger is tightly integrated with the VB6 interface and allows
you to directly embed it in your applications. A full IDE type
environment is provided through the open source Scintilla
library which includes all the modern features such as:
syntax highlighting, line numbering, tooltips, intellisense
block indention, code folding, brace matching etc.

All of the project components are open source

You can see a video of it in action here:

https://www.youtube.com/watch?v=nSr1-OugQ1M

The source code along with compiled binaries are available in the
github repository:

https://github.com/dzzie/duk4vb

I have literally wanted this project for the last 15yrs and all the pieces
finally came together. A huge thank you goes out to all of the authors
involved!
Download



Easy Spreadsheet Cells

By: William W.
Create spreadsheet simply just by placing labels on a form also allows printing of said spreadsheet

Download


Free Offline English Dictionary made with VB6
By: Dave Carter
An offline English Dictionary to help with homework, writing and stuff. Screen-shot says what it does and how to use it. The main thing for me is I can double-click a word in a multi-line text box and get a pop-up definition for it.
Huge thanks to Rde, I’m using his Spell Checker which just plugged straight in (although it requires a project reference to MemAPIs.tlb, included).
Thanks also to Project Gutenberg (www.gutenberg.net) for the data, I’m using PG’s free eBook called Webster’s Unabridged English Dictionary. It was last updated in 2014 but there’s no guarantee the word one wants exists among in 90,000+ word definitions.
p.s. the windows are meant to be moveable but one may have to click around a bit to get a grab point.
Be warned, the zip file is a whopping 10Mb but this is mostly the eBook and the Spelling data.
The eBook comes in at 28Mb of plain text with >900,000 lines and >4,000,000 actual words
Anyway, I thought long and hard before uploading this because it has a bug in the Search form and searching for the letter ‘e’ with >2,000,000 entries is a no go, however, bugs aside, the program can be very useful.

Download


Shapefile Anayzer
By: Alan G. Violette
Re-upload of my application since the crash of PSC … not sure why this app didn’t make the CD? Anyway, this program is much like ESRI’s ArcCatalog, but only works with shapefiles (.shp/.shx/.dbf). Explains the reading in of GIS data from the ESRI shapefile format (.dbf is poorly done) but, there is also some viewport scaling lessons for those interested in converting from world coordinates to device coordinates. I may upload an enhanced version with more appropriate .dbf access. I also need to solve the lack of colour categorization of linear features instead of having just black linework.

Download


Advance pdf class without Acrobat reader
By: Sunil K Yadav
pdf class for many of inbuilt functions that you can use withour acrobat reader!
Download



By: Thongkorn Tubtimkrob
This program monitors and records Internet connections in real time. Principle read the script, the asp or php to get the Internet IP address. For InternetGetConnectedStateEx API is used to check the status of your Internet connection. Finally, I will keep a list of them in a Text File.

Download


Unpack specified file from RAR Archive
By: Rde (from psc cd)
This module is a wrapper for the unrar.dll freely available from www.rarlab.com
Enables unpacking a specified file from a RAR archive, both to disk as a file
or only to memory (string variable) as the file text.
There are a couple of other posts on RAR archives, and extracting a single file
from an archive has not been demonstrated, and I needed this functionality for
my ZipSearch project.
Thought others might be interested in this functionality – reuse as you see fit.
Note that the declares for the library functions are named unrar and unrar3
depending on the version you have. Get a free copy of this DLL from:
www.rarlab.com – Extras
www.rarlab.com/rar_add.htm – UnRAR.dll
ftp://ftp.rarlab.com/rar/UnRARDLL.exe
Download


ClientDNS – IPv6
By: J.A. Coutts (from psc cd)
ClientDNS is a utility program designed and intended to give you full access to the DNS packets returned from the requested server. DNS packets are very compact and highly cryptic, and because of that, command line utilities like “NSLookUP” will display incomplete interpretted results. ClientDNS returns all the results on separate tabs. ClientDNS has been tested to be UAC compatible. Internet standards require DNS servers to accept both UDP and TCP requests. TCP is very seldom used however, and some servers do not accept them due to firewall restrictions on port 53. ClientDNS does not support TCP. ClientDNS finds and uses your default DNS servers to get the IP addresses of the named servers. Consequently, it cannot be used to troubleshoot your own DNS service unless you manually enter the IP address of the server. This version supports IPv6, but it has experienced limited testing in this mode because of the inavailability of IPv6 transport. Feedback would be welcome. Update: Further testing with IPv6 showed up some errors when using a Teredo Tunnel. The program was attempting to use the default IPv4 DNS server to find other servers, so it was modified to extract the IPv6 default DNS servers from the registry when using IPv6. As well, the state of the chkIPv6 checkbox was saved to the registry on exit. I also found that I kept forgetting to change the Question Type to “AAAA” when using IPv6, so the default is automatically changed whenever the IP version is changed. PLEASE NOTE: This program supports both IPv4 and IPv6. It utilizes ws2_32.dll, which only exists on operating systems that support IPv6. This includes both Vista and Win7. It will not compile on older operating systems.

Download


VB6 Software Protection and Keygen
By: Maselv (from psc cd)
This is software “lock” module placed on Visual Basic 6.0 program by the developer to prevent the program from being copied or distributed without approval or authorization. The required Serial Code is different for every computer that the program runs in. The Serial Code has five sets of codes with each set having 5 characters i.e. ABCDE-FGHIJ-KLMNO-PQRST-UVWXY. Also packaged is its Keygen and a Readme file that will help you understand the coding.

Download


EGL_CADTools
By: Erkan Sanli (from psc cd)
The tools needed to make the industry standard CAD program. Was clean and simple coding. Here you can learn the basics of algebra. You can learn more about the content by looking at a screen shot. For example, collection of the intersection ,of the geometry on the presence of the special points, and so on. New: Draw a circle section

Download


cSocket2 IPv6
By: J.A. Coutts (from psc cd)
Description: CSocket2 is a Winsock Control substitute. It behaves very much like the Microsoft Winsock Control. The Winsock Control is not the easiest thing in the world to work with, but it is a lot easier than working directly with the Winsock API. Unfortunately, the Winsock Control does not support IPv6, and it doesn’t look like it ever will. Microsoft seems to have abandoned it in favor of managed code in .NET. So what are the alternatives for VB programmers who do not want to get involved with C++ orC#. “Csocket” by Oleg Gdalevich is a drop-in replacement for the Winsock Control. It was further enhanced by Emiliano Scavuzzo with his “CsocketMaster” class. There are a number of advantages with using a Class Module instead of a Control, not the least of which is that it can be modified to suit special needs. These 2 authors took a different approach, but both use “callbacks”. VB6 does not do threading very well, so callbacks are the only real way of communicating with the Windows messaging system. The use of callbacks instead of threads is sometimes referred to as Non-Blocking calls versus Blocking calls. If only a few sockets are required, we would recommend using the cSocket2 class and module directly. One such program demonstrating this is the included “Chat” program. If however, you need multiple sockets for a server type application, then a socket array is the only viable choice. The included SMTP Pseudo Server application demonstrates this approach using the cSocket.ocx ActiveX Control.

Download


Desktop IP Viewer
By:
Gelgamesh (from psc cd)
So, What’s that “DESKTOP IP VIEWER” Thing?! This desktop application will display your External (Not Local) IP. Means, your PC ip on the internet. Anyway, I didn’t see (or may be i didn’t search enough) about an application that do so. So, i started to write this simple application. It’s only 1 line. Yup, Only 1 Line. No more talking, and it’s the time to start working. Rate if you like it. Comment if you wanna ask or complain about something.

Download


Reciprocal Velocity Obstacle (crowd sim)
By: reexre (from psc cd)
RVO. Reciprocal Velocity Obstacle. Crowd Simulation – Video:http://www.youtube.com/watch?v=fN594d80Klg

Download


EVOLVING Creatures V7
By: reexre (from psc cd)
This is a typical example of how evolution works. A population of (customizable) Creatures try to Evolve according to some tasks. A Creature is composed by springs, “muscles” and a neural network. There are “intelligent” and “dumb” springs. First ones change their rest length according to the neural network outputs. The other simply react to external forces to mantain their invariable rest lengths. From V6 there are “muscles”. Muscle is an angle constrain between two links. The NN outputs determinate even the Angle that they must have. The Creature’s Neural Network Inputs are: Vx,Vy & “Pressure” of touching ground Points, Creature Rotation (DX and DY), Height from ground, X Y Velocities and Rotational Velocity. The Creature’s Neural Network Outputs are: “Intelligent” springs rest lengths and Muscles rest angles. EVOLUTION (genetic algorithm): At Each generation there are 3 sons wich parents are “randomly” choosen from the best previous generation creatures. (Some sons mutate their genes with low probability (M)). Then sons are Evaluated. (This 3 sons replace the previous generation worst creatures)

Download


EGL_3DStudioPro 5
By: Erkan Sanli (from psc cd)
Added Shadow Matrix. Transparency bugs have been fixed in this version. Code optimization was achieved greatly. Texturing of the material gathered in a single module. 3d model served as the fastest ever. DirectX or OpenGL is not used. In addition, the filter feature added with bilinear. Thus a more realistic view was obtained. 2nd addition, useful Color Selector dialog box. This upload the final project of 3D viewer.

Download


Fluid Simulator (Smoothed Particle Hydrodynamics) V5.5
By: reexre (from psc cd)
Fluid Simulator (Smoothed Particle Hydrodynamics) V5.5 [Update: FASTER] Add Filled Circle – Motion Blur – Blobby2 Draw Style – Customizable Gravity. Old Features: – Add water Filled Rectangle – Blobby Draw Style. Based on this paper: http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/pvfs.pdf. Suggestions to make the fluid looks more water-like are appreciated. (line line intersect) (Point distance from line)

Download


Multipass BILATERAL FILTER. (V3.3)
By: reexre (from psc cd)
MULTIPASS BILATERAL FILTER. (V3.3) This application applies Multipass Bilateral Filter to color Images. Bilateral filtering is an Edge-preserving smoothing filter. This technique extends the concept of Gaussian smoothing by weighting the filter coefficients with their corresponding relative pixel intensities. Pixels that are very different in intensity from the central pixel are weighted less even though they may be in close proximity to the central pixel. This is effectively a convolution with a non-linear Gaussian filter, with weights based on pixel intensities. This is applied as two Gaussian filters at a localized pixel neighborhood , one in the spatial domain, and one in the intensity domain. Some Parameters make result image with a cartoon-like appearance. V3.2 UPDATE: Added 4 “Intensity Modes (Curves)” plus “Preview Mode”. V3.3 UPDATE: Removed Black Borders + Movable/Hidable Panel + ProgrssBar. [ can someone speed up EFF_BilateralFilter Sub? ]

Download


Art of Edge Detection

By: Hieppies (from psc cd)
Detect any edge of pictures. contain Isothropic, Prewit, Robert, Sobel, Canny, Gaussian.

Download


reexre MORPH 6
By: reexre (from psc cd)
reexre (from psc cd)
Picture Morphing / Deformation . *Uses Baricentric Coordinates.* Made in few hours.

Download


Vertex Mesh Deformation
By: vbinterface (from psc cd)
Demonstration of vertex mesh deformation used in character animation.

Download


How to convert many image formats using the freeware library ‘FreeImage.dll’
By: Salvo Cortesiano (Italy) (from psc cd)
How to convert many image formats using the freeware library FreeImage.dll? Supported formats: BMP files [reading, writing]/DDS files [reading]/EXR files [reading, writing]/Raw Fax G3 files [reading]/GIF files [reading, writing]/HDR files [reading, writing]/ICO files [reading, writing]/IFF files [reading]/JBIG [reading, writing] **/JNG files [reading] /JPEG/JIF files [reading, writing]/JPEG-2000 File Format [reading, writing]/JPEG-2000 codestream [reading, writing]/KOALA files [reading]/Kodak PhotoCD files [reading]/MNG files [reading]/PCX files [reading]/PFM files [reading, writing]/PBM files [reading, writing]/PGM files [reading, writing]/PNG files [reading, writing]/PPM files [reading, writing]/PhotoShop files [reading]/Sun RAS files [reading]/SGI files [reading]/TARGA files [reading, writing]/TIFF files [reading, writing]/WBMP files [reading, writing]/XBM files [reading]/XPM files [reading, writing]

Download


a Super Image Auto-Correction
By: Zaid Markabi (from psc cd)
See screen-shot. This tool can be used to Correct image’s colors, Refresh old photos, Adjust colors. And it includes several standard effects like Natural-Sunlight-Night-Sea-Fog-Burn. Also it’s very fast in processing images.

Download


Simple 3D Metasequoia Model Viewer
By:
vbinterface (from psc cd)
This is a 3D model viewer for Metasequoia models having basic rendering functionality. Metasequoia is a simple yet very powerful 3D modeler with lots of 3D modelling tools. The application helps you to understand parsing 3D object files which are in ASCII format. Also you will learn how to implement 3D transformation, flat shading, etc. One of the new feature added is, use of beautiful images to create very impressive looking slider buttons for horizontal scroll bars. I am sure you will certainly love it. Much of my attention while developing application is always on keeping the code small and compact as well as designing distinctively good looking user interfaces. Such an approach always ends with complex logics, but I enjoy it. My previous posts did not yield good votes/comments. I do not know why. If some-one can let me know the reason behind this, please comment. Although I don’t care about votes, I do appreciate comments because it is just like an feedback to me. And votes will let me know if I have worked well on my applications.

Download


Function Drawer
By:
Saed abumokh (from psc cd)
Function Drawer program is for plotting graphs for math functions. you can change graph lines styles and colors, draw multiple functions… the code includes all common dialogs, each one in class that is easy to use like in .Net, class for menu style changing and menu mouse select event handler, and simple gradient class and other. Function Drawer has a good look (look the screen shot) and easy to use, some programs have a lot of buttons and text boxes and other controls in one window, which make it hard to use. For math functions, you can add constants, draw tangents treat with almost all math functions, like trigonometric functions, hyperbolic functions, logarithms, etc., You can also load and save functions to file, and print them. If you don’t know how to use it, press F1 for help.

Download


VB Code Browser for VB5 & VB6: (R8
By:
Dave Carter (from psc cd)
Reads VB5/6 Projects and Source Files. Project Explorer, Class Explorer, Project Search, Members List, Copy Method, Copy Project, Unzip Project, Scan for local PSC ReadMe Files, Members to HTML, References, Export Code to RTF or HTML, basic Colour Printing, and, more. Unzip requires Unzip32.dll from Info-Zip (links for download on Options page). Many thanks to Rohan for showing me how to unzip to memory with ZipSearch and other fabulous things. I am releasing this having added a few more things and finding it indeispensible. My updates have focused on growing functionality and, subsequently, the project has become an R & D scoping exercise (son of code browser is in progress). Not unicode aware. I still gotta use VB6 so this is writen to serve my own practical needs. Zip size 613k, help file included.

Download


NanoVB6 – A fully portable VB6 version
By: c0rt3x (from psc cd)
NanoVB6 is a very compact VB6 version which is smaller than 5 MB when compressed. It is furthermore fully portable – so that it can be run from a usb stick or on BartPE.

Download


Half Automatic VB6 Application Translator / ‘TansAlyser’
By: c0rt3x (from psc cd)
his VB6 Tool makes translation of EXISTING single language applications much more easy. Is full automatically scans your .vbp project file and all included forms, modules, classes and so on for all strings within your code and even for control captions that are not visible in the code window. Than it displays all strings within a grid view which allows easy and fast translation of your projects even for people that are not familiar with programming at all. Last but no least it finally can create (almost) all necessary code changes on its own and saves the translated files to a new directory! (Actually this code was written by me as a full blown(!) VB6 Obfuscator

Download


Nepali photoshop by Rajesh Shrestha
By: Rajesh Shrestha (from psc cd)
How to make photoshop in VB

Download



By:
Download


VB6 Standard DLL .def Generator
By: Jonell T. Vermudez (from psc cd)
This makes it possible to create your favorite functions into a standard DLL from within VB6! Generates export list for your public functions and subs etc and dumps the file as .def for linking with your DLL project. Updated to fix path of module (with or without path) and added some export list beautifiers in the output .def file. (Now supports methods without the Public in declarations!)

Download


a Super Image Background Remover
By:
Zaid Markabi (from psc cd)
This code let you to Remove Background of Image by selecting a Part of This Background. then the application will remove the Whole Background automatically. Very Easy tool, Fast Simple ans Powerful to Extract Objects from images.

Download


ArtDraw v.2 is Vector Graphics Software
By:
Diomidis (from psc cd)
ArtDraw v.2 is Vector Graphics Software (like to CorelDraw). Draw object => Polyline, Freepolygon, Free line, Calligraphy, Curve(with bezier), RectAngle, Polygon(3-20 point), Ellipse, Text. Edit object => Color line, width and style line, Color backround, Fill with color, pattern or image and (12) different (no implementation) Gradient type. Move, rotate, scale, skew, mirror any object. Implementation new method for edit points for all object. With the left click mouse, edit or view property for any object. New method for Polygon, move points to make many differents shape for example stars and other. New method for zoom, with zoom windows, zoom full page, zoom(-), zoom(+), zoom to select object, free zoom, with middle rolls mouse and pan move. The horizontal and vertical Rulers in Pixels, MM and Inches in all positions of the zoom. Small text editor with fontname,fontsize,fontbold,italic and others. Select or edit different colors palettes. Open & Save to file, copy-paste, undo-redo, move obect front or back. Insert and edit Symbols from fonts. Import-Export to bmp,gif,jpg,png. Included 50 filters for edit images. Export list for cnc amateur machine. Snap to Grid not Implementation yet Text to Path not Implementation yet This project tested on WinXP with screen resolution 1280 X 1024 Any assistance for improvements and additions are accepted.

Download


Transfer Picture from Client to Server
By: brandon teoh (from psc cd)
This sample code in VB6 demonstrates sending picture or image file from a client to server software via Winsock using TCP.

Download


Serial Key Creator

By:
adriangb (from psc cd)
This tool generates between 1 and 10,000 unique Serial key’s 64 characters in length (512 bit) which is derived from MD5 digest. Within the encoded Serial key is an expiry date. The decoder determines if a key is valid and\or expired. The encoded MD5 hash key is non reversible, so to decode, the decoder function needs to recreate the Serial key by sending specific strings to MD5, and then comparing the output hash against the Serial key (hash) that the end-user has submitted to unlock the application. 10,000 keys take approx 3 deconds to decode a key.

Download


Minimum Spanning Tree using Prim and Kruskal Algorithms
By:
As”ad Djamalilleil (from psc cd)
Demonstrate the uses of Minimum Spanning Tree in Prim dan Kruskal Algorithm.
Download


Crowd Simulator
By:
reexre (from psc cd)
Crowd Simulation – Virtual Walkers – realistic walking in virtual world.

Download


a 3D Digital Reality Engine V1.00
By: KACI Lounes (from psc cd)
3D Digital Reality Engine V1.00, PURE VB, by KACI Lounes Just if you are an expert 3D programmer, you must NOT miss this submission… Before I give you one word, PLEASE see the screen-shot ! THIS IS AN EXTEMLY RARE SUBMISSION EVER MADE FOR HIGH LEVEL 3D-GRAPHICS : 1: in VB code, 2: in PURE VB CODE (no DirectX or OpenGL), 3: in the PSC This is the first publication release on the Internet… more modifications and additions will comes in the future versions… The source code is written in a very careful way so everybody can understand how the things works. your questions, and suggestions are VERY important to me, of course…just don’t forgot to give me some votes ! Be only PATIENT during the download operation, because the archive include also the documentation & some samples of 3D scenes. KACI Lounes EOF.

Download


Elastic Creatures
By: reexre (from psc cd)
Create Elastic Creatures. See ScreenShot

Download


Bezier Curve (Infinite number of points)
By:
Daniel Hansson (from psc cd)
This code uses a recursive function to generate a Bezier curve, based on any number of control points. It also have an easy-to-use interface to control the curves.

Download


FilmStrip OCX
By:
Damic (from psc cd)
Creates a Filmstrip from images, directory or multiply directory’s
Download


Intelligence Generator/Detector, Version 4.0
By: Gary Gaulin (from psc cd)
This computer model demonstrates self-organizing, self-learning intelligence. On startup this guess/memory intelligence is like a newborn. It does not know up from down or left from right or what it’s seeing, experiencing. But from trial and error quickly learns how to coordinate motors with sensory information to get where it wants to go. The model also has an angular ring memory that adds awareness of where the feeder is located when it is out of its field of vision. Like us when a ball goes by we know where it went and without thinking about it can turn in the proper direction. This can be tested by checking a box that allows the mouse to be used to move the feeder around the screen so it gives chase. After some training time it will get very good at keeping up with it. This model is analogous to finger muscle control that through training becomes coordinated in a way that they have the keyboard layout stored as motions to reach each key. In both cases intelligence successfully learns to navigate a 3D space without requiring a physical map. Intelligence detection is in the form of a graphic display that allows confidence, contents of memory and success staying fed to be shown. No intelligence at all would produce a flat-line graph. But as input sensory information is added it’s learning rate increases, as does its confidence level. Experimenting with how the simple main loop uses its sensory information (analogous to how neurons are connected) can produce thousands of various behaviors. Documentation Included.

Download


Chat online Without Servers and multi clients
By: Zaid Markabi (from psc cd)
Chat online Without Servers and multi clients Easy, Simple and powerful program .. without any Dll or OCX files

Download


FAST Magic Wand Example
By: Scythe (from psc cd)
Ever wanted to use a Magic Wand Selection like Photoshop… Here is an example how to do it easy and real Fast.

Download


Login To Site Using Winsock
By: Mason Reece Soiza (from psc cd)
This is an example of how to login to a site using winsock i use bebo as an example.

Download


Serials Reader
By: VBtutor (from psc cd)
Protect your application from being executed on unauthorized machines. Read many serials from PC like Motherboard, CPU, Windows, HDD

Download


How to Capture the {FRAMES} of all supported Media files [Movie Media]
By: Salvo Cortesiano (Italy) (from psc cd)
How to Capture the {FRAMES} of all supported Media files [Movie Media]… The Author of the original code of the Media Player OCX is: Jason Lusk (EvilTeddyBear) Found it at this link: http://www.planet-source-code.com/vb/scripts/ShowCode.asp txtCodeId=48129&lngWId=1 ! I used the dll freeware CapStill.dll to capture frames. You found the DLL at this link: http://www.gdcl.co.uk/index.htm. Supported and Captured movie format: *.avi;*.asf;*.mpg;*.mpeg;*.wmv;*.divx;*.dat;*.mpx;*mkv;*.mov;*.vob;*.flv Don’t forget to register the DLL CapStill.dll and adding a reference to this library before running the project! Also adding the reference ‘Microsoft Active Movie Control Library’… NEW UPDATE: Capture Random 6 Frame’s. Convert captured BMP image to JPG compatible image file. FEAUTURE’s: Capture from xx:xx:xx time to xx:xx:xx time Enjoy

Download


TwigMax – Lite Stickfigure Animator
By: Glenn Michael Mejias (from psc cd)
This program is similar to popular Pivot StickFigure Animator. So, if anyone want’s to create another stickfigure animator, this is helpful for starting.

Download


Remote Desktop
By: b2qid (from psc cd)
Remote Desktop Like VNC with Winsock Control, No Other OCX Required. Control Server Via Viewer Control Mouse and Keyboard Dual Monitor Support

Download


ConvertIT Audio/Video Converter
By: Warren Goff (from psc cd)
This is an update and correction for txtCodeId=70578 original program. It wasn’t converting most of the supported video formats so I fixed it. It uses ffmpeg.exe which is renamed to avformat.dll and placed in the app.path. I’ve supported the most recent build of ffmpeg.exe and I’ve placed it on my server: http://www.moosenose.com/avformat.zip. You may also download the original and compile it yourself: www.ffmpeg.org. I’ve also added conversion to Animated GIFs of various resolutions. The program will stay top most and can open the saved directory and play the saved, converted video. I’ve removed the dependency to the Common Dialog Control which makes the program portable for all versions of Windows which already have the VB 6 Runtimes. Other than that, the program is unchanged.

Download



By: reexre (from psc cd)
This application applies Multipass Bilateral Filter to color Images. Bilateral filtering is an Edge-preserving smoothing filter. This technique extends the concept of Gaussian smoothing by weighting the filter coefficients with their corresponding relative pixel intensities. Pixels that are very different in intensity from the central pixel are weighted less even though they may be in close proximity to the central pixel. This is effectively a convolution with a non-linear Gaussian filter, with weights based on pixel intensities. This is applied as two Gaussian filters at a localized pixel neighborhood , one in the spatial domain, and one in the intensity domain. Cartoon: To obtain cartoon-like results, these new effects have been implemented: * Contour * Luminance Segmentation **’ Licence: GPL3 ***

Download


EGL_Bilinear Filtering
By: Erkan Sanli (from psc cd)
Ultra fast texture mapping with bilinear filter. Now supported text. No ASM, DX, GL

Download


EGL_Clipping
By: Erkan Sanli (from psc cd)
Rectangle and triangle intersections and clipping. This project contains canvas and face clip operations for 3D programming. Delaunay triangulations algorithm not used. Simple and fast. Add Bonus Project: Angle

Download


Geometry Tools 2D
By: reexre (from psc cd)
Draw arc of a given Radius tangent to two lines – Line Offset – Fast Atan2 Approx. – Circle Line Intersection – Line Line Intersection – Circle Circle Intersection – Circle from 3 Points – Tangents of 2 Circles – Vector Projection – Vector Reflection – Nearest point on Line – Angle Difference

Download


A Virtual Trackball and Quaternion Primer
By: RandyT_CS (from psc cd)
This program includes a virtual trackball and shows the programmer how to use quaternions to implement natural object rotation in 3-D graphics.

Download


SKETCHER 2ND (V4)

By: reexre (from psc cd)
My Pencil Sketch Effect 2ND. (see Screenshot) (V4 new background mode) [Gabor Filter – SOBEL (Jähne et al. [1999] variation) ]

Download


Google Speak
By: reexre (from psc cd)
Google Speak more than 100 character. (and save the MP3) Thanks to Leandro Ascierto
Download


a Simply Genetic Algorithm And Neural Network PROJECTS (V2)
By: reexre (from psc cd)
Genetic Algorithm Class – Simple and easy to use. + Modified ParasChopra Neural Net by www.paraschopra.com. —– EXAMPLE PROJECTS: —– [ FILLTHEGRID ]: Example of use of Genetic Algorithm Class (SimplyGA). —– [ TSP WITH GA ]: Travel Salesman Problem solved by Genetic Algorithm Class (SimplyGA). —- [ XOR ]: Xor Function performed by Neural Net.(Neural net is Trained by Genetic Algorithm Class). —– [ FLYERS ]: NEURAL NET TRAINED BY GENETIC ALGORITHM. A Population of Individuals moves according to a Population of Neural Nets. The Goal is to stay closer to the Red Point. Before changing red point (start) position the population is evaluated. The nearest reproduce and replace the worst. (This is performed by GA.) Neural Nets are Updated by putting to Neuron Biases and Sinapses eights the Genes of GA. Net Inputs are 3: How much red point is LeftRight, how much it is FrontBack and the distance from it. Net Outputs are 2: Steer and Accellerate/brake. (This is ARTIFICIAL INTELLIGENCE) /// more will be added/updated /// 09.05.2009 Added Xor_Or_And / Improved Flyers.

Download


Free Land
By: Zaid Markabi (from psc cd)
3D Photorealistic Scenery Rendering Software, FreeLand can be used to generate 3D terrain and landscape. When you have clear picture .. you have FreeLand. see screenshot and get it now.. Em@il : zaidmarkabi@yahoo.com

Download


Equation Graphing (By VBA)
By: Wael Sayed (from psc cd)
This software draws F(x) for any given defined formula of ‘x’. When writing this formula, the rules of writing formulas in MS Excel should be followed. You can use any pre-defined or user defined functions if its output is numerical.

Download


USB Detect and Inform to Server
By: charan.p (from psc cd)
It is a simple code with one module and one dll file to detect the unauthorised Usb in an office with the systems are connected with Lan/network.It will be very useful to monitor weather the staff is carrying important data from the office.I thank to one of the programmer from whose code i got the idea to come with this. One important thing is that to see the best results of this program you need two systems connected in Lan.

Download


DM Writer
By: dreamvb (from psc cd)
DM Writer is an RTF Editor I been working on for the last two days, it comes with most of the features in wordpad and more, Please note this is the first version and I hope to add more cool things next time, so far it has most of the edit options, save, save selection, Text colors and styles, Highlight text, Insert symbols, Find and Replace, Goto options and much more hope you find the code usfull, many comments included. Please vote if you find this code usfull.

Download


Solar Storm OS

By: Matias Ferrari (from psc cd)
Solar Storm OS is an operating system created for USB. Has many features that make it ideal to carry around with everything organized in your pen drive in a simple way. Controls the time, date system, if connected to the Internet, an Internet browser, a really good file browser and thousands of more options that make it unique in this field. It’s just a beta version but with your help i can improve more and more. If you like the source code do not hesitate to vote for me Solar Storm OS es un sistema operativo creado para USB. Tiene muchas características que lo hacen ideal para llevar siempre encima todo organizado en pendrive de una manera sencilla. Controla el tiempo, sistema de fechas, si está conectado a Internet, un navegador de Internet, un explorador de archivos muy bueno y miles de opciones más que la hacen único en este campo. Es sólo una versión beta, pero con tu ayuda puedo mejorar más y más.

Download


EGL_PointCloud V1.0
By: Erkan Sanli (from psc cd)
Review project. Create point to mesh and object. Export OBJ 3D model file. Use delaunay triangulation algorithm. Addition mouse buttons and wheel events.(Zip:837kb)

Download



By:
Download


API declarations

One of the most reliable sites about API declarations and use in this site, that deals with 940 functions to be called. They are related to 32-bit (x86) systems; but for 64-bit, we will generally need to change from Long to LongPtr variables, but not on all of them, so from here on, things start to get complex, and there is some search to do.

From MS, here is a SFX file  that covers most API 64-bits declarations and constants. The file extracts to a Win32API_PtrSafe.txt that contains the following:

  • 32-bit (x86) and 64-bit (x64) compatible Declare statements for the Windows API functions that were included in the original Win32API.txt file.
  • Global constant declarations for the constants that the provided Declare statements use.
  • Type declarations for the user-defined types (structures) that the provided Declare statements use.

UtterAccess has published a wiki that tries to list some common APIs in VBA7 syntax.

And finally Jan Karel Pieterse has an specific post on the declarations, that is my first option when I try to declare 64bits functions.

Distribute Excel add-Ins

The original content (and all the images) for this post were borrowed from RatExcel blog. Credits go for him, this is just a shortened version that comprises WinRAR/7-Zip methodologies with the necessary steps.


It’s complex and discouraging to go through the process to install an XLA add-in, and with any update the process will have to be repeated. Packing the files into Self-extracting archives (SFX) totally helps, as all it takes is just one double-click and the add-in will be automatically extracted to the proper directory.

 

SFX method for WinRAR

Right-click on the file(s) you want to add to SFX archive and choose “Add to archive…” option. Archive name and parameters window should pop up – on the General tab check “Create SFX archive”.

Create SFX using WinRAR 01

Go to Advanced tab and click on “SFX options…” button.

Create SFX using WinRAR 02

Advanced SFX options window will pop up. On General tab provide the path where you want your file(s) to be extracted. You can use one of common folder variables e.g. “%APPDATA%” to access AppData folder valid for given user.

If you want your add-in to be visible on Excel Add-ins list you have to place it in the AddIns location (look in your PC for C:\Users\%USERNAME%\AppData\Roaming\Microsoft\AddIns\, changing USERNAME variable with your propper username):

%APPDATA%\Microsoft\AddIns\

If you want your add-in to start automatically each time you open Excel but you don’t want it to be visible on Excel Add-ins list you have to place it in XLSTART folder (C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Excel\XLSTART\, again, you have to change username):

%APPDATA%\Microsoft\Excel\XLSTART\

Create SFX using WinRAR 03

On Modes tab you can select “Hide all” option if you want the whole process to take place in the background (silent mode).

Create SFX using WinRAR 04

On Update tab you are able to choose the Update mode – “Extract and replace files” and Overwrite mode – “Overwrite all files” in my case.

Create SFX using WinRAR 05

There are several additional options like:

  1. Running scripts before or after execution (Setup tab)
  2. Deleting files in the destination folder and creating shortcuts (Advanced tab)
  3. Setting title and text to display in SFX window & changing SFX logo and icon (Text and icon tab) – changes visible only when “Display all” mode is selected on Modes tab
  4. Setting title and text of the license (License tab)

SFX method for WinZip/7-Zip

Not as easy as with WinRAR.

First of all, we have to compress your add-in to “.7z” archive and put it in new folder.

Next step is to download and extract 7zsd.sfx file – modified module for 7-Zip created by Oleg Scherbakov. Take 7zsd.sfx and put it in the same folder as your zipped add-in.

Also in the same folder create new “config.txt” file containing the below code:

;!@Install@!UTF-8!
Title="RatExcelAddIn"
InstallPath="%APPDATA%\\Microsoft\\Excel\\XLSTART"
FinishMessage="Add-In installed/updated successfully!"
GUIMode="1"
SelfDelete="0"
;!@InstallEnd@!

Or replace “%APPDATA%\\Microsoft\\Excel\\XLSTART” with “%APPDATA%\\Microsoft\\AddIns” if you want your add-in to be visible on Excel Add-ins list and leave the decision to switch it on/off to user. You can also change “Title” and “FinishMessage” parameters to any other text you want.

If you set “GUIMode” to 2 then the whole process will take place in the background and you won’t see the finish message and if you set “SelfDelete” to 1 the file will be deleted after the execution. We want to see the finish message and we don’t want to delete the file so we leave the parameters as they are.

You can find more information on possibilities 7zsd.sfx may give you here, here, here and here. There are also some usage examples here and manual on how to change SFX icon here.

Then also in the same folder create another text file called “compile.txt” containing the below code:

copy /b 7zsd.sfx + config.txt + RatExcelAddIn.7z RatExcelAddIn.exe

Caution: Remember to set text file encoding to UTF-8 when saving the file! Also make sure that “.7z” file name is exactly the same as your zipped add-in name and provide the name of the SFX “.exe” file you want as a result. I like to keep it simple and gave it the same name as the name of the archive.

Then save the file and change its extension from “.txt” to “.bat”.

You should have four files in your folder:

RatExcelAddIn.7z
7zsd.sfx
config.txt
compile.bat

Now double-click on “compile.bat”. “RatExcelAddIn.exe” file should be created in your folder. This file when executed will extract your add-in to the “InstallPath” you’ve provided in “config.txt” file. “%APPDATA%” will be replaced with AppData folder path valid for given user.

Next time if you make any changes to your add-in just place its updated version in the folder, zip it to “.7z” archive, run “compile.bat” file and you will have new updated self-extracting archive created.

More on VBA protection

https://www.straxx.com/vba-password-reset-a/

https://www.decalage.info/vba_tools

Option Explicit

#If VBA7 Then
    Private Declare PtrSafe Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hwndParent As LongPtr, ByVal hwndChildAfter As LongPtr, ByVal lpszClass As String, ByVal lpszWindow As String) As LongPtr
    Private Declare PtrSafe Function GetParent Lib "user32" (ByVal hWnd As LongPtr) As LongPtr
    Private Declare PtrSafe Function GetDlgItem Lib "user32" (ByVal hDlg As LongPtr, ByVal nIDDlgItem As Long) As LongPtr ' nIDDlgItem = int?
    Private Declare PtrSafe Function GetDesktopWindow Lib "user32" () As LongPtr
    Private Declare PtrSafe Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As LongPtr, ByVal Msg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare PtrSafe Function SetFocusAPI Lib "user32" Alias "SetFocus" (ByVal hWnd As LongPtr) As LongPtr
    Private Declare PtrSafe Function LockWindowUpdate Lib "user32" (ByVal hWndLock As LongPtr) As Long
    Private Declare PtrSafe Function SetTimer Lib "user32" (ByVal hWnd As LongPtr, ByVal nIDEvent As LongPtr, ByVal uElapse As Long, ByVal lpTimerFunc As LongPtr) As LongPtr
    Private Declare PtrSafe Function KillTimer Lib "user32" (ByVal hWnd As LongPtr, ByVal uIDEvent As LongPtr) As Long
    Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#Else
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, ByVal lpszClass As String, ByVal lpszWindow As String) As Long
    Private Declare Function GetParent Lib "user32" (ByVal hWnd As Long) As Long
    Private Declare Function GetDlgItem Lib "user32" (ByVal hDlg As Long, ByVal nIDDlgItem As Long) As Long ' nIDDlgItem = int?
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Function SetFocusAPI Lib "user32" Alias "SetFocus" (ByVal hWnd As Long) As Long
    Private Declare Function LockWindowUpdate Lib "user32" (ByVal hWndLock As Long) As Long
    Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
    Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal uIDEvent As Long) As Long
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If

Private Const WM_CLOSE As Long = &H10
Private Const WM_GETTEXT As Long = &HD
Private Const EM_REPLACESEL As Long = &HC2
Private Const EM_SETSEL As Long = &HB1
Private Const BM_CLICK As Long = &HF5&
Private Const TCM_SETCURFOCUS As Long = &H1330&
Private Const IDPassword As Long = &H155E&
Private Const IDOK As Long = &H1&

Private Const TimeoutSecond As Long = 2

Private g_ProjectName    As String
Private g_Password       As String
Private g_Result         As Long
#If VBA7 Then
    Private g_hwndVBE        As LongPtr
    Private g_hwndPassword   As LongPtr
#Else
    Private g_hwndVBE        As Long
    Private g_hwndPassword   As Long
#End If

Sub Test_UnlockProject()
    Select Case UnlockProject(ActiveWorkbook.VBProject, "Test")
        Case 0: MsgBox "The project was unlocked"
        Case 2: MsgBox "The active project was already unlocked"
        Case Else: MsgBox "Error or timeout"
    End Select
End Sub

Public Function UnlockProject(ByVal Project As Object, ByVal Password As String) As Long

#If VBA7 Then
    Dim lRet As LongPtr
#Else
    Dim lRet As Long
#End If
Dim timeout As Date

    On Error GoTo ErrorHandler
    UnlockProject = 1

    ' If project already unlocked then no need to do anything fancy
    ' Return status 2 to indicate already unlocked
    If Project.Protection  vbext_pp_locked Then
        UnlockProject = 2
        Exit Function
    End If

    ' Set global varaibles for the project name, the password and the result of the callback
    g_ProjectName = Project.Name
    g_Password = Password
    g_Result = 0

    ' Freeze windows updates so user doesn't see the magic happening 🙂
    ' This is dangerous if the program crashes as will 'lock' user out of Windows
    ' LockWindowUpdate GetDesktopWindow()

    ' Switch to the VBE
    ' and set the VBE window handle as a global variable
    Application.VBE.MainWindow.Visible = True
    g_hwndVBE = Application.VBE.MainWindow.hWnd

    ' Run 'UnlockTimerProc' as a callback
    lRet = SetTimer(0, 0, 100, AddressOf UnlockTimerProc)
    If lRet = 0 Then
        Debug.Print "error setting timer"
        GoTo ErrorHandler
    End If

    ' Switch to the project we want to unlock
    Set Application.VBE.ActiveVBProject = Project
    If Not Application.VBE.ActiveVBProject Is Project Then GoTo ErrorHandler

    ' Launch the menu item Tools -> VBA Project Properties
    ' This will trigger the password dialog
    ' which will then get picked up by the callback
    Application.VBE.CommandBars.FindControl(ID:=2578).Execute

    ' Loop until callback procedure 'UnlockTimerProc' has run
    ' determine run by watching the state of the global variable 'g_result'
    ' ... or backstop of 2 seconds max
    timeout = Now() + TimeSerial(0, 0, TimeoutSecond)
    Do While g_Result = 0 And Now() < timeout
        DoEvents
    Loop
    If g_Result Then UnlockProject = 0

ErrorHandler:
    ' Switch back to the Excel application
    AppActivate Application.Caption

    ' Unfreeze window updates
    LockWindowUpdate 0

End Function

#If VBA7 Then
    Private Function UnlockTimerProc(ByVal hWnd As LongPtr, ByVal uMsg As Long, ByVal idEvent As LongPtr, ByVal dwTime As Long) As Long
#Else
    Private Function UnlockTimerProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) As Long
#End If

#If VBA7 Then
    Dim hWndPassword As LongPtr
    Dim hWndOK As LongPtr
    Dim hWndTmp As LongPtr
    Dim lRet As LongPtr
#Else
    Dim hWndPassword As Long
    Dim hWndOK As Long
    Dim hWndTmp As Long
    Dim lRet As Long
#End If
Dim lRet2 As Long
Dim sCaption As String
Dim timeout As Date
Dim timeout2 As Date
Dim pwd As String

    ' Protect ourselves against failure 🙂
    On Error GoTo ErrorHandler

    ' Kill timer used to initiate this callback
    KillTimer 0, idEvent

    ' Determine the Title for the password dialog
    Select Case Application.LanguageSettings.LanguageID(msoLanguageIDUI)
        ' For the japanese version
        Case 1041
            sCaption = ChrW(&H30D7) & ChrW(&H30ED) & ChrW(&H30B8) & _
                        ChrW(&H30A7) & ChrW(&H30AF) & ChrW(&H30C8) & _
                        ChrW(&H20) & ChrW(&H30D7) & ChrW(&H30ED) & _
                        ChrW(&H30D1) & ChrW(&H30C6) & ChrW(&H30A3)
        Case Else
            sCaption = " Password"
    End Select
    sCaption = g_ProjectName & sCaption

    ' Set a max timeout of 2 seconds to guard against endless loop failure
    timeout = Now() + TimeSerial(0, 0, TimeoutSecond)
    Do While Now() < timeout

        hWndPassword = 0
        hWndOK = 0
        hWndTmp = 0

        ' Loop until find a window with the correct title that is a child of the
        ' VBE handle for the project to unlock we found in 'UnlockProject'
        Do
            hWndTmp = FindWindowEx(0, hWndTmp, vbNullString, sCaption)
            If hWndTmp = 0 Then Exit Do
        Loop Until GetParent(hWndTmp) = g_hwndVBE

        ' If we don't find it then could be that the calling routine hasn't yet triggered
        ' the appearance of the dialog box
        ' Skip to the end of the loop, wait 0.1 secs and try again
        If hWndTmp = 0 Then GoTo Continue

        ' Found the dialog box, make sure it has focus
        Debug.Print "found window"
        lRet2 = SendMessage(hWndTmp, TCM_SETCURFOCUS, 1, ByVal 0&)

        ' Get the handle for the password input
        hWndPassword = GetDlgItem(hWndTmp, IDPassword)
        Debug.Print "hwndpassword: " & hWndPassword

        ' Get the handle for the OK button
        hWndOK = GetDlgItem(hWndTmp, IDOK)
        Debug.Print "hwndOK: " & hWndOK

        ' If either handle is zero then we have an issue
        ' Skip to the end of the loop, wait 0.1 secs and try again
        If (hWndTmp And hWndOK) = 0 Then GoTo Continue

        ' Enter the password ionto the password box
        lRet = SetFocusAPI(hWndPassword)
        lRet2 = SendMessage(hWndPassword, EM_SETSEL, 0, ByVal -1&)
        lRet2 = SendMessage(hWndPassword, EM_REPLACESEL, 0, ByVal g_Password)

        ' As a check, get the text back out of the pasword box and verify it's the same
        pwd = String(260, Chr(0))
        lRet2 = SendMessage(hWndPassword, WM_GETTEXT, Len(pwd), ByVal pwd)
        pwd = Left(pwd, InStr(1, pwd, Chr(0), 0) - 1)
        ' If not the same then we have an issue
        ' Skip to the end of the loop, wait 0.1 secs and try again
        If pwd  g_Password Then GoTo Continue

        ' Now we need to close the Project Properties window we opened to trigger
        ' the password input in the first place
        ' Like the current routine, do it as a callback
        lRet = SetTimer(0, 0, 100, AddressOf ClosePropertiesWindow)

        ' Click the OK button
        lRet = SetFocusAPI(hWndOK)
        lRet2 = SendMessage(hWndOK, BM_CLICK, 0, ByVal 0&)

        ' Set the gloabal variable to success to flag back up to the initiating routine
        ' that this worked
        g_Result = 1
        Exit Do

        ' If we get here then something didn't work above
        ' Wait 0.1 secs and try again
        ' Master loop is capped with a longstop of 2 secs to terminate endless loops
Continue:
        DoEvents
        Sleep 100
    Loop
    Exit Function

    ' If we get here something went wrong so close the password dialog box (if we have a handle)
    ' and unfreeze window updates (if we set that in the first place)
ErrorHandler:
    Debug.Print Err.Number
    If hWndPassword  0 Then SendMessage hWndPassword, WM_CLOSE, 0, ByVal 0&
    LockWindowUpdate 0

End Function

#If VBA7 Then
    Function ClosePropertiesWindow(ByVal hWnd As LongPtr, ByVal uMsg As Long, ByVal idEvent As LongPtr, ByVal dwTime As Long) As Long
#Else
    Function ClosePropertiesWindow(ByVal hWnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwTime As Long) As Long
#End If

#If VBA7 Then
    Dim hWndTmp As LongPtr
    Dim hWndOK As LongPtr
    Dim lRet As LongPtr
#Else
    Dim hWndTmp As Long
    Dim hWndOK As Long
    Dim lRet As Long
#End If
Dim lRet2 As Long
Dim timeout As Date
Dim sCaption As String

    ' Protect ourselves against failure 🙂
    On Error GoTo ErrorHandler

    ' Kill timer used to initiate this callback
    KillTimer 0, idEvent

    ' Determine the Title for the project properties dialog
    sCaption = g_ProjectName & " - Project Properties"
    Debug.Print sCaption

    ' Set a max timeout of 2 seconds to guard against endless loop failure
    timeout = Now() + TimeSerial(0, 0, TimeoutSecond)
    Do While Now() < timeout         hWndTmp = 0         ' Loop until find a window with the correct title that is a child of the         ' VBE handle for the project to unlock we found in 'UnlockProject'         Do             hWndTmp = FindWindowEx(0, hWndTmp, vbNullString, sCaption)             If hWndTmp = 0 Then Exit Do         Loop Until GetParent(hWndTmp) = g_hwndVBE         ' If we don't find it then could be that the calling routine hasn't yet triggered         ' the appearance of the dialog box         ' Skip to the end of the loop, wait 0.1 secs and try again         If hWndTmp = 0 Then GoTo Continue         ' Found the dialog box, make sure it has focus         Debug.Print "found properties window"         lRet2 = SendMessage(hWndTmp, TCM_SETCURFOCUS, 1, ByVal 0&)         ' Get the handle for the OK button         hWndOK = GetDlgItem(hWndTmp, IDOK)         Debug.Print "hwndOK: " & hWndOK         ' If either handle is zero then we have an issue         ' Skip to the end of the loop, wait 0.1 secs and try again         If (hWndTmp And hWndOK) = 0 Then GoTo Continue         ' Click the OK button         lRet = SetFocusAPI(hWndOK)         lRet2 = SendMessage(hWndOK, BM_CLICK, 0, ByVal 0&)         ' Set the gloabal variable to success to flag back up to the initiating routine         ' that this worked         g_Result = 1         Exit Do         ' If we get here then something didn't work above         ' Wait 0.1 secs and try again         ' Master loop is capped with a longstop of 2 secs to terminate endless loops Continue:         DoEvents         Sleep 100     Loop     Exit Function     ' If we get here something went wrong so unfreeze window updates (if we set that in the first place) ErrorHandler:     Debug.Print Err.Number     LockWindowUpdate 0 End Function 

To protect

  Imports Excel = Microsoft.Office.Interop.Excel   Public Class Form1     '~~> Define your Excel Objects
    Dim xlApp As New Excel.Application
    Dim xlWorkBook As Excel.Workbook
    Dim xlWorkSheet As Excel.Worksheet

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim MyPassword As String = "Password"

        '~~> Opens Source Workbook. Change path and filename as applicable
        xlWorkBook = xlApp.Workbooks.Open("C:\Sample.xlsx")

        '~~> Display Excel
        xlApp.Visible = True

        xlWorkSheet = xlWorkBook.Sheets("Sheet1")

        '~~> Protecting the sheet. You have access to many settings which you can set to true or false
        xlWorkSheet.Protect(MyPassword, DrawingObjects:=True, Contents:=True, Scenarios:= _
        True, AllowFormattingCells:=False, AllowFormattingColumns:=False, _
        AllowFormattingRows:=False, AllowInsertingColumns:=False, AllowInsertingRows _
        :=False, AllowInsertingHyperlinks:=False, AllowDeletingColumns:=False, _
        AllowDeletingRows:=True, AllowSorting:=False, AllowFiltering:=False, _
        AllowUsingPivotTables:=False)
    End Sub
End Class

To unprotect

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1
    '~~> Define your Excel Objects
    Dim xlApp As New Excel.Application
    Dim xlWorkBook As Excel.Workbook
    Dim xlWorkSheet As Excel.Worksheet

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim MyPassword As String = "Password"

        '~~> Opens Source Workbook. Change path and filename as applicable
        xlWorkBook = xlApp.Workbooks.Open("C:\Sample.xlsx")

        '~~> Display Excel
        xlApp.Visible = True

        '~~> Protecting the workbook structure
        xlWorkBook.Protect(MyPassword, Structure:=True, Windows:=True)
    End Sub
End Class

To Save file

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1
    '~~> Define your Excel Objects
    Dim xlApp As New Excel.Application
    Dim xlWorkBook As Excel.Workbook
    Dim xlWorkSheet As Excel.Worksheet

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        '~~> Opens Source Workbook. Change path and filename as applicable
        xlWorkBook = xlApp.Workbooks.Open("C:\Tutorial\Sample.xlsx")

        '~~> Display Excel
        xlApp.Visible = True

        '~~> Do some work

        '~~> Save the file
        xlWorkBook.Save()

        '~~> Close the file
        xlWorkBook.Close()
    End Sub
End Class

To Save As

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1
    '~~> Define your Excel Objects
    Dim xlApp As New Excel.Application
    Dim xlWorkBook As Excel.Workbook
    Dim xlWorkSheet As Excel.Worksheet

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim MyPassword As String = "Password"

        '~~> Opens Source Workbook. Change path and filename as applicable
        xlWorkBook = xlApp.Workbooks.Open("C:\Tutorial\Sample.xlsx")

        '~~> Display Excel
        xlApp.Visible = True

        '~~> Do some work

        '~~> Save As file
        xlWorkBook.SaveAs(Filename:="C:\SampleNew.xlsx", _
                          FileFormat:=Excel.XlFileFormat.xlOpenXMLWorkbook, _
                          Password:=MyPassword, _
                          WriteResPassword:=MyPassword, _
                          ReadOnlyRecommended:=True, CreateBackup:=False)

        '~~> Close the file
        xlWorkBook.Close()
    End Sub
End Class

These are the file formats in Excel 2007/2010:
50 = xlExcel12 (Excel Binary Workbook in 2007-2010 with or without macro’s, xlsb)
51 = xlOpenXMLWorkbook (without macro’s in 2007-2010, xlsx)
52 = xlOpenXMLWorkbookMacroEnabled (with or without macro’s in 2007-2010, xlsm)
56 = xlExcel8 (97-2003 format in Excel 2007-2010, xls)

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long

Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

Private Declare Function GetWindowTextLength Lib "user32" Alias _
"GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Dim Ret As Long, ChildRet As Long, OpenRet As Long
Dim strBuff As String, ButCap As String
Dim MyPassword As String

Const WM_SETTEXT = &HC
Const BM_CLICK = &HF5

Sub UnlockVBA()
Dim xlAp As Object, oWb As Object

Set xlAp = CreateObject("Excel.Application")

xlAp.Visible = True

'~~> Open the workbook in a separate instance
Set oWb = xlAp.Workbooks.Open("C:\Sample.xlsm")

'~~> Launch the VBA Project Password window
'~~> I am assuming that it is protected. If not then
'~~> put a check here.
xlAp.VBE.CommandBars(1).FindControl(ID:=2578, recursive:=True).Execute

'~~> Your passwword to open then VBA Project
MyPassword = "Blah Blah"

'~~> Get the handle of the "VBAProject Password" Window
Ret = FindWindow(vbNullString, "VBAProject Password")

If Ret 0 Then
'MsgBox "VBAProject Password Window Found"

'~~> Get the handle of the TextBox Window where we need to type the password
ChildRet = FindWindowEx(Ret, ByVal 0&, "Edit", vbNullString)

If ChildRet 0 Then
'MsgBox "TextBox's Window Found"
'~~> This is where we send the password to the Text Window
SendMess MyPassword, ChildRet

DoEvents

'~~> Get the handle of the Button's "Window"
ChildRet = FindWindowEx(Ret, ByVal 0&, "Button", vbNullString)

'~~> Check if we found it or not
If ChildRet 0 Then
'MsgBox "Button's Window Found"

'~~> Get the caption of the child window
strBuff = String(GetWindowTextLength(ChildRet) + 1, Chr$(0))
GetWindowText ChildRet, strBuff, Len(strBuff)
ButCap = strBuff

'~~> Loop through all child windows
Do While ChildRet 0
'~~> Check if the caption has the word "OK"
If InStr(1, ButCap, "OK") Then
'~~> If this is the button we are looking for then exit
OpenRet = ChildRet
Exit Do
End If

'~~> Get the handle of the next child window
ChildRet = FindWindowEx(Ret, ChildRet, "Button", vbNullString)
'~~> Get the caption of the child window
strBuff = String(GetWindowTextLength(ChildRet) + 1, Chr$(0))
GetWindowText ChildRet, strBuff, Len(strBuff)
ButCap = strBuff
Loop

'~~> Check if we found it or not
If OpenRet 0 Then
'~~> Click the OK Button
SendMessage ChildRet, BM_CLICK, 0, vbNullString
Else
MsgBox "The Handle of OK Button was not found"
End If
Else
MsgBox "Button's Window Not Found"
End If
Else
MsgBox "The Edit Box was not found"
End If
Else
MsgBox "VBAProject Password Window was not Found"
End If
End Sub

Sub SendMess(Message As String, hwnd As Long)
Call SendMessage(hwnd, WM_SETTEXT, False, ByVal Message)
End Sub
[/sourcecode]