![]() |
|
![]() | ||
|
Subject:
ACTIVE X <OBJECT CODE> Question
Category: Computers > Programming Asked by: imi-ga List Price: $5.00 |
Posted:
15 Jun 2002 23:46 PDT
Expires: 15 Jul 2002 23:46 PDT Question ID: 27377 |
![]() | ||
|
There is no answer at this time. |
![]() | ||
|
Subject:
Re: ACTIVE X <OBJECT CODE> Question
From: technonotice-ga on 17 Jun 2002 10:28 PDT |
Dear imi, As you didn't specify the language that your ActiveX object uses in your question, I shall use Visual Basic in the below example as it is the language I work with. As you have seen, if you try and access a non-existant object - when the user didn't accept it, Javascript causes an error as it can't find it. As a result, you need to take action when the object loads. ActiveX provides access to standard Javascript as your object's ActiveX container is Internet Explorer. This means we can do: UserControl.Parent.Script.window.close() To navigate the user to another URL for instance, we can do: UserControl.Parent.Script.document.location.href = "http://url.com" Anything that can be accessed through Javascript in IE can be accessed as so by changing the part after "UserControl.Parent.Script." as required. I have also located information about performing this in Visual C++. Quoted from the Microsoft Knowledge Base (http://support.microsoft.com/default.aspx?scid=kb;EN-US;q172763 - using keywords "ActiveX C++ Internet Explorer Parent.Script"). "GETTING THE TOP LEVEL OF THE OBJECT MODEL (VISUAL C++) (Internet Explorer 4.0 ONLY) Internet Explorer 4.0 makes accessing the object model much easier. This is a one-step process: Get the IHTMLDocument2 from the IClientSite. Obtaining IHTMLDocument2 from IOleClientSite Every control has access to IClientSite of its container. QI-ing for IHTMLDocument2 from the client site should give the scripting object model. IOleContainer* pContainer = NULL; IHTMLDocument2* pDoc = NULL; pClientSite->GetContainer( &pContainer ); if ( pContainer != NULL ) pContainer->QueryInterface( &IID_IHTMLDocument2, &pDoc ); Check the return value from the above call. If the control is not embedded within an HTML page, or if the container is not Internet Explorer 4.0, then the above call will fail. Getting IHTMLDocument2 gives the document object in the scripting object model. Then either automation interfaces or vtable interfaces can be used to drill down the object model." I am not a C++ programmer and so I am unable to assist with altering the above code to suit what I showed in Visual Basic. I wish your program success, Technonotice www.computerkb.co.uk |
Subject:
Re: ACTIVE X <OBJECT CODE> Question
From: roman-ga on 19 Jun 2002 08:19 PDT |
Imi, It will be a while until I become an official "Google Researcher" since I only applied today, here is your answer for free: The object tag has an opening tag AND a closing tag. If an object fails to instantiate for some reason the html inside the OBJECT tag is rendered. So in you case what you want to do is: <OBJECT ID='PLUG' CLASSID="clsid:556dde35-e955-11d0-a707-000000521958" CODEBASE="plugin.cab"> <!-- HERE YOU PUT THE CODE IF THE OBJECT FAILED TO INSTANTIATE, WHICH WILL HAPPEN IF THE USER CLICKS NO AND DOESN'T WANT TO INSTALL THE COMPONENT --> <script language="javascript"> location.href='..wherever you want to send the user..'; </script> </OBJECT> <!-- and we get here if the object loads successfully --> <script language="javascript"> window.close(); </script> I hope this solves your problem. Cheers, Roman </script> |
Subject:
Re: ACTIVE X <OBJECT CODE> Question
From: bineshjm-ga on 21 Jun 2002 04:56 PDT |
Your activex controll does not working at server side. that is the problem. |
Subject:
Re: ACTIVE X <OBJECT CODE> Question
From: ssharon-ga on 12 Jul 2002 01:05 PDT |
you can catch the onload event and check there if you can initiate the activeX (the onload event fires once the page was fully loaded (including the activeX)). VBScript Example: function CheckActiveX dim result, myActiveX result = 0 myActiveX = "your.activeX" on error resume next if IsObject(CreateObject(myActiveX)) = False then result = 0 else result = 1 end if on error goto 0 CheckActiveX = result end function In case the user clicked the no button or for some reason there was an error this function will return 0. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |