Board index » delphi » Problems with ShellExecute and NT

Problems with ShellExecute and NT

All,

I'm having a horrendous time finding out why the ShellExecute calls I'm making
from D1 work perfectly under Win 3.x and Win 95, but fail miserably under Win
NT. Below is a list of calls I've tried, all to no avail.  To the right of
each statement is a summary of the error I'm getting.

ShellExecute(hWnd, nil, 'c:\test.txt',
     nil, nil, SW_NORMAL);  //return from ShellExecute -- file not found (2)

ShellExecute(hWnd, nil, pChar('c:\test.txt'),
     nil, nil, SW_NORMAL);  //compiler complaint -- invalid typecast
          NOTE:  I saw the code above on a post on some newsgroup--I didn't
          think it'd compile . . . and . . . it didn't.

ShellExecute(hWnd, nil, @sFileName[1],
     nil, nil, SW_NORMAL);  //return from ShellExecute -- file not found (2)

Does anyone have any idea what's going on here?

Regards,

Brian
~!@#$%^&*()_+|}{POIUYTREWQ

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

 

Re:Problems with ShellExecute and NT


whenever I'm using shellexecute I'm using it like this:

Shellexecute(hWnd,'open','filename',nil,nil,SW_NORMAL);
   {open specifies the action needed to be taken, open or print}

are you sure your computer knows the filetype *.txt AND the viewer for this
type can be opened ? probably a stupid question but you never know.

HTH

  Roel

Quote
bgil...@acm.org wrote:

: All,

: I'm having a horrendous time finding out why the ShellExecute calls I'm making
: from D1 work perfectly under Win 3.x and Win 95, but fail miserably under Win
: NT. Below is a list of calls I've tried, all to no avail.  To the right of
: each statement is a summary of the error I'm getting.

: ShellExecute(hWnd, nil, 'c:\test.txt',
:      nil, nil, SW_NORMAL);  //return from ShellExecute -- file not found (2)

: ShellExecute(hWnd, nil, pChar('c:\test.txt'),
:      nil, nil, SW_NORMAL);  //compiler complaint -- invalid typecast
:           NOTE:  I saw the code above on a post on some newsgroup--I didn't
:           think it'd compile . . . and . . . it didn't.

: ShellExecute(hWnd, nil, @sFileName[1],
:      nil, nil, SW_NORMAL);  //return from ShellExecute -- file not found (2)

: Does anyone have any idea what's going on here?

: Regards,

: Brian
: ~!@#$%^&*()_+|}{POIUYTREWQ

: -----== Posted via Deja News, The Leader in Internet Discussion ==-----
: http://www.dejanews.com/   Now offering spam-free web-based newsreading

Re:Problems with ShellExecute and NT


Quote
bgil...@acm.org wrote in message <6h0lan$8h...@nnrp1.dejanews.com>...
>All,

>I'm having a horrendous time finding out why the ShellExecute calls I'm
making
>from D1 work perfectly under Win 3.x and Win 95, but fail miserably
under Win
>NT.
>Does anyone have any idea what's going on here?

Does do user have access rights? I found on MSDN:

"Using system policy, administrators can define which applications
cannot be started from the Windows Explorer interface. If applications
call ShellExecute, the shell has an opportunity to check such system
policy settings before the new application is started."

It's in the logo (Designed for Windows 98 and Windows NT 5.0)
requirements.

--
Zweitze de Vries
zweitze<at>iname<dot>com
When replying, please adjust reply address

Other Threads