Questions tagged [shellexecute]

ShellExecute is a Win32 API function used to launch document files

ShellExecute is a Microsoft Win32 API function used to launch document files.

Depending on the type of document file, it will do this through:

  • Creating a process using the executable file associated with the specified document
  • Using the COM subsystem to request a shell extension to launch the document
  • Initiating an action to be completed by the end-user, such as a search

As a rule of thumb, it can be assumed that invoking ShellExecute on a document file will have the same result as double-clicking on that file in Windows Explorer, including displaying user interface elements.

521 questions
4
votes
3 answers

How do I open a file with the default text editor?

I want to open a *.conf file. I want to open this file with the standard Windows editor (e.g., notepad.exe). I currently have this ShellExecute code: var sPath, conf: String; begin try sPath := GetCurrentDir + '\conf\'; conf :=…
Hidden
  • 3,598
  • 4
  • 34
  • 57
4
votes
2 answers

How to find if an document can be OPENed via ShellExecute?

I want to check if a particular file can be successfully "OPEN"ed via ShellExecute, so I'm attempting to use AssocQueryString to discover this. Example: DWORD size = 1024; TCHAR buff[1024]; // fixed size as dirty hack for testing int err =…
Roddy
  • 66,617
  • 42
  • 165
  • 277
4
votes
2 answers

Waiting for ShellExecuteEx (Setting access rights on Windows process)

I'm using the ShellExecuteEx function in a C++ program to launch an Uninstall.lnk file. In my program, I'd like to wait for the uninstaller to finish. My first attempt was to set the SEE_MASK_NOCLOSEPROCESS flag in the SHELLEXECUTEINFO structure and…
Frerich Raabe
  • 90,689
  • 19
  • 115
  • 207
3
votes
2 answers

ActiveXObject("Shell.Application") - how to pass arguments with spaces?

I run exe from my asp.net with JavaScript using ActiveXObject. It runs successfully, except parameters: function CallEXE() { var oShell = new ActiveXObject("Shell.Application"); var prog = "C:\\Users\\admin\\Desktop\\myCustom.exe"; …
enginocal
  • 309
  • 1
  • 5
  • 19
3
votes
2 answers

Can one detect how .exe was launched?

I want to be able to detect whether a given exe was shellex'd programmatically or if it was entered and executed interactively in, say, CMD.EXE. Is there anything about the way an exe is launched that indicates the mechanism that was used to launch…
bugmagnet
  • 7,631
  • 8
  • 69
  • 131
3
votes
2 answers

Can I capture shell invocations from Perl?

I have a Perl script which invokes other programs, i.e. it calls system and/or exec and/or open with a pipe and/or uses the backtick operator. Can I run this script in such a way that it will print out the arguments to each of the above so that I…
spraff
  • 32,570
  • 22
  • 121
  • 229
3
votes
5 answers

How to launch a URL when an email arrives

I would like to launch a URL when an email arrives in Outlook. I setup a rule and have it trigger a script function. It looks like I want to call ShellExecute to launch the URL in a browser, but when I hit this line: ShellExecute(0&, "open",…
Jake Pearson
  • 27,069
  • 12
  • 75
  • 95
3
votes
1 answer

Can I use powershell commands in Unity?

first time asking a question here so hopefully it conforms to the etiquette. Does anyone know how to use the C# process.UseShellExecute = false; when in Unity3D? Using it set to false causes the exe to crash. But setting it to true disables…
3
votes
1 answer

How can i jump to a webpages anchor tag using ShellExecute in C++?

I'm currently opening a webpage succesfully in this manner, for example ShellExecute(NULL, "open", "http://www.google.com", NULL, NULL, SW_SHOWNORMAL); However what I really need to do is be able to jump to an anchor tag, like 'mypage.html#middle'.…
cheesysam
  • 1,109
  • 5
  • 15
  • 32
3
votes
1 answer

Why do we need to pass LPCTSTR lpParameters with ShellExecute

Shell Execute has the following signature : HINSTANCE ShellExecute( __in_opt HWND hwnd, __in_opt LPCTSTR lpOperation, __in LPCTSTR lpFile, __in_opt LPCTSTR lpParameters, __in_opt LPCTSTR lpDirectory, __in INT…
Simsons
  • 12,295
  • 42
  • 153
  • 269
3
votes
2 answers

inkscape shell mode

I tried to run inkscape shell mode by writing these lines in a .bat file: inkscape --shell >2.svg -e 2.png But it doesn't work at all (no png files), more over I tried to open the current svg input and I found it damaged and I failed to open it…
loll
  • 241
  • 3
  • 6
  • 14
3
votes
4 answers

Launching Shell Links (LNKs) from WOW64

Our 32-Bit application launches Windows LNK files (Shell Links) via ShellExecute. When it tries to "launch" a link to a 64-Bit binary (such as the "Internet Explorer (64-Bit)" shortcut in Start Menu) it always ends up launching the 32-Bit binary.…
ilm
3
votes
1 answer

Simple method to run a batch as Administrator using javascript

I want to derive a simple reliable method to auto elevate a running batch without using extra VBS files or elevated shortcuts, proposed in other threads. Calling the UAC dialog from the batch via javascript ensures the short simple code. The script…
sambul35
  • 1,058
  • 14
  • 22
3
votes
1 answer

incompatible types pwidechar and string ShellExecute

I try to compress files using winrar command line, But when I add a variable in the command line I get these error Incompatible types 'PWideChar' and 'string' ! I convert the sdate variable to WideChar but it's not work !! How I can fix it…
K.MuS
  • 141
  • 1
  • 10
3
votes
2 answers

How to Close the CMD prompt window after successfull execution of VBScript

I am invoking a VBScript from another to run as administrator. following is the Invoker VBScript code Set objShell = CreateObject("Shell.Application") objShell.ShellExecute "cscript", "C:\Temp\XYZ.vbs", "", "runas", 0 Wscript.Quit 1 Following is…