473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Trying to launch e-mail client Outlook with arguments

365 100+
when I try from command prompt "Outlook.exe /a test1.jpg" (I copied test1.jpg file into same folder where outlook.exe exists, outlook client opens with test1.jpg as attachment with new email, if I try samething with CreateProcess in C++, it is not working, any wrong with my command below.

Expand|Select|Wrap|Line Numbers
  1.                 if (!CreateProcess(L"C:\\Program Files\\Microsoft Office\\Office14\\OUTLOOK.EXE", 
  2.                             L"/a \"test1.jpg\"", 
  3.                             NULL,
  4.                             NULL,
  5.                             FALSE,
  6.                             0,
  7.                             NULL,
  8.                             NULL,
  9.                             &si,
  10.                             &pi))
  11.                 {
  12.                         return false;
  13.                 }
  14.  
  15.  
  16.  
Mar 8 '13 #1
5 2414
weaknessforcats
9,208 Expert Mod 8TB
Check your arguments.

The first argument is a LPCTSTR. This is long pointer to a constant TCHAR string. You have supplied a string of wide characters. Generally, you neeed to make these Unicode strings using MultiByteToWideChar.

Similarly, the second argument is a LPTSTR which is a long pointer to a TCHAR string. You have supplied a string of wide characters and it looks like you have some undoubled \. Again, MultiByteToWideChar needs to called to make this string.

The last arguments are long pointers to a STARTUPINFO and a PPROCESS_INFORMATION struct. Your posted code doesn't show if these are valid or not.

You may need to read up on TCHAR. But I don't know your runtime requirements. If they are Unicode, then you need to create all of your Unicode strings correctly and there can be no literals in your code.

BTW I have found no examples to let you start Outlook from C or C++. There are several in C# and they are no simple.

Let me know what happens.
Mar 8 '13 #2
tvnaidu
365 100+
This is running on Windows XP and Win 7 environment, I like to run "Outlook.exe" with arguments, basically I am launching Outlook email client, when it launches I need jpg file as attachment. The other Two declared as:

STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
Mar 9 '13 #3
weaknessforcats
9,208 Expert Mod 8TB
OK. But what is your project environment? char or Unicode or both? This setting is in your project properties.

CreateProcess is either a call to CreateProcessA or CreateProcessW based on the run time envionment. This is where TCHAR comes in.



if char, a string like L"stuff" is not a char string. In a char environment CreateProcessA can't use it.
if Unicode, a string like L"stuff" is not a Unicode string. CreateProcessW can use this only if language is English.

I woud be using TCHAR or I would be calling CreateProcessW.

You should read this http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
and pay close attention to the community input.
Mar 10 '13 #4
tvnaidu
365 100+
I did look into Project Prop, it says "Use Unicode character set". when I keep cursor on CreateProcess , it says "CreateProcessW".
Mar 10 '13 #5
tvnaidu
365 100+
actually I gave file name test1.jpg as testing purpose since by command line I am able to attach jpg file when I launch outlook email client, but I have actual Image is loaded on Clipboard inside my program, I like to attach that Clipboard Image as attachment when I launch OUTLOOK.exe, Is there any Windows API where I can store clipboard Image as file and attach that file to outlook on the background without any input from user.
Mar 10 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Leonid Finis | last post by:
Hi, I’m trying to launch application after it was installed. I created a Windows App Deployment project. I added to “End” phase of “User Interfaces” editor a custom dialog box with...
3
by: Vicky | last post by:
Hi, I was wondering if anyone can help me. Im working with Visual C++ 1.52, (16-bit). Trying to launch a site from the code. I've tried using WinExec and ShellExecute, but with no luck. Both...
1
by: Moshe Bergman | last post by:
I am trying to launch Flight Simulator 2004, and have it connect to localhost, I can do this in C++ but not on C#... Here is my code: ConnectInformation info = new ConnectInformation();...
13
by: David Rose | last post by:
Hi, I am trying to launch pdf files (in this case). The test application takes the path to the pdf from a TextBox when the user clicks a button. I have written code that works on my computer,...
5
by: GrantS | last post by:
Hi I am trying to use ShellExecute to launch an application to display a certain file. The variation on the theme is that I need to be able to specify the application to launch and not simply...
5
by: jmsxp | last post by:
Hi all, I am in my infancy with programming, so please forgive stupid questions... I am attempting to write a C# program that will launch Trillian (well, that is just a part of the overall...
2
by: JDeats | last post by:
When a user double clicks on file item in Windows Explorer, Windows tries to open the document with whatever application is related to it's file extension. In my WinForms application I would...
0
by: klh | last post by:
Does anyone know how to prevent the First Steps Launch Pad screen from appearing after pushing out a remote installation of a Fix Pack? When DB2 PE is initially installed on our desktops it is...
0
by: Vajrala Narendra | last post by:
Hi all, TO my .net setup project i want to add a launch condition for crystal report installation. In my prerequisities i selected Crystal reports fro basic visual studio 2008 (x64, x86) in my...
0
by: jbfarley | last post by:
I am having problems with a shockwave .EXE that leaks memory like the dickens. At launch, it loops a welcome screen until a user touches the screen/clicks the mouse, and then it plays all the way...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.