Using the windows shell "Open with" ....
-
Hi there, I´ve looked through the Shell API doc´s and searched through the MSDN, but cannot find any doc´s about programmatically using/starting the "open with" dialog box. (i.e. right click on a file and choose open with, when double-clicking on a file that has no association, the open with dialog box appears) Here´s my problem... Using ::ShellExecuteEx(...) I´m opening a file (with the path, filename etc.), I get notification from ::ShellExecuteEx if the associated program was successfully started, or an error if no application is asscoiated with the particular file. On recieving this error, I woukd like to show the "Open with" dialog. Anyone got any ideas? Thanks in advance Phil bum... and I thought I´d got rid of all the bugs :(
-
Hi there, I´ve looked through the Shell API doc´s and searched through the MSDN, but cannot find any doc´s about programmatically using/starting the "open with" dialog box. (i.e. right click on a file and choose open with, when double-clicking on a file that has no association, the open with dialog box appears) Here´s my problem... Using ::ShellExecuteEx(...) I´m opening a file (with the path, filename etc.), I get notification from ::ShellExecuteEx if the associated program was successfully started, or an error if no application is asscoiated with the particular file. On recieving this error, I woukd like to show the "Open with" dialog. Anyone got any ideas? Thanks in advance Phil bum... and I thought I´d got rid of all the bugs :(
Call
ShellExecute(NULL, "open", "rundll32.exe", "shell32.dll, OpenAs_RunDLL <the_file>", NULL, SW_SHOW);
where <the_file> is the file you need to open. If you know how to do it without calling rundll32.exe please let me know. All my attempts have ended in nasty failures :mad: rechi
-
Call
ShellExecute(NULL, "open", "rundll32.exe", "shell32.dll, OpenAs_RunDLL <the_file>", NULL, SW_SHOW);
where <the_file> is the file you need to open. If you know how to do it without calling rundll32.exe please let me know. All my attempts have ended in nasty failures :mad: rechi
Thanks, I´ll try it out over the weekend. I suspect that using one of the shell32.dll exported functions that are not documented will do the job... but which one ???? Thanks again, I´ll let you know if I find another way Have a nice one Phil bum... and I thought I´d got rid of all the bugs :(
-
Thanks, I´ll try it out over the weekend. I suspect that using one of the shell32.dll exported functions that are not documented will do the job... but which one ???? Thanks again, I´ll let you know if I find another way Have a nice one Phil bum... and I thought I´d got rid of all the bugs :(
Phil.B wrote: but which one ???? That's easy:
OpenAs_RunDLL
. The problem was to find out the function's prototype. Check this code:typedef void (CALLBACK *PRUNDLLOPENAS)(HWND, HINSTANCE, LPCWSTR, int);
//...
HMODULE h= LoadLibrary("shell32.dll");
PRUNDLLOPENAS pOpenAs_RunDLL = (PRUNDLLOPENAS)GetProcAddress(h, "OpenAs_RunDLL");
pOpenAs_RunDLL(hWnd, NULL, "<the_file>", SW_SHOWNORMAL);
FreeLibrary(h);The best solution. :jig: rechi
-
Phil.B wrote: but which one ???? That's easy:
OpenAs_RunDLL
. The problem was to find out the function's prototype. Check this code:typedef void (CALLBACK *PRUNDLLOPENAS)(HWND, HINSTANCE, LPCWSTR, int);
//...
HMODULE h= LoadLibrary("shell32.dll");
PRUNDLLOPENAS pOpenAs_RunDLL = (PRUNDLLOPENAS)GetProcAddress(h, "OpenAs_RunDLL");
pOpenAs_RunDLL(hWnd, NULL, "<the_file>", SW_SHOWNORMAL);
FreeLibrary(h);The best solution. :jig: rechi
Thanks once again... another question, how did you manage to get the signature for the dll call, I had a look a the dll, and found all the documented calls, but the others were all with cardinal numbers. I used the depandancy walker, not exactly high-tech I know. Anyway, thanks once again Phil bum... and I thought I´d got rid of all the bugs :(
-
Thanks once again... another question, how did you manage to get the signature for the dll call, I had a look a the dll, and found all the documented calls, but the others were all with cardinal numbers. I used the depandancy walker, not exactly high-tech I know. Anyway, thanks once again Phil bum... and I thought I´d got rid of all the bugs :(
This article[^] in
MSDN
explains it all. There's no way to tell the signature of the function using only the dll's binary. Actually, it could be possible but you have to disassembly the code and hack it a bit. The function prototype is, in fact, a convention regarding the arguments and the order they have to respect while filling the stack at call-time. rechi