shellexecute

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

孤街浪徒 提交于 2019-12-06 05:36:52
问题 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 = AssocQueryString(0, ASSOCSTR_EXECUTABLE, ".mxf", NULL ,buff , &size); openAction->Enabled = ((err == S_OK) || (err == S_FALSE)) && (size > 0); Now, this almost works. If there's a registered application, I get the string. But, there's a catch: On Vista,

how to open a service properties dialog

烈酒焚心 提交于 2019-12-06 00:46:18
问题 I would like to add a button to my application ( frontend to a service) that will open the service properties dialog (like in services mmc snapin ) for my service. There are numerous examples to open file properties, but that is not what i want. i dont know where to start. 回答1: Based off of the services.msc , the page comes from filemgmt.dll and is called ServicePageGeneral . While the COM components are registered, I cannot find any documentation for the CLSID in question, nor for any of the

Java + JNA, looking for a way to run ShellExecuteW

狂风中的少年 提交于 2019-12-06 00:03:12
I am trying to run a ShellExecute function from java with JNA. I dont have any problems running ShellExecuteA on non-unicode folders import com.sun.jna.*; import com.sun.jna.platform.win32.ShellAPI; import com.sun.jna.platform.win32.WinDef; import com.sun.jna.win32.*; public class Main { public interface Shell32 extends ShellAPI, StdCallLibrary { Shell32 INSTANCE = (Shell32)Native.loadLibrary("shell32", Shell32.class); WinDef.HINSTANCE ShellExecuteA(WinDef.HWND hwnd, String lpOperation, String lpFile, String lpParameters, String lpDirectory, int nShowCmd); } public static void main(String[]

ShellExecute fails for local html or file URLs

怎甘沉沦 提交于 2019-12-05 18:16:42
Our company is migrating our help systems over to HTML5 format under Flare. We've also added Topic based acces to the help systems using Flare CSHID's on the URI command line for accessing the topic directly, such as index.html#CSHID=GettingStarted to launch the GettingStarted.html help page. Our apps are written in C++ and leverage the Win32 ShellExecute() function to spawn the default application associated with HTTP to display the help system. We've noticed that ShellExecute() works fine when no hashtag is specified, such as ShellExecute(NULL,_T("open"),_T("c:\Help\index.html"),NULL,NULL,SW

WOW64 woes (.lnk shortcuts)

*爱你&永不变心* 提交于 2019-12-05 12:30:05
I'm using Windows 7 (x64) and Delphi 2010. I'm writing a component that will emulate the start menu. However, I've run into the following problems: If I attempt to open a shortcut (.lnk file) with ShellExecute , this will fail whenever %ProgramFiles% is part of the target path of the shortcut (it will then look at the C:\Program Files (x86) folder instead of C:\Program Files ); ShGetFileInfo fails to extract the correct index of the icon in the system image list if %ProgramFiles% is part of the path to the icon file (same problem as above). Is there any workaround to the above issues or do I

Good quality code example of how to call an application and wait for it to exit

陌路散爱 提交于 2019-12-05 11:56:43
Using: Delphi XE2; Windows 32-bit VCL application From within my Delphi application, I need to call an application using ShellExecute and wait until it finishes before proceeding. I see many examples here on SO of ShellExecute with MsgWaitForMultipleObjects but can't know which one is the best because they are mostly doing what is not recommended ie. also using Application.ProcessMessages which is not recommended by many. I see an answer by NFX here in this post which does not use Application.ProcessMessages, but am not sure if it is correct or optimum, and hence this question. Would be glad

Which reasons could make ShellExecute fail?

痞子三分冷 提交于 2019-12-04 18:12:40
问题 I have a VB6 application which opens files with their associated application using: ShellExecute(0, "open", filename, params, vbNullString, vbNormalFocus) This works perfectly. Now I got a customer (running XP with Adobe Reader) who can't open any PDF file using the above command. But the same file is being opened without any problems when double clicking it from Windows Explorer. I also tested the filename/-path combination on my machine to exclude those kind of problems. I'm searching for

Open a URL in a new browser process

前提是你 提交于 2019-12-04 13:42:16
I need to open a URL in a new browser process. I need to be notified when that browser process quits. The code I'm currently using is the following: Process browser = new Process(); browser.EnableRaisingEvents = true; browser.StartInfo.Arguments = url; browser.StartInfo.FileName = "iexplore"; browser.Exited += new EventHandler(browser_Exited); browser.Start(); Clearly, this won't due because the "FileName" is fixed to iexplore, not the user's default web browser. How do I figure out what the user's default web browser is? I'm running on Vista->forward. Though XP would be nice to support if

Selecting file in Windows Explorers does not always work

那年仲夏 提交于 2019-12-04 11:55:40
问题 Using the following explorer.exe /select, "c:\path\to\file.txt" I can open Windows Explorer and select the file. In Delphi I do this to select "Parm" file: ShellExecute(Application.MainForm.Handle, 'OPEN', PChar('explorer.exe'), PChar('/select,"' + Parm + '"'), nil, SW_NORMAL); And it works. My problem is this: if I select a different file in the recently opened Explorer (clicking in a different file) and then call the above code the "Parm" file is not selected again. Interestingly, there are

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

∥☆過路亽.° 提交于 2019-12-04 11:18:19
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 = AssocQueryString(0, ASSOCSTR_EXECUTABLE, ".mxf", NULL ,buff , &size); openAction->Enabled = ((err == S_OK) || (err == S_FALSE)) && (size > 0); Now, this almost works. If there's a registered application, I get the string. But, there's a catch: On Vista, even if there is no registered application, It returns that the app c:\Windows\System32\shell32.dll is