[Lazarus] ShellExecute

cobines cobines at gmail.com
Fri Dec 18 20:16:24 CET 2009


2009/12/18 Manuel Galeote <info at redbarcelona.com>:
> 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




More information about the Lazarus mailing list