uh.. Docmd.SendObject should launch the default mail client, right?
On Oct 14, 2:26*pm, at <"paul(at)kpnmail.nl"> wrote:
> * Hello,
>
> One of my Access applications is used by many users, with all kind of
> systems and Windows versions. In this application, I have a function to
> determine to standard mail client:
>
> StrMailClient = fReturnRegKeyValue(HKEY_LOCAL_MACHINE,
> "Software\clients\mail", "")
>
> Function fReturnRegKeyValue(ByVal lngKeyToGet As Long, ByVal strKeyName
> As String, ByVal strValueName As String) as String
> * * *'This code was originally written by Terry Kreft and Dev Ashish.
> * * *Dim lnghKey As Long
> * * *Dim strClassName As String
> * * *Dim lngClassLen As Long
> * * *Dim lngReserved As Long
> * * *Dim lngSubKeys As Long
> * * *Dim lngMaxSubKeyLen As Long
> * * *Dim lngMaxClassLen As Long
> * * *Dim lngValues As Long
> * * *Dim lngMaxValueNameLen As Long
> * * *Dim lngMaxValueLen As Long
> * * *Dim lngSecurity As Long
> * * *Dim ftLastWrite As FILETIME
> * * *Dim lngtype As Long
> * * *Dim lngData As Long
> * * *Dim lngTmp As Long
> * * *Dim strRet As String
> * * *Dim varRet As Variant
> * * *Dim lngRet As Long
>
> * * *On Error GoTo fReturnRegKeyValue_Err
>
> * * *'Open the key first
> * * *lngTmp = apiRegOpenKeyEx(lngKeyToGet, strKeyName, 0&, KEY_READ,
> lnghKey)
>
> * * *'Are we ok?
> * * *If Not (lngTmp = ERROR_SUCCESS) Then Err.Raise lngTmp + vbObjectError
>
> * * *lngReserved = 0&
> * * *strClassName = String$(MAXLEN, 0): *lngClassLen = MAXLEN
>
> * * *'Get boundary values
> * * *lngTmp = apiRegQueryInfoKey(lnghKey, strClassName, _
> * * * * *lngClassLen, lngReserved, lngSubKeys, lngMaxSubKeyLen,_
> * * * * *lngMaxClassLen, lngValues, lngMaxValueNameLen, _
> * * * * *lngMaxValueLen, lngSecurity, ftLastWrite)
>
> * * *'How we doin?
> * * *If Not (lngTmp = ERROR_SUCCESS) Then Err.Raise lngTmp + vbObjectError
>
> * * *'Now grab the value for the key
> * * *strRet = String$(MAXLEN - 1, 0)
> * * *lngTmp = apiRegQueryValueEx(lnghKey, strValueName, lngReserved,
> lngtype, ByVal strRet, lngData)
> * * *Select Case lngtype
> * * * *Case REG_SZ
> * * * * *lngTmp = apiRegQueryValueEx(lnghKey, strValueName, lngReserved,
> lngtype, ByVal strRet, lngData)
> * * * * *varRet = Left(strRet, lngData - 1)
> * * * *Case REG_DWORD
> * * * * *lngTmp = apiRegQueryValueEx(lnghKey, strValueName, lngReserved,
> lngtype, lngRet, lngData)
> * * * * *varRet = lngRet
> * * * *Case REG_BINARY
> * * * * *lngTmp = apiRegQueryValueEx(lnghKey, strValueName, lngReserved,
> lngtype, ByVal strRet, lngData)
> * * * * *varRet = Left(strRet, lngData)
> * * * *Case REG_EXPAND_SZ
> * * * * *lngTmp = apiRegQueryValueEx(lnghKey, strValueName, lngReserved,
> lngtype, ByVal strRet, lngData)
> * * * * *varRet = Left(strRet, lngData - 1)
> * * *End Select
>
> * * *'All quiet on the western front?
> * * *If Not (lngTmp = ERROR_SUCCESS) Then Err.Raise lngTmp + vbObjectError
>
> fReturnRegKeyValue_Exit:
> * * *fReturnRegKeyValue = varRet
> * * *lngTmp = apiRegCloseKey(lnghKey)
> * * *Exit Function
> fReturnRegKeyValue_Err:
> * * *varRet = "Error: Key or Value Not Found."
> * * *Resume fReturnRegKeyValue_Exit
> End Function
> (for reasons for readability, I omitted the declaration of constants and
> some aditional functions)
>
> When this function is used on a computer with *Windows XP*, the result
> is OK.
> However, when I use this same function on a computer with *Windows Vista
> *or* Windows 7*, the result is not OK. I figured out that the outcome is
> not the value of the key above, but from another key:
> "hkey_local_machine\software\wow6432node\clients\mail".
>
> I already tried to adapt the function: StrMailClient =
> fReturnRegKeyValue(HKEY_CURRENT_USER, "Software\clients\mail\", "")
> This works fine for Windows Vista and Windows 7, but with Windows XP it
> does not work (key does not exist).
>
> So my question is: is there any way, function or registry key which
> gives the right default mail client, regardless the Windows version? Or
> is there any decent possibility to determine the current Windows
> version, which can be used to use either registry retrieval function?
> I must say that my knowledge of registry and 32/64 bit topics is very
> limited.
>
> Thanks for any suggestions,
>
> Paul