Adam Caudill

Security Leader, Researcher, Developer, Writer, & Photographer

  • Get Default Mail Client

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. This is another code example made by request for a forum member, it simply retrieves the default value from HKEY_CLASSES_ROOT\mailto\shell\open\command which should be the default mail client. Option Explicit Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" ( _ ByVal hKey As Long, _ ByVal lpSubKey As String, _ phkResult As Long _ ) As Long Private Declare Function RegQueryValueEx Lib "advapi32.

    Read more…

  • Simple String Hashing

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. This is a very basic form of hashing algorithm, mainly created to use as an example, and it shouldn’t be considered secure, while it should be virtually impossible to reverse, if you are looking for a truly secure hashing algorithm for production use, look at using a SHA family hash, as they have been exhaustively tested and proven to work.

    Read more…

  • APISettings

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. Visual Basic provides a less than elegant method of saving data in the Windows registry, the GetSetting & SaveSetting functions. These functions store setting in HKEY_CURRENT_USER\Software\VB and VBA Program Settings\<AppName>\<Section> not very pretty is it? The APISettings module is a drop-in replacement using pure Win32 API for its processing power and increased stability. The reason for developing this and for making it drop-in compatible is to all those new to the Win32 API to add its functionality with minimal difficulty.

    Read more…

  • Conexant (formerly Rockwell) Softmodem HSF Modem

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. I was actually rather lucky to have this brand of WinModem, as the good people over at Linuxant.com offer a very high quality driver that makes installation a breeze! But, they have recently changed their marketing methods and charge $15 for the driver, so these really lives no viable, free alternative (a rarity to say the least for linux).

    Read more…

  • IsOnline

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. This is a simple function that checks to see if you’re online… API: Private Declare Function InternetGetConnectedStateEx Lib "wininet.dll" Alias "InternetGetConnectedStateExA" ( _ lpdwFlags As Long, _ lpszConnectionName As Long, _ dwNameLen As Long, _ ByVal dwReserved As Long) As Long Function: Public Function IsOnline() As Boolean Dim lNameLen As Long Dim lRetVal As Long Dim lConnectionFlags As Long Dim LPTR As Long Dim lNameLenPtr As Long Dim sConnectionName As String sConnectionName = Space$(256) lNameLen = 256 LPTR = StrPtr(sConnectionName) lNameLenPtr = VarPtr(lNameLen) lRetVal = InternetGetConnectedStateEx(lConnectionFlags, ByVal LPTR, ByVal lNameLen, 0& ) IsOnline = (lRetVal <> 0) End Function Returns true if you’re online, otherwise returns false.

    Read more…

  • PageSource

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. Here is a quick little function to retrieve the source code of a web page, it’s pure API, so no Internet Transfer control required. API: Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" ( _ ByVal sAgent As String, _ ByVal lAccessType As Long, _ ByVal sProxyName As String, _ ByVal sProxyBypass As String, _ ByVal lFlags As Long) As Long Private Declare Function InternetOpenUrl Lib "wininet.

    Read more…

  • SetFocusByCaption

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. This is a simple function really, it just sets the focus to a window based on its caption. API: Private Declare Function SetForegroundWindow Lib "user32" ( _ ByVal hwnd As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _ ByVal lpClassName As Any, _ ByVal lpWindowName As Any) As Long Function: Public Function SetFocusByCaption(strCaption As String) As Boolean Dim lngHandle As Long Dim lngResult As Long lngHandle = FindWindow(vbNullString, strCaption) If lngHandle <> 0 Then lngResult = SetForegroundWindow(lngHandle) If lngResult = 0 Then SetFocusByCaption = False Else SetFocusByCaption = True End If Else SetFocusByCaption = False End If End Function Returns True/False based on success.

    Read more…

  • Register ActiveX & TypeLibs

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. This is just a simple registry modification, just paste this into Notepad (or any plain text editor), save it as register.reg (or anything else so long as it has the .reg extension) then just double-click and you’re done! REGEDIT4 [HKEY_CLASSES_ROOT\.dll] @="dllfile" [HKEY_CLASSES_ROOT\dllfile\Shell] [HKEY_CLASSES_ROOT\dllfile\Shell\Register] [HKEY_CLASSES_ROOT\dllfile\Shell\Register\Command] @="\"REGSVR32.EXE\" \"%1\"" [HKEY_CLASSES_ROOT\dllfile\Shell\Unregister] [HKEY_CLASSES_ROOT\dllfile\Shell\Unregister\Command] @="\"REGSVR32.EXE\" /u \"%1\"" [HKEY_CLASSES_ROOT\.ocx] @="ocxfile" [HKEY_CLASSES_ROOT\ocxfile] [HKEY_CLASSES_ROOT\ocxfile\shell] [HKEY_CLASSES_ROOT\ocxfile\shell\Register] [HKEY_CLASSES_ROOT\ocxfile\shell\Register\Command] @="\"REGSVR32.

    Read more…

  • XP-Style Controls In Visual Basic 6

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. This is a quick and dirty overview of how to get those ever so coveted XP controls in your application. There is a lot of detail I’m leaving out, but you should get the point, if you want more detail a google search or two should give you plenty of info. Let’s get started…. First you need to make a manifest file, this is just a plain text file that tells Windows how to treat you program.

    Read more…

  • CloseApp

    This post was imported from an old blog archive, and predates the creation of AdamCaudill.com. This is a useful function to close a program based on a windows caption, this should work for any top-level window. Paste all this into a standard module, save it. Then call CloseApp("Notepad") or whatever the name of the window is, it’s nice & simple and should close the program instantly. This requires Windows 2000 plus, for older versions of Windows a different method is required, that isn’t covered here, seeing as Windows 2000 and better require special privileges to forcefully close a program.

    Read more…