Thread View: borland.public.cppbuilder.nativeapi
10 messages
10 total messages
Started by Roger Remacle
Fri, 18 Apr 2003 19:05
ShellExecute - crash on NT4
Author: Roger Remacle
Date: Fri, 18 Apr 2003 19:05
Date: Fri, 18 Apr 2003 19:05
11 lines
1265 bytes
1265 bytes
The following opens Yahoo without problems on Win98, Win2000 but
crashes(application not responding) on NT4 SP6.... Can someone tell me why?
void __fastcall TAboutDialog::Label4Click(TObject *Sender)
{
ShellExecute(Handle, "open", "www.yahoo.com", NULL,
NULL, SW_SHOWDEFAULT);
}
All help appreciated
Roger.
Re: ShellExecute - crash on NT4
Author: Remy Lebeau (TeamB)
Date: Fri, 18 Apr 2003 19:50
Date: Fri, 18 Apr 2003 19:50
15 lines
1388 bytes
1388 bytes
"Roger Remacle" <admin@submitplus.com> wrote in message
news:3ea04c39$1@newsgroups.borland.com...
> The following opens Yahoo without problems on Win98,
> Win2000 but crashes(application not responding) on NT4 SP6....
> Can someone tell me why?
I can't comment on the crash itself, but you do need to specify the "http"
portion of the URL as well for proper parsing:
ShellExecute(Handle, "open", "http://www.yahoo.com", NULL, NULL,
SW_SHOWDEFAULT);
Gambit
Re: ShellExecute - crash on NT4
Author: Roger Remacle
Date: Fri, 18 Apr 2003 19:56
Date: Fri, 18 Apr 2003 19:56
23 lines
1649 bytes
1649 bytes
Thank you.... That's probably it. Roger. "Remy Lebeau (TeamB)" <gambit47@yahoo.com> wrote in message news:3ea056c0$1@newsgroups.borland.com... > > "Roger Remacle" <admin@submitplus.com> wrote in message > news:3ea04c39$1@newsgroups.borland.com... > > The following opens Yahoo without problems on Win98, > > Win2000 but crashes(application not responding) on NT4 SP6.... > > Can someone tell me why? > > I can't comment on the crash itself, but you do need to specify the "http" > portion of the URL as well for proper parsing: > > ShellExecute(Handle, "open", "http://www.yahoo.com", NULL, NULL, > SW_SHOWDEFAULT); > > > Gambit > >
Re: ShellExecute - crash on NT4
Author: Murray Nelson
Date: Mon, 21 Apr 2003 22:57
Date: Mon, 21 Apr 2003 22:57
32 lines
2058 bytes
2058 bytes
I think you have to be a tad more specific.
SHELLEXECUTEINFO ExecInfo;
memset (&ExecInfo, 0, sizeof(ExecInfo));
ExecInfo.cbSize = sizeof(ExecInfo);
ExecInfo.lpVerb = "open";
ExecInfo.lpFile = "C:\\Program Files\\Internet Explorer\\iexplore.exe";
ExecInfo.lpParameters = "http://www.yahoo.com";
ExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ExecInfo.nShow = SW_HIDE;
if (!ShellExecuteEx(&ExecInfo))
{
printf("Couldn't find command");
}
Roger Remacle wrote:
> The following opens Yahoo without problems on Win98, Win2000 but
> crashes(application not responding) on NT4 SP6.... Can someone tell me why?
>
> void __fastcall TAboutDialog::Label4Click(TObject *Sender)
> {
> ShellExecute(Handle, "open", "www.yahoo.com", NULL,
> NULL, SW_SHOWDEFAULT);
> }
>
> All help appreciated
> Roger.
>
>
>
Re: ShellExecute - crash on NT4
Author: Remy Lebeau (TeamB)
Date: Mon, 21 Apr 2003 23:38
Date: Mon, 21 Apr 2003 23:38
16 lines
1816 bytes
1816 bytes
"Murray Nelson" <mnpicker@agt.net> wrote in message news:3EA47744.4010906@agt.net... > I think you have to be a tad more specific. Not really. The whole point of ShellExecute() is that you can give it basic information about a particular resource, and then internally it resolves the best way to actually handle it. In the case of URLs, as long as you include the "http" portion of the URL as well, then ShellExecute() will be able to determine where and how to open the web browser with the URL. With your code sample, you're forcing the URL to be opened a particular way, which may not be the best way on all system. Especially for people who have multiple browsers installed, or don't have IE installed at all. Gambit
Re: ShellExecute - crash on NT4
Author: Murray Nelson
Date: Tue, 22 Apr 2003 04:32
Date: Tue, 22 Apr 2003 04:32
25 lines
2023 bytes
2023 bytes
Interesting. I wonder is there a place one can find some in depth information on shellexecute(). Like included libraries? Remy Lebeau (TeamB) wrote: > "Murray Nelson" <mnpicker@agt.net> wrote in message > news:3EA47744.4010906@agt.net... > >>I think you have to be a tad more specific. >> > > Not really. The whole point of ShellExecute() is that you can give it basic > information about a particular resource, and then internally it resolves the > best way to actually handle it. In the case of URLs, as long as you include > the "http" portion of the URL as well, then ShellExecute() will be able to > determine where and how to open the web browser with the URL. With your > code sample, you're forcing the URL to be opened a particular way, which may > not be the best way on all system. Especially for people who have multiple > browsers installed, or don't have IE installed at all. > > > Gambit > > >
Re: ShellExecute - crash on NT4
Author: Remy Lebeau (TeamB)
Date: Tue, 22 Apr 2003 06:35
Date: Tue, 22 Apr 2003 06:35
35 lines
2434 bytes
2434 bytes
"Murray Nelson" <mnpicker@agt.net> wrote in message
news:3EA4C5ED.5050505@agt.net...
> Interesting. I wonder is there a place one can find
> some in depth information on shellexecute().
There's not much to tell about it. You give it a filename, and it resolves
which type of file it is, based on the file extension. Or in the case of
URLs, the protocol used. Then it goes into the HKEY_CLASSES_ROOT section of
the Registry, looks to see if the file type is registered, and if so then
simply executes the command associated with the file type's registered verb
that is specified in the lpOperation parameter of ShellExecute().
So, for example, when executing a URL, the http protocol is registered as
follows:
HKEY_CLASSES_ROOT\http\shell\open\command
(Default)="F:\PROGRA~1\INTERN~2\iexplore.exe" -nohome
The URL passed to ShellExecute() will be passed to the web browser as a
command line parameter. So, in this particular example, IE would be invoked
as such:
F:\PROGRA~1\INTERN~2\iexplore.exe -nohome "http://theurl.com"
At startup, IE can look to see if it was passed any command-line parameters,
and if so then process them accordingly.
> Like included libraries?
ShellExecute(), like its name implies, is part of the OS Shell itself,
available in shell32.dll.
Gambit
was ShellExecute - crash on NT4
Author: Murray Nelson
Date: Tue, 22 Apr 2003 07:37
Date: Tue, 22 Apr 2003 07:37
11 lines
1671 bytes
1671 bytes
Well now I have some further queries. Actually I have been using ShellExecuteInfo I am trying to write a registry key to the registry with a file suffixed .reg previously prepared. ShellExecuteInfo works great except I get "Are you sure ..." and then I get "...successfuly entered into registry". So I have to complete a carriage return twice or a space bar twice to get the final result. What can I put into the ExecInfo.lpParameters = ""; to complete the spacebar strokes? ExecInfo.lpFile = "C:\\New Folder\\ViaPref.reg"; ExecInfo.lpParameters = "";
Re: was ShellExecute - crash on NT4
Author: Remy Lebeau (TeamB)
Date: Tue, 22 Apr 2003 17:30
Date: Tue, 22 Apr 2003 17:30
27 lines
2291 bytes
2291 bytes
"Murray Nelson" <mnpicker@agt.net> wrote in message news:3EA4F142.2040002@agt.net... > Actually I have been using ShellExecuteInfo > I am trying to write a registry key to the registry with > a file suffixed .reg previously prepared. ShellExecuteInfo > works great except I get "Are you sure ..." and then I get > "...successfuly entered into registry". So I have to complete > a carriage return twice or a space bar twice to get the > final result. What can I put into the > ExecInfo.lpParameters = ""; to complete the spacebar > strokes? You can't send keyboard strokes with ShellExecute(). Nor can you pass parameters to REGEDIT.EXE because you're only specifying a filename and not the actual application as well, thus the lpParameters value is ignored completely. You could, however, use keybd() for sending the keystrokes. However, either way, you should instead be calling REGEDIT.EXE directly, passing it the .reg filename as a parameter as well as the /S flag. That will prevent the message boxes from being displayed in the first place. In which case, I would suggest you use CreateProcess() instead of ShellExecuteEx() for that. Gambit
Re: was ShellExecute - crash on NT4
Author: Murray Nelson
Date: Tue, 22 Apr 2003 21:17
Date: Tue, 22 Apr 2003 21:17
37 lines
2669 bytes
2669 bytes
Actually I tried it with ShellExecuteInfo()to save time. The /s did the trick. Thank you so much Gambit. This newsgroup is a God send. I will be hangin here regularly. So much to learn. Remy Lebeau (TeamB) wrote: > "Murray Nelson" <mnpicker@agt.net> wrote in message > news:3EA4F142.2040002@agt.net... > > >> Actually I have been using ShellExecuteInfo >>I am trying to write a registry key to the registry with >>a file suffixed .reg previously prepared. ShellExecuteInfo >>works great except I get "Are you sure ..." and then I get >>"...successfuly entered into registry". So I have to complete >>a carriage return twice or a space bar twice to get the >>final result. What can I put into the >> ExecInfo.lpParameters = ""; to complete the spacebar >>strokes? >> > > You can't send keyboard strokes with ShellExecute(). Nor can you pass > parameters to REGEDIT.EXE because you're only specifying a filename and not > the actual application as well, thus the lpParameters value is ignored > completely. You could, however, use keybd() for sending the keystrokes. > > However, either way, you should instead be calling REGEDIT.EXE directly, > passing it the .reg filename as a parameter as well as the /S flag. That > will prevent the message boxes from being displayed in the first place. In > which case, I would suggest you use CreateProcess() instead of > ShellExecuteEx() for that. > > > Gambit > > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads