Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ShellExecute

3 views
Skip to first unread message

Michael Cowan

unread,
Mar 24, 2001, 12:22:57 PM3/24/01
to
I have a 16 bit program that includes the following code (in
part)

HINSTANCE hExec;

hExec =
ShellExecute(MyhWnd,"open",buffer,clbuffer,dirbuffer,SW_NORMAL);

Under Win95 it works fine but now I have moved to Windows Me
it crashes

Can anyone help, please
-----------------------------
Michael Cowan
MCo...@fujisan.demon.co.uk
http://www.fujisan.demon.co.uk
Nottingham NG7 1JY UK
-----------------------------

Jason W

unread,
Mar 25, 2001, 9:25:06 PM3/25/01
to
> I have a 16 bit program that includes the following code (in
> part)
>
> HINSTANCE hExec;
>
> hExec =
> ShellExecute(MyhWnd,"open",buffer,clbuffer,dirbuffer,SW_NORMAL);
>
> Under Win95 it works fine but now I have moved to Windows Me
> it crashes

Can you post a self contained code segment that reproduces the problem?
Something that can be put straight into a compiler would be good.

Just a guess, maybe you have have unterminated strings or something?

Jason

Michael Cowan

unread,
Mar 26, 2001, 3:05:05 PM3/26/01
to
Jason W <jaso...@crosswinds.net> wrote:

Thanks Jason.

In fact it would have crashed anyway under W95 with an
unterminated string but your 'something' got me there:
under Win95 a buffer length of 127 seems to have been OK for
the path which is what I was using. I changed it to 255 and
it worked. I suppose Win Me must allow longer paths?

Cheers

Michael

Frank Ostrowski

unread,
Mar 27, 2001, 7:10:04 AM3/27/01
to
MCo...@fujisan.demon.co.uk (Michael Cowan) wrote:

>Jason W <jaso...@crosswinds.net> wrote:
>>> hExec =
>>> ShellExecute(MyhWnd,"open",buffer,clbuffer,dirbuffer,SW_NORMAL);
>>> Under Win95 it works fine but now I have moved to Windows Me
>>> it crashes

>In fact it would have crashed anyway under W95 with an
>unterminated string but your 'something' got me there:
>under Win95 a buffer length of 127 seems to have been OK for
>the path which is what I was using. I changed it to 255 and
>it worked. I suppose Win Me must allow longer paths?

No: All Win32 versions allow path nanes of 260-chars (MAX_PATH).
If you happen to call it with shorter path always - by chance - you
may get away with a smaller buffer. But the odds are against you.
Someday someone will use a lohger pathname - crash - bingo. This may
happen on Win95 _or_ Win98 _or_ WinME _or_ WinNT _or_ Win2000 _or_
WinXP. The limit of a MS-DOS pathname has been 63 chars IIRC. But if
you do not use the 8.3 alias names in your path (C:progra~1\....)
youmust keep the buffer sizes to MAX_PATH (32 bit). Even if you use a
8.3 alias name path you may get into problems wih deeply neted folder
names since the 63 char limit is not enforced, only optionally checks
by scandisk - this pathname is to long for some 16 bit progs - or
similar -.

HTH, Frank

0 new messages