Click here to Skip to main content
15,885,782 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cursor Position inside a text box Pin
leppie28-Jun-03 4:34
leppie28-Jun-03 4:34 
GeneralDateTime Constructor performance Pin
Josh Martin27-Jun-03 14:33
Josh Martin27-Jun-03 14:33 
GeneralRe: DateTime Constructor performance Pin
Jim Stewart28-Jun-03 5:20
Jim Stewart28-Jun-03 5:20 
GeneralRe: DateTime Constructor performance Pin
Josh Martin1-Jul-03 13:23
Josh Martin1-Jul-03 13:23 
GeneralMouse Auto Click Pin
Pedromdrp27-Jun-03 12:15
Pedromdrp27-Jun-03 12:15 
GeneralRe: Mouse Auto Click Pin
Paresh Gheewala27-Jun-03 13:10
Paresh Gheewala27-Jun-03 13:10 
GeneralRe: Mouse Auto Click Pin
Pedromdrp28-Jun-03 3:41
Pedromdrp28-Jun-03 3:41 
GeneralWebBrowser control: stuck with interframe security Pin
GriffonRL27-Jun-03 12:03
GriffonRL27-Jun-03 12:03 
Hello,

I'm trying to parse frames from pages using the WebBrowser control and sometimes when frames or iframes are not from the same domain as the main page, I get an interframe security problem.
This problem (or feature of IE) is well known and a workaround exists for C++. My problem is that I'm not comfortable with COM object and don't known how to translate the workaround into C#.

Any help on translating this will be greatly welcome.
Here is the KB article from MSDN:
KB196340 - HOWTO: Get the WebBrowser Object Model of an HTML Frame
<br />
// Get the IDispatch of the document<br />
LPDISPATCH lpDisp = NULL;<br />
lpDisp = m_webBrowser.GetDocument();<br />
<br />
if (lpDisp)<br />
{<br />
   IOleContainer* pContainer;<br />
<br />
   // Get the container<br />
   HRESULT hr = lpDisp->QueryInterface(IID_IOleContainer,<br />
                                       (void**)&pContainer);<br />
   lpDisp->Release();<br />
<br />
   if (FAILED(hr))<br />
      return hr;<br />
<br />
   IEnumUnknown* pEnumerator;<br />
<br />
   // Get an enumerator for the frames<br />
   hr = pContainer->EnumObjects(OLECONTF_EMBEDDINGS, &pEnumerator);<br />
   pContainer->Release();<br />
<br />
   if (FAILED(hr))<br />
      return hr;<br />
<br />
   IUnknown* pUnk;<br />
   ULONG uFetched;<br />
<br />
   // Enumerate and refresh all the frames<br />
   for (UINT i = 0; S_OK == pEnumerator->Next(1, &pUnk, &uFetched); i++)<br />
   {<br />
      // QI for IWebBrowser here to see if we have an embedded browser<br />
      IWebBrowser2* pBrowser;<br />
<br />
      hr = pUnk->QueryInterface(IID_IWebBrowser2, (void**)&pBrowser);<br />
      pUnk->Release();<br />
<br />
      if (SUCCEEDED(hr))<br />
      {<br />
         // Refresh the frame<br />
         pBrowser->Refresh();<br />
         pBrowser->Release();<br />
      }<br />
   }<br />
<br />
   pEnumerator->Release();<br />
}<br />


Thanks,


R. LOPES
Just programmer.
GeneralOpen Web Browser from Winform Pin
Chris#27-Jun-03 11:03
Chris#27-Jun-03 11:03 
GeneralRe: Open Web Browser from Winform Pin
Mazdak27-Jun-03 11:13
Mazdak27-Jun-03 11:13 
GeneralRe: Open Web Browser from Winform Pin
dynamic27-Jun-03 12:45
dynamic27-Jun-03 12:45 
GeneralRe: Open Web Browser from Winform Pin
Paresh Gheewala27-Jun-03 13:11
Paresh Gheewala27-Jun-03 13:11 
GeneralRe: Open Web Browser from Winform Pin
Arjan Einbu28-Jun-03 11:32
Arjan Einbu28-Jun-03 11:32 
QuestionC DLL -&gt; C# DLL possible? Pin
S O S27-Jun-03 9:57
S O S27-Jun-03 9:57 
AnswerRe: C DLL -&gt; C# DLL possible? Pin
Nathan Blomquist27-Jun-03 17:32
Nathan Blomquist27-Jun-03 17:32 
GeneralRe: C DLL -&gt; C# DLL possible? Pin
S O S28-Jun-03 8:43
S O S28-Jun-03 8:43 
AnswerRe: C DLL -&gt; C# DLL possible? Pin
Nick Parker28-Jun-03 6:10
protectorNick Parker28-Jun-03 6:10 
GeneralRe: C DLL -&gt; C# DLL possible? Pin
S O S28-Jun-03 8:43
S O S28-Jun-03 8:43 
GeneralRe: C DLL -&gt; C# DLL possible? Pin
Nick Parker28-Jun-03 10:39
protectorNick Parker28-Jun-03 10:39 
AnswerRe: C DLL -&gt; C# DLL possible? Pin
jspano2-Jul-03 6:56
jspano2-Jul-03 6:56 
Generalconfig file for a class library Pin
IsaacB27-Jun-03 5:55
IsaacB27-Jun-03 5:55 
GeneralRe: config file for a class library Pin
Arjan Einbu28-Jun-03 11:39
Arjan Einbu28-Jun-03 11:39 
GeneralShortcut enum Pin
Neil Lamka27-Jun-03 5:47
Neil Lamka27-Jun-03 5:47 
GeneralTabStops in ListBox Pin
Roland Bär27-Jun-03 2:59
Roland Bär27-Jun-03 2:59 
GeneralRe: TabStops in ListBox Pin
Rocky Moore27-Jun-03 23:15
Rocky Moore27-Jun-03 23:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.