Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Failed ShellExecute 1

Status
Not open for further replies.

vanleurth

Programmer
Sep 1, 2001
156
US
Hi everybody,

I'm trying to send an email using the default emailer. When I execute this instruction ...

lng = ShellExecute(hwnd, "open", stext, vbNullString, vbNullString, SW_SHOW)

I get a 2 as return value. I read in the forum that this is a file not found error. What should I do ?
Where is this library ?

Thanks,

V.
 
The question is what is the value of stext?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Woops,

Of course that is a vital variable. Thank you for your prompt response. I took this line from the FAQ section on how to email using the default emailer.
Here is the string ...

"mailto:vanleurth@yahoo.com;mendezfe@colorado.edu?CC=&BCC=&Subject=Test&Body=Body"

Thanks again,

V.
 
Oh, and the library is shell32.dll.

What I would do is try the following:
"mailto:vanleurth@yahoo.com" to eliminate all of the of parts of the string just and see if we can get that working. Also, is the value of SW_SHOW = 1?

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
CajunCenturion,

Thanks for your prompt response. I have tried your suggestions and still have the same result from the ShellExecute function, which is 2.

I tried ;
lng = ShellExecute(hwnd, "mailto:vanleurth@yahoo.com", stext, vbNullString, vbNullString, 1)

any ideas will help.
I have tried to browse the shell32.dll library and I get the following message;
"Can't add a reference to the specified file"

??

Thank for any other insights,
V.
 
Give this a try and see what happens:

lng = ShellExecute(hwnd, "open", "mailto:vanleurth@yahoo.com", vbNullString, vbNullString, 1)

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Thank you for trying but I still have the problem.
Result is still 2 and nothing happens. ??
I was thinking that perhaps this computer has been locked up by the network administrator so no shell functions can be launched automatically.
Any other ideas ? I'd like to try anything else,

Thanks,

V.
 
Next thing I would try is remove the parent window, and then I would add a working directory.

lng = ShellExecute(0, "open", "mailto:vanleurth@yahoo.com", vbNullString, "C:\", 1)


Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
I guess that should really ask, does the machine have a default email client setup?

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Hello Cajun,

How was your weekend?
I have tried your recommendation and still didn't work. So, I decided to try MAPI. The function ran and went through without any error messages but still no email.
So, I decided to try and send a recordset to myself and I got the following message ..
"Before attemping to send an email message from PhEA, resolve the problem identified in the previous message, or configure your computer to send and receive e-mail messages."

I assume this is why emails can't be sent programatically. It is very strange since I have been using outlook express to send emails.
??
V.
 
There appears to be something wrong with the email setup, and I'm not the best person to help solve those problems. You might try posting that error message in one of the e-mail such as forum605.

Good Luck
--------------
To get the most from your Tek-Tips experience, please read FAQ181-2886
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top