Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-12

ShellExecute

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Manuel Galeote

In windows 7 I?m trying to open a word document with the uses windows and shellExecute (lazarus 0.29 fpc 2.5.1)

That work:

ShellExecute(0, nil, PChar('C: \abc.doc'),nil,nil,SW_SHOWNORMAL);

But that not work:

ShellExecute(0, nil, PChar('C: \abc?.doc'),nil,nil,SW_SHOWNORMAL); (take a look at the final ?)

Anybody knows why and/or how can I execute that?

Thanks

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20091218/34eff0f3/attachment.html>

Reply by email

cobines
to Manuel Galeote

2009/12/18 Manuel Galeote :

Show quoted text 20 lines
In windows 7 I?m trying to open a word document with the uses windows and shellExecute (lazarus 0.29 fpc 2.5.1) That work: ShellExecute(0, nil, PChar('C: \abc.doc'),nil,nil,SW_SHOWNORMAL); But that not work: ShellExecute(0, nil, PChar('C: \abc?.doc'),nil,nil,SW_SHOWNORMAL); (take a look at the final ?) Anybody knows why and/or how can I execute that?

You should use ShellExecuteW():

ShellExecuteW(0, nil, UTF8toUTF16('C:\abc?.doc'),nil,nil,SW_SHOWNORMAL)

I assume your string is in utf8. If not convert it to UTF16 somehow.

cobines

Reply by email

Manuel Galeote
to cobines

Yes, it works. Thank you.

Earlier message 38 lines
-----Mensaje original----- De: cobines [mailto:] Enviado el: viernes, 18 de diciembre de 2009 20:16 Para: Lazarus mailing list Asunto: Re: [Lazarus] ShellExecute 2009/12/18 Manuel Galeote : > In windows 7 I?m trying to open a word document with the uses windows and > shellExecute (lazarus 0.29 fpc 2.5.1) > > > > That work: > > ShellExecute(0, nil, PChar('C: \abc.doc'),nil,nil,SW_SHOWNORMAL); > > > > But that not work: > > ShellExecute(0, nil, PChar('C: \abc?.doc'),nil,nil,SW_SHOWNORMAL); (take a > look at the final ?) > > > > Anybody knows why and/or how can I execute that? > You should use ShellExecuteW(): ShellExecuteW(0, nil, UTF8toUTF16('C:\abc?.doc'),nil,nil,SW_SHOWNORMAL) I assume your string is in utf8. If not convert it to UTF16 somehow. -- cobines --

Reply by email

Manuel Galeote
to bobby

The language of my operating system is Spanish (accent, ?, ) and in fact,
the following:

..

Archivo= AnsiToUtf8(Directory) + AnsiToUtf8(SearchRec.Name); //This is from
a routine that runs through a directory looking for files.

Works perfectly with this.

ShellExecuteW(0, nil,
PWideChar(UTF8toUTF16(?archivo?)),nil,nil,SW_SHOWNORMAL) //works with any character

Or

ShellExecuteW(0, 'open',
PWideChar(UTF8toUTF16(archivo)),nil,nil,SW_SHOWNORMAL) //works with any character too

..

Thanks.

De: bobby [mailto:]
Enviado el: viernes, 18 de diciembre de 2009 22:47 Para: Lazarus mailing list
Asunto: Re: [Lazarus] ShellExecute

Manuel Galeote wrote:

In windows 7 I?m trying to open a word document with the uses windows and shellExecute (lazarus 0.29 fpc 2.5.1)

That work:

ShellExecute(0, nil, PChar('C: \abc.doc'),nil,nil,SW_SHOWNORMAL);

But that not work:

ShellExecute(0, nil, PChar('C: \abc?.doc'),nil,nil,SW_SHOWNORMAL); (take a look at the final ?)

Anybody knows why and/or how can I execute that?

Thanks

_____

Reply by email