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.dll" Alias "RegQueryValueExA" ( _
ByVal hKey As Long, _
ByVal lpValueName As String, _
ByVal lpReserved As Long, _
lpType As Long, _
lpData As Any, _
lpcbData As Long _
) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" ( _
ByVal hKey As Long _
) As Long
Private Const REG_SZ = 1
Private Const ERROR_SUCCESS = 0&
Private Const HKEY_CLASSES_ROOT = &H80000000
Public Function GetDefaultMailClient() As String
Dim lngResult As Long
Dim lngKeyHandle As Long
Dim lngValueType As Long
Dim lngBufferSize As Long
Dim strBuffer As String
lngResult = RegOpenKey(HKEY_CLASSES_ROOT, "mailto\shell\open\command", lngKeyHandle)
lngResult = RegQueryValueEx(lngKeyHandle, "", 0, lngValueType, ByVal 0, lngBufferSize)
If lngValueType = REG_SZ Then
strBuffer = String(lngBufferSize, " ")
lngResult = RegQueryValueEx(lngKeyHandle, "", 0, 0, ByVal strBuffer, lngBufferSize)
If lngResult = ERROR_SUCCESS Then
If (InStr(strBuffer, Chr$(0))) > 0 Then
GetDefaultMailClient = Left(strBuffer, (InStr(strBuffer, Chr$(0))) - 1)
Else
GetDefaultMailClient = strBuffer
End If
End If
End If
End Function
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.
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.
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).
Yesterday the news hit of a new vulnerability that threatens the security of all code; dubbed Trojan Source by the researchers from the University of Cambridge. From an initial analysis, it does seem to impact just about everything, and the status of fixes is very hit or miss at this point. But the real question is, does this even matter? Is this issue worth spending your time on? Let’s look closer.
Researchers are still working to understand the impact of the Juniper incident – the details of how the VPN traffic decryption backdoor are still not fully understood. That such devastating backdoors could make it in to such a security-critical product, and remain for years undetected has shocked many (and pushed many others deeper into their cynicism).
There are though, some questions that are far more important in the long run: