Sign in Join

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

Mailing lists / lazarus / 2015-05

ShellExecute and german umlauts

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Henry Vermaak
to John Landmesser
John Landmesser wrote 15 lines
i want to send a mail on windows using shellexecute with german Umlauts ( ?,?,? .. ) in the body of the mail. This Code doesn't work: var s: string; s := '??????' shellexecute(Application.Mainform.handle, 'open',PChar('mailto:' + ' + '?subject=' + 'ARJ-ChapterArchiv: ' + '&body=' + UTF8ToAnsi(s)),nil, nil, sw_normal); ?Good tipps are welcome! ? I don't want to use Indy or synapse!

I use something like this:

if Win32MajorVersion < 5 then
	Ret := ShellExecute(0, 'open', PChar(UTF8ToSys(AProg)), nil, nil, SW_SHOWNORMAL)
else
	Ret := ShellExecuteW(0, 'open', PWideChar(UTF8Decode(AProg)), nil, nil, SW_SHOWNORMAL);
Result := Ret > 32;

Henry

Reply by email

John Landmesser
to Henry Vermaak
Henry Vermaak wrote 32 lines
On Thu, May 21, 2015 at 10:06:28AM +0200, John Landmesser wrote: > i want to send a mail on windows using shellexecute with german > Umlauts ( ?,?,? .. ) in the body of the mail. > > This Code doesn't work: > > var s: string; > > s := '??????' > > > shellexecute(Application.Mainform.handle, 'open',PChar('mailto:' + > ' + '?subject=' + 'ARJ-ChapterArchiv: ' + > '&amp;body=' + UTF8ToAnsi(s)),nil, nil, sw_normal); > > Good tipps are welcome! I don't want to use Indy or synapse! I use something like this: if Win32MajorVersion < 5 then Ret := ShellExecute(0, 'open', PChar(UTF8ToSys(AProg)), nil, nil, SW_SHOWNORMAL) else Ret := ShellExecuteW(0, 'open', PWideChar(UTF8Decode(AProg)), nil, nil, SW_SHOWNORMAL); Result := Ret > 32; Henry -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

thanks Henry!

found a solution that is ok with umlauts in body:

        var list : TStringList; // body
                 s : string; // for body without LFN and spaces
        (* LFN replace: *)
       for x := 0 to list.Count -1 do
       s := s + '%0D%0A' + List[x];
       (* replace Spaces : *)
       s := StringReplace(s,' ','%20',[rfReplaceAll, rfIgnoreCase]);
       cmdLine := 'mailto:?subject=ARJ-ChapterArchiv:
'  + ArchName + '&body=' + s;
       if not Openurl(cmdLine) then

that works, but i don't know why, Perhaps your

PChar(UTF8ToSys(AProg))

and

PWideChar(UTF8Decode(AProg))

is the trick?

Reply by email