Microsoft KB Archive/195850

= How To Determine the Windows Messaging Subsystem Default =

Article ID: 195850

Article Last Modified on 3/7/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q195850



SUMMARY
Occasionally, when you are working on MAPI-enabled FoxPro applications you might need to determine what the default Windows Messaging profile is on a target computer. This article demonstrates how to accomplish this using the Windows API.



Step-by-Step Procedures
  In Visual FoxPro, open a new program window by typing the following in the Command window: MODIFY COMMAND   Copy the following code into a program file: #DEFINE HKey_CURRENT_USER 2147483649 DECLARE INTEGER RegCloseKey IN Win32API ; INTEGER nHKey DECLARE INTEGER RegOpenKey IN Win32API ; INTEGER nHKey, STRING @cSubKey, INTEGER @nResult DECLARE RegEnumValue IN ADVAPI32 INTEGER nKeyHandle, INTEGER iValue, ; STRING @cValueName, INTEGER @iValueLen, INTEGER, STRING @cTypeCode, ; STRING @cDataValue, INTEGER @iDataLen

nSubKey = 0 nErrCode = 0 nKeyHandle = 0 iValue = 0 cValueName = SPACE(255) iValueLen = 255 cTypeCode = SPACE(255) cDataValue = SPACE(255) iDataLen = 255

*!* Determine what operating system you are on: Windows NT or  *!* Windows 9x. IF "NT" $ OS(1) ckey = "Software\Microsoft\Windows NT\CurrentVersion\" + ; "Windows Messaging Subsystem\Profiles" ELSE ckey = "Software\Microsoft\Windows Messaging Subsystem\Profiles" ENDIF

nErrCode = RegOpenKey(HKey_CURRENT_USER,ckey,@nKeyHandle) *!* If nErrCode <> 0, Windows messaging is probably not installed. IF nErrCode # 0 WAIT WINDOW "Windows Messaging Key Not Present" RETURN nErrCode ENDIF

RegEnumValue(nKeyHandle,0,@cValueName,@iValueLen,0,;     @cTypeCode, @cDataValue, @iDataLen) *!* If cDataValue is blank, no profiles have been set up. IF EMPTY(cDataValue) WAIT WINDOW "No Windows Messaging Profiles Set" RETURN ELSE ? LEFT(cDataValue, iDataLen-1) ENDIF RegCloseKey(nKeyHandle)  Save and run this program. RESULT: You should see text echoed in the main FoxPro window. This is the default Windows Message profile for this computer.

Keywords: kbhowto KB195850

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.