Allen OCX

Version (14 April 2010)

Download (11.7 KB)

ColConv (Colour Convert)

Returns an integer depending on what colour you specify.  Colours: Black, Maroon, Green, Olive, Navy, Purple, Teal, Grey, Silver, Red, Lime, Yellow, Blue, Fuchsia, Aqua, White.  E.g.:

Text1.BackColor = Allen.ColConv("Red") 'returns 255

DExists (Drive Exists)

Returns an integer depending on the state of a drive.
If the return value is:
0 - the drive that was specified does not exist.
1 - the drive exists but has no media inserted.
2 - the drive exists and contains media.

MsgBox Allen.DExists("c") 'returns 2 (if your hard drive is C:)

DirExists (Directory Exists)

Returns a boolean value depending on whether the folder specified exists.  E.g.:

MsgBox Allen.DirExists("c:\windows") 'returns true if this folder exists

FExists (File Exists)

Returns a boolean value depending on whether the file specified exists.  E.g.:

MsgBox Allen.FExists("c:\windows\desktop.ini") 'returns true if this file exists

FileAccessed/FileCreated/FileModified/FolderCreated (File Accessed/File Created/File Modified/Folder Created)

Returns a value in this format 21/10/99 - the date the file or folder specified was accessed, created or modified.  E.g.:

MsgBox Allen.FileAccessed("c:\windows\desktop.ini")
MsgBox Allen.FileCreated("c:\windows\desktop.ini")
MsgBox Allen.FileModified("c:\windows\desktop.ini")
MsgBox Allen.FolderCreated("c:\windows")

GetBigIcon/GetSmallIcon (Get Big Icon/Get Small Icon)

Returns a value for the picture property of any control that supports images. ImageLists can also have images inserted with these functions.  The argument to this function can either be a file, folder or drive.  E.g.:

Image1.Picture = Allen.GetBigIcon("c:\windows\desktop.ini")
Form1.Icon = Allen.GetSmallIcon("c:\")

HTML2PT (HTML to Plain text)

Converts basic HTML code to plain text, including special characters e.g. '&lt;' to '<' and tags e.g. '<br>' to a line break

MsgBox Allen.HTML2PT("Marks &amp; Spencer") 'returns "Marks & Spencer"


Returns details about me. This OCX was intended for my personal use and I did not want to recompile it after I had used it in so many of my programs which would also have to be recompiled.  E.g.:

MsgBox Allen.Martin("SName") 'my surname - returns "Allen"
MsgBox Allen.Martin("MName") 'my middle name - returns "Anthony"
MsgBox Allen.Martin("DOB") 'my date of birth - returns "06/09/1982"

PT2HTML (Plain text to HTML)

Add HTML tags and codes to plain text so that it is ready for use in an HTML document.  E.g.:

MsgBox Allen.PT2HTML("Marks & Spencer", False) 'returns "Marks &amp; Spencer".  If the second argument is set to True, line breaks will be converted to '<br>' tags, which isn't applicable in this example

RemoveINIKey (Remove INI Key)

Deletes the INI key specified. This cannot be done with Kupex INI Tools so I wrote a function that could do it.  Syntax - Section, Key, INIFilename.  E.g.:

MsgBox Allen.RemoveINIKey("Desktop", "Wallpaper", "win.ini") 'do not run this - your wallpaper may disappear, it is just an example.


Runs a program and does not return until that program has finished.  E.g.:

ShellAndWait Me, "notepad"

ShortFile/ShortFileLocation/ShortFolder/ShortPath (Short File/Short File Location/Short Folder/Short Path)

Returns strings of file/folder locations in the 8.3 file name format.  E.g.:

MsgBox Allen.ShortFile("c:\program files\desktop.ini") 'returns "DESKTOP.INI"
MsgBox Allen.ShortFileLocation("c:\program files\desktop.ini") 'returns "C:\PROGRA~1"
MsgBox Allen.ShortFolder("c:\program files\internet explorer") 'returns "C:\PROGRA~1\INTERN~1"
MsgBox Allen.ShortPath("c:\program files\internet explorer\iexplore.exe") 'returns "C:\PROGRA~1\INTERN~1\IEXPLORE.EXE"


Adds functionality to forms. If the boolean argument is True then the form will be 'always on top'.  E.g.:

MsgBox Allen.TopMost(Form1, True) 'the form will now be on top of other windows.

Martin Allen 1999, 2002, 2007, 2010