Solved

is there any way to open my IE from delphi with a determined page?

Posted on 2011-03-03
16
216 Views
Last Modified: 2012-05-11
Hello guys

I would like to know if there is any way to open a IE, FF, Chrome with a determined page and insert into this page, into a field html a value.

thanks
0
Comment
Question by:hidrau
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 3
  • +1
16 Comments
 
LVL 1

Author Comment

by:hidrau
ID: 35030983
I got this code and maybe it can help to accomplish this task

http://www.cryer.co.uk/brian/delphi/howto_openiespecificetc.htm
0
 
LVL 9

Expert Comment

by:Mahdi78
ID: 35031019
Add ShellAPI to uses clause and open the url like the following:

with IE

ShellExecute(0, 'open', 'IExplore', 'http://www.google.com', nil, SW_SHOW);

with firefox

ShellExecute(0, 'open', 'FireFox', 'http://www.google.com', nil, SW_SHOW);
0
 
LVL 1

Author Comment

by:hidrau
ID: 35031039
Yeah, I can do this with ShellExecute

but I need to insert into a field a value. This field is in the page.

do you know how to do this?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 19

Expert Comment

by:Thommy
ID: 35031520
How to open the standard browser on a given URL...
http://www.cryer.co.uk/brian/delphi/howto_openbrowserurl.htm
0
 
LVL 9

Expert Comment

by:Mahdi78
ID: 35031538
for example you have Val1 = "aaa" and Val2 "bbb"

You with make your url like the following:

http://yourdomain.com/index.php?val1=aaa&val2=bbb

so shellExecute with IE will be

ShellExecute(0, 'open', 'IExplore', 'http://www.google.com', nil, SW_SHOW);

to get data in your php page usedo not use the function $_GET instead of $_POST,

This is an example with value above

<?
echo "Val1:";
echo($_GET['val1']);
echo"<br>";
echo "Val2:";
echo($_GET['val2']);
?>
0
 
LVL 9

Expert Comment

by:Mahdi78
ID: 35031549
Sorry the shellExecute with IE will be

ShellExecute(0, 'open', 'IExplore', 'http://yourdomain.com/index.php?val1=aaa&val2=bbb', nil, SW_SHOW);
0
 
LVL 14

Expert Comment

by:systan
ID: 35033608
Here's from Eddie; try that;

procedure TForm1.SendPostData;
Var
  aStream: TMemoryStream;
  Params: TStringStream;
begin
  aStream := TMemoryStream.create;
  Params := TStringStream.create('');

  try
    with IdHTTP1 do
    begin
      Params.WriteString(URLEncode('teste=' + 'yes' + '&'));
      Params.WriteString(URLEncode('name=' + 'ivan' + '&'));
      Params.WriteString(URLEncode('number=' + '102'));
      Request.ContentType := 'application/x-www-form-urlencoded';
      try
        Post('http://localhost/teste.asp', Params, aStream);
      except
        on E: Exception do
          showmessage('Error encountered during POST: ' + E.Message);
      end;
    end;
  aStream.WriteBuffer(#0' ', 1);
  aStream.Position := 0;
  Memo1.Lines.LoadFromStream(aStream);
  except
  end;
end;
0
 
LVL 1

Author Comment

by:hidrau
ID: 35035244
Mahdi78:

Unfortunaly I can show to the user the information passed to the link, as you recomended:

www.mysite.com?vari=xxxxx

in my site, there is a hide field that I will insert the value into it, this value will not be displayed to user.

0
 
LVL 9

Expert Comment

by:Mahdi78
ID: 35035290
Then, you should use IDHttp or webbrowser component
0
 
LVL 1

Author Comment

by:hidrau
ID: 35035542
My delphi is complainting this URLEncode, I don't know how unit it come from

0
 
LVL 1

Author Comment

by:hidrau
ID: 35035620
systan:

I have this error:
Protocol field is empty

this error occurs in this line:
Params.WriteString(TIdURI.URLEncode('cmp1=' + 'oi' + '&'));

I have in my page a field named cmp1, i'd like to put a string into it, anything to test

0
 
LVL 14

Expert Comment

by:systan
ID: 35037345
hi
if you are using only 1 parameter?, removed the
&
Params.WriteString(TIdURI.URLEncode('cmp1=oi'));

or Use the HTTPEncode in HTTPApp instead
Params.WriteString(HTTPEncode('cmp1=oi'));
0
 
LVL 1

Author Comment

by:hidrau
ID: 35037435
systan:

did you test it? Did It work in your computer?
0
 
LVL 9

Expert Comment

by:Mahdi78
ID: 35037809
This complete is a example to know how to post data with idhttp

copy the following script in post.php file

<?
  echo '<b>Your username:</b>'.$_POST['user_name']
.' <br><b>Your password:</b> '. $_POST['password'];
?>

and use Delphi code

uses IdMultipartFormData;

procedure TForm1.Button1Click(Sender: TObject);
var data: TIdMultiPartFormDataStream;
begin
data := TIdMultiPartFormDataStream.Create;
 try
  data.AddFormField('user_name', 'value1');
  data.AddFormField('password', 'value2');
  Memo1.Text :=IdHTTP1.Post('http://localhost/post.php', data);
 finally
 data.Free;
 end;

end;
0
 
LVL 14

Accepted Solution

by:
systan earned 500 total points
ID: 35041527
>>did you test it? Did It work in your computer?
This is a question of a wise men without a cash, lol, I always ask this.
Sorry, I didn't test the code itself, but I was hoping to work in you.

Ok; here's my last post, try this link, it says something about a good solution
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23128532.html


Good Luck
0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 35082578
thanks for the link
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

624 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