shellexecute

How to shell to another app and have it appear in a delphi form

心已入冬 提交于 2019-11-27 07:20:27
In Delphi I've used ShellExecute for years to launch (and optionally wait for) other applications. Now though, I need to have one of these applications appear in one of my Delphi app forms. I've tried the code below as a simple test to open notepad (which it does) and to display the result within PAnel1 on my form (which it doesnt). Can some kind person put me on the right track? Thanks var Rec : TShellExecuteInfo; wnd : HWnd; const AVerb = 'open'; AParams = ''; AFileName = 'Notepad.exe'; ADir = ''; begin FillChar(Rec, SizeOf(Rec), #0); Rec.cbSize := SizeOf(Rec); Rec.fMask := SEE_MASK

How to run application which requires admin rights from one that doesn't have them [closed]

廉价感情. 提交于 2019-11-27 06:55:00
I've been stuck on this for a few hours until I've finally managed to do it. There are already links which pointed me the right direction: Is it possible for the executable to ask for Administrator rights? (Windows 7) CreateProcess error=740, The requested operation requires elevation But I've thought that simple overview of the problem could help someone :). Real problem: (from Wikipedia: http://en.wikipedia.org/wiki/User_Account_Control ) An executable that is marked as "requireAdministrator" in its manifest cannot be started from a non-elevated process using CreateProcess(). Instead, ERROR

How to wait for ShellExecute to run?

老子叫甜甜 提交于 2019-11-27 05:43:05
问题 I have manages to use ShellExecute in VC++ in order to launch a document. Now I wish to run a command-line tool that receives some arguments, and to run in the background (as hidden, not minimized) and let it block my program flow, so that i'll be able to wait for it to finish. How to i alter the command-line of: ShellExecute(NULL,"open",FULL_PATH_TO_CMD_LINE_TOOL,ARGUMENTS,NULL,SW_HIDE); The problem is, I have tool that converts html to pdf, and I wish that once the tool finished, aka pdf is

Exec a shell command in Go

可紊 提交于 2019-11-27 04:15:19
问题 I'm looking to execute a shell command in Go and get the resulting output as a string in my program. I saw the Rosetta Code version: package main import "fmt" import "exec" func main() { cmd, err := exec.Run("/bin/ls", []string{"/bin/ls"}, []string{}, "", exec.DevNull, exec.PassThrough, exec.PassThrough) if (err != nil) { fmt.Println(err) return } cmd.Close() But this doesn't capture the actual standard out or err in a way that I can programatically access - those still print out to the

Programmatically selecting file in explorer

╄→尐↘猪︶ㄣ 提交于 2019-11-27 03:59:45
In my application I can programmatically open explorer and select a file using the following code: void BrowseToFile(LPCTSTR filename) { CString strArgs; strArgs = _T("/select,\""); strArgs += filename; strArgs += _T("\""); ShellExecute(0, _T("open"), _T("explorer.exe"), strArgs, 0, SW_NORMAL); } My problem is that if I call this function a second time with a different file, but in the same folder, the selection in explorer does not change to the new file, but remains on the previous file. For example, if I call my function with C:\path\to\file1.txt , a new explorer window will open and file1

OSX equivalent of ShellExecute?

不羁的心 提交于 2019-11-26 23:23:46
问题 I've got a C++ app that I'm porting from Win32 to OSX. I'd like to be able to launch arbitrary files as if the user opened them. This is easy on windows using ShellExecute. How do I accomplish the same thing on the Mac? Thanks! 回答1: You can call system(); in any C++ application. On OSX, you can use the open command to launch things as if they were clicked on. From the documentation for open: The open command opens a file (or a directory or URL), just as if you had double-clicked the file's

shell_exec() timeout management & exec()

这一生的挚爱 提交于 2019-11-26 23:11:28
问题 I'm running a third party script by using a wrapper class I've written which calls shell_exec() and pipes into a file I parse later using php code. I should mention that this is working, but I am trying to enhance the functionality, having encountered a use case I hadn't thought of. How is it best to manage timeout on shell_exec()? I was thinking of wrapping it in a try() catch() but I'm not sure how to best handle the time component. I've been reading a few questions on here relating to

Difference between Run() and ShellExecute()

空扰寡人 提交于 2019-11-26 18:38:22
问题 I want to execute something in a shell/terminal on Windows via AutoIt. And I know that there are two ways of doing it. For example: Run(@ComSpec & " /c " & $myCommand, "", @SW_HIDE) ;and ShellExecute($myCommand) I don't understand the difference; both functions will do what I want, but what's behind them? Which pros and cons do they have? 回答1: Run() is used to fire off executable files only. It requires the full path of the program. ShellExecute() also accepts content files like .txt, .htm

How to shell to another app and have it appear in a delphi form

假如想象 提交于 2019-11-26 17:39:00
问题 In Delphi I've used ShellExecute for years to launch (and optionally wait for) other applications. Now though, I need to have one of these applications appear in one of my Delphi app forms. I've tried the code below as a simple test to open notepad (which it does) and to display the result within PAnel1 on my form (which it doesnt). Can some kind person put me on the right track? Thanks var Rec : TShellExecuteInfo; wnd : HWnd; const AVerb = 'open'; AParams = ''; AFileName = 'Notepad.exe';

Getting output from a shell/dos app into a Delphi app

让人想犯罪 __ 提交于 2019-11-26 16:01:58
I have a commandline application coded in delphi that I need to call from a normal desktop application (also coded in delphi). In short, I want to call the commandline app and display the text it outputs "live" in a listbox. It's been ages since I have played around with the shell, but I distinctly remember that in order to grab the text from a commandline app - I have to use the pipe symbol ">". Like this: C:/mycmdapp.exe >c:/result.txt This will take any text printed to the shell (using writeLn) and dump it to a textfile called "result.txt". But.. (and here comes the pickle), I want a live