Solved

open a software from the my application

Posted on 2004-08-28
8
197 Views
Last Modified: 2013-11-20
Is there a way to open another software that is installed into my pocket pc, not by clicking on the software itself, but through my codes?
0
Comment
Question by:mwcmp
  • 4
  • 3
8 Comments
 
LVL 5

Expert Comment

by:Nass89
ID: 11925002
Hi,

CreateProcess(
LPCWSTR lpszImageName,
LPCWSTR lpszCmdLine,
LPSECURITY_ATTRIBUTES lpsaProcess,
LPSECURITY_ATTRIBUTES lpsaThread,
BOOL fInheritHandles,
DWORD fdwCreate,
LPVOID lpvEnvironment,
LPWSTR lpszCurDir,
LPSTARTUPINFOW lpsiStartInfo,
LPPROCESS_INFORMATION lppiProcInfo);

It runs under Windows ce.

Example:

STARTUPINFO si = { sizeof(STARTUPINFO) };
PROCESS_INFORMATION pi = {0};
BOOL bSuccess;

bSuccess = CreateProcess ( NULL, "C:\\Program Files\\Internet xplorer\\IEXPLORE.exe ", NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS,
NULL, NULL, &si, &pi );
//TerminateProcess to close the application

if(bSuccess){
TerminateProcess(pi.hProcess ,1);
CloseHandle ( pi.hThread );
CloseHandle ( pi.hProcess );

Good Luck!
0
 

Author Comment

by:mwcmp
ID: 11925322
>>NORMAL_PRIORITY_CLASS
Can't seems to be suppported, so I change it to 0

The other application is unable to be open. I also realised that whne my applicationn runs, it failed to enter the if(bSuccess) loop.
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 11925943
You can use ShellExecuteEx:

            SHELLEXECUTEINFO info;
            info.cbSize = sizeof(info);
            info.dwHotKey = 0;
            info.fMask = SEE_MASK_NOCLOSEPROCESS;
            info.hIcon = 0;
            info.hkeyClass = 0;
            info.hwnd = 0;
            info.lpClass = NULL;
            info.lpDirectory = "\adirectory";    <------- give correct directory here
            info.lpFile = "app.exe";     <------- give correct application name or doc's filename here
            info.lpIDList = NULL;
            info.lpParameters = NULL;
            info.lpVerb = TEXT("open");
            info.nShow = SW_SHOW;
            ShellExecuteEx(&info);
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:mwcmp
ID: 11926082
info.lpDirectory = _T("\\Program Files\\Veo Travler\\Veo\\");    
info.lpFile = _T("VeoTravler.exe");  

Where did I go wrong?
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11926101
try to remove the last \\ fro directory
0
 

Author Comment

by:mwcmp
ID: 11926142
Yes. Tried.

I suppose the directory goes that way? Or did I miss anything else at the beginning?
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 500 total points
ID: 11926218
Make a test with this variant:
info.lpFile = TEXT("\\Windows\\PWord.exe");
info.lpDirectory = NULL;
0
 

Author Comment

by:mwcmp
ID: 11926315
Thanks. It works. :)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 84
matchUp  challenge 6 65
Detect file exist or not 3 160
JQuery serialize and unserialize 8 94
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

831 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