Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   General (http://www.delphipages.com/forum/forumdisplay.php?f=2)
-   -   How to copy a string into a pchar??????? (http://www.delphipages.com/forum/showthread.php?t=18099)

gLes 01-05-2001 02:31 PM

How to copy a string into a pchar???????
 
I mean I want execute an email address like this:

ShellExecute(Application.MainForm.Handle, nil, 'mailto:' + EmailAddress, '', '', SW_SHOW);

But I need to read in the e-mail address from a label's caption which is a string...but the shellexecute needs PChar!

Can anybody plz help me?!:)

ADMack 01-05-2001 04:00 PM

RE: How to copy a string into a pchar???????
 
Cast the string as a PChar:
ShellExecute(Application.MainForm.Handle, nil, 'mailto:' + PChar(EmailAddress), '', '', SW_SHOW);

The Smurf 01-05-2001 10:10 PM

RE: RE: How to copy a string into a pchar???????
 
ShellExecute(Application.MainForm.Handle, nil, 'mailto:' + PChar(EmailAddress), '', '', SW_SHOW);

Actually, that bit of code won't work correctly. You need to cast the entire string.

ShellExecute(Application.MainForm.Handle,nil,PChar ('mailto:' + EmailAddress),'','',SW_SHOW);

-- The Smurf.


All times are GMT. The time now is 11:37 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.