Link to home
Start Free TrialLog in
Avatar of catbecks
catbecks

asked on

text box question

this is the code im using at the moment ShellExecute(Handle, 'open',
  'Http://www.yahoo.co.uk',nil,nil, SW_SHOWNORMAL);


which works fine however i want to get it to read the url
from a edit box when i put
ShellExecute(Handle, 'open',
  'Http://'+edit1.text,nil,nil, SW_SHOWNORMAL);
it doesent work neither does


ShellExecute(Handle, 'open',
  edit1.text,nil,nil, SW_SHOWNORMAL);
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of david-johnstone
david-johnstone

What you need to do is cast the string returned from the edit box as a PChar, so the statement becomes


ShellExecute(Handle, 'Open', PChar('http://' + edit1.Text), nil, nil, SW_SHOWNORMAL);

or

ShellExecute(Handle, 'open', PChar(edit1.Text), nil, nil, SW_SHOWNORMAL);

That should sort it out.

David.
ShellExecute(Handle, 'open', PChar(edit1.text), nil, nil, SW_SHOWNORMAL);

too late guys
Meikl was the fastest!

VSF