Forum > Networking and Web Programming

GetActiveOleObject fails even though CreateOleObject succeeds

(1/1)

RedOctober:
Can some one explain what I am doing wrong?  After I successfully open IE from Lazarus, then I try to access it again later in code, I will get a "RPC server unavailable" error message.  In an attempt to overcome that error, I decided to try and "find" the Ole object by using GetActiveOleObject().  But that fails too... even immediately after the successful creation of the Ole object.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- uses  ... Windows, ComObj;...Browser := CreateOleObject('InternetExplorer.Application');  // <--- this line succeedsBrowser := GetActiveOleObject('InternetExplorer.Application');  // <--- this line fails...  
Error displayed:
Operation unavailable.

Jurassic Pork:
hello,
may be a problem with the internet explorer com object. 
With ms Word i have no problem with this code :

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button3Click(Sender: TObject);var msWord,sourDoc : OleVariant;beginmsWord := CreateOleObject('Word.Application');msWord := GetActiveOleObject('Word.Application');sourDoc := msWord.Documents.Open('d:\temp\monDoc.doc');msWord.Visible := true;end;maybe it is time to use other thing that internet explorer (end of life).  See this message

Friendly, J.P

loaded:

--- Quote from: Jurassic Pork on August 30, 2021, 04:43:51 pm ---may be a problem with the internet explorer com object. 

--- End quote ---
No problem, this is a precaution taken for security reasons.
You cannot connect to a session opened in Internet Explorer for security reasons, you can only access the session you started.

Navigation

[0] Message Index

Go to full version