Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

using the default email program

Posted on 1998-12-15
Last Modified: 2010-05-03
I'm writing a address book type program for my office in Visual Basic and I put a button on it that launches the default email client (through an API call) and sends an email if an email address exists for that person. We use Groupwise for our email system but, on most of the computers here, when I click that email button, Windows wants to load Outlook (which we don't use).  Does anyone have a  uggestion as to how I make Groupwise the default email program instead of Outlook?


Question by:djross
  • 3
  • 3

Expert Comment

ID: 1450337
What control do you use? do you use MAPI?

Author Comment

ID: 1450338
I'm not sure, I got the code from a friend:

In the General Declarations section,

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal     lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

and, where sEmail is a string containing the email address,

Call ShellExecute(hwnd, "Open", sURL, "", App.Path, 1)

Expert Comment

ID: 1450339
is that the code in the email button?
do the program try to start outlook when it try to send the mail? or when you try to load the email program?
what do you use to handle email sending ? (with smtp etc...)

if the problem is about loading the groupewise program, i suggest you try to find a key in the registry who refert to it.. then your program could go read it and would know the path of the program... so you could luach it wherever it is installed.

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Author Comment

ID: 1450340
Yes, the second section of code is in the email button.  

When I click the 'send email' button in my program, the GroupWise program is launched and a new email is created with the TO field already filled out.  But, on other computers, when the 'send email' button is pressed, Microsoft Outlook begins to load and then gives an error stating that it couldn't create the new mail and Outlook closes.  

I went through the registry on my computer (which launches GroupWise correctly when that button is pressed) and found a few places that referred to the grpwise.exe file (GroupWise).  I would rather not go into everyone's registry and change that since there has to be a way to do it otherwise (because I didn't have to set up mine that way).  There isn't an option in GroupWise to check whether it is the default email program or not (like Netscape, IE check if they are the default browser).  


Accepted Solution

myqlG earned 50 total points
ID: 1450341
The above answer is correct.. shellexecute is the way.
go here to d/l a sample to understand it better:

Author Comment

ID: 1450342
Well, that page does help me understand what the API call does exactly, it still leaves me with my problem of Outlook trying to load as the default email program instead of GroupWise.

Expert Comment

ID: 1450343
sorry i don't know if there is something like netscape, but with the registry (you don't change anything just read it) you are sure some keys will always be at the same place (ie: in the uninstalled information section) you always find the path and such info. i did that for one of my program to find where an other program was installed and it worked fine...

well.. this is just a suggestion...

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question