Solved

text box question

Posted on 2001-08-15
4
160 Views
Last Modified: 2010-04-06
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);
0
Comment
Question by:catbecks
4 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 6388187
try this change (pchar-type is needed, you can do this via conversion)
ShellExecute(Handle, 'open',PCHAR( 'Http://'+edit1.text),nil,nil, SW_SHOWNORMAL);
                     
0
 

Expert Comment

by:david-johnstone
ID: 6388194
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.
0
 
LVL 5

Expert Comment

by:scrapdog
ID: 6388200
ShellExecute(Handle, 'open', PChar(edit1.text), nil, nil, SW_SHOWNORMAL);

0
 
LVL 3

Expert Comment

by:VSF
ID: 6388473
too late guys
Meikl was the fastest!

VSF
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question