LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I launch the default e-mail client?

I need my CVI 7.1 WinXP application to pop up a blank, pre-addressed e-mail. 'Kinda like a "mailto:name@domain.com" link would work in a browser. I've tried everything I can think of to do this using shell and system commands. I do not want to assume any particular e-mail client or browser on the client machine. But I will assume a Windows OS. Anyone have any tricks to do this?
0 Kudos
Message 1 of 14
(5,927 Views)
I thought you could use ShellExecute for something like this... (IE):

ShellExecute( NULL, NULL, "mailto:person@company.com", NULL, NULL, 0);
And of course be sure and include the right headers and link to shell32.lib
Message 2 of 14
(5,913 Views)
Call me crazy, but do I need the SDK to call that function? I don't currently have that function in my library.
0 Kudos
Message 3 of 14
(5,901 Views)
Naa, your not crazy. Thats an API function alright. Its in Shell32.dll so your going to need to
link in the Shell32.llb and header file for this to work IMO.
0 Kudos
Message 4 of 14
(5,903 Views)
As Chaos says, ShellExecute is part of the SDK.
From the project window, go to Edit > Add Files to Project >> Library (*.Lib) and browse to ...\CVI\SDK\lib\Shell32.lib.
Add these two includes to the top of your list in the .c file.
Note: delete the space after < (I added the space to fool the forum's HTML error detection).
#include < windows.h>
#include < shellapi.h>

//....
// where ever you want to mail:
ShellExecute( NULL, NULL, "mailto:someuser@somewhere.com", NULL, NULL, 0);
Message 5 of 14
(5,891 Views)
Sounds like an easy plan, but shell32.lib doesn't exist on my machine. Of course shell32.dll does. I've searched high and low for this LIB but can't locate it. Should it have installed with CVI? Google didn't even turn anything up.
0 Kudos
Message 6 of 14
(5,889 Views)
When you install CVI, you have the option of installing SDK. It sounds like you need to rerun the CVI install program and select the SDK.
Message 7 of 14
(5,882 Views)
And you need to have CVI Full Development version to have the option to install the Windows SDK.
Bilal Durrani
NI
Message 8 of 14
(5,861 Views)
I have Pro and I was able to get it all working by installing the SDK. Interesting note is that even if you don't have the SDK you get the file structure with the non-SDK install. This threw me off at first. But a full SDK install did the trick. Thanks for the help.
0 Kudos
Message 9 of 14
(5,862 Views)
I used the following ...

ShellExecute( NULL, NULL, "mailto:someuser@somewhere.com?subject=hello&body=some text", NULL, NULL, 0);

to open up email application and create a new message

But having generated the message, how can CVI cause this new message to be sent?
0 Kudos
Message 10 of 14
(5,447 Views)