Microsoft KB Archive/173552: Difference between revisions

From BetaArchive Wiki
m (Text replacement - """ to """)
m (Text replacement - "&" to "&")
 
(One intermediate revision by the same user not shown)
Line 67: Line 67:


         'Run the Mail Control Panel
         'Run the Mail Control Panel
         vRetval = Shell(strSysDirPath & "\control.exe mlcfg32.cpl", 1)
         vRetval = Shell(strSysDirPath & "\control.exe mlcfg32.cpl", 1)


         'Do the rest of your work here. Note: Most developers will
         'Do the rest of your work here. Note: Most developers will
Line 77: Line 77:
                     </pre></li>
                     </pre></li>
<li><p>Place the following declaration into a new Module:</p>
<li><p>Place the following declaration into a new Module:</p>
<pre class="codesample">      Declare Function GetSystemDirectory&amp;amp; Lib "kernel32" _
<pre class="codesample">      Declare Function GetSystemDirectory& Lib "kernel32" _
         Alias "GetSystemDirectoryA" (ByVal P$, ByVal S%)</pre></li></ol>
         Alias "GetSystemDirectoryA" (ByVal P$, ByVal S%)</pre></li></ol>



Latest revision as of 13:54, 21 July 2020

Knowledge Base


HOWTO: Using Visual Basic to Access the Mail Control Panel GUI

Article ID: 173552

Article Last Modified on 6/28/2004



APPLIES TO

  • Microsoft Visual Basic 4.0 Standard Edition
  • Microsoft Visual Basic 4.0 Enterprise Edition



This article was previously published under Q173552

SUMMARY

For the sake of consistency, many developers like to provide the same configuration interfaces to their users as are provided in the Control Panel. These Control Panels are available for developers to call from their applications.

For Messaging related applications, the pertinent Control Panel applet is Mlcfg32.cpl. This article describes how to call this Control Panel applet from a Visual Basic Application.

MORE INFORMATION

  1. Place the following code sample into a new Visual Basic Form:

          Dim strSysDirPath As String
          Dim vRetval As Double
    
          Private Sub Form_Load()
             'Setup the string to receive the name of the system directory
             strSysDirPath = String$(145, Chr$(0))
             strSysDirPath = Left$(strSysDirPath, _
                             GetSystemDirectory(strSysDirPath, _
                             Len(strSysDirPath)))
    
             'Run the Mail Control Panel
             vRetval = Shell(strSysDirPath & "\control.exe mlcfg32.cpl", 1)
    
             'Do the rest of your work here. Note: Most developers will
             'likely want to pause their application here until returning from
             'the Control Panel
             MsgBox vRetval
    
          End Sub
                        
  2. Place the following declaration into a new Module:

          Declare Function GetSystemDirectory& Lib "kernel32" _
            Alias "GetSystemDirectoryA" (ByVal P$, ByVal S%)


Keywords: kbhowto kbcode KB173552