|
You got E_ACCESSDENIED COM exception, because of IE security design.
try{
spFrameDoc = spFrame->document;
} catch(_com_error e)
{
TRACE("Äîêóìåíò íåäîñòóïåí!\n");
}
Cross-Frame Scripting and Security
With Dynamic HTML (DHTML), content in different windows and frames can interact in powerful ways by scripting with the object model. However, since a browser can simultaneously display unrelated documents in its various windows and frames, certain rules must be enforced to protect data integrity and privacy of information. This article describes how and why these restrictions apply in the DHTML Object Model. All rules about script interaction apply equally to windows, dialog boxes, FRAMESETs, FRAMEs, and IFRAMEs. For most content, only interactions with content from the same domain are allowed. For example, a typical page on www.microsoft.com can freely script content on any other page on www.microsoft.com, but cannot script to pages that are located on a different Web domain. The DHTML Object Model uses the document.domain property to enforce this restriction: only pages with identical domain properties are allowed free interaction. The protocol of the URL must also match. For instance, an HTTP page cannot access HTTPS content. The range of permissible access for a page can be expanded when a script assigns the document.domain property to a suffix of the site name space, up to the second-level domain. For example, a page on www.microsoft.com can assign the document.domain property—initially www.microsoft.com—as microsoft.com to broaden access to include pages in home.microsoft.com or any other site, as long as the other pages also set the document.domain property to the identical value. Since only pages from a site whose name ends with microsoft.com will permit this domain to be set, it is assured that content from the same provider mutually agrees to interact and is free to do so. Domain suffixes shorter than the second-level domain (such as just "com") are not allowed, because they expose beyond a single provider. For international site names, such as www.microsoft.co.jp, the second-level domain for widest access would be "microsoft.co.jp" (not "co.jp"). Since it is important to be able to navigate windows or frames to any URL beyond the domain restriction, these types of accesses are always permitted. Only access that attempts to read out or modify content is restricted. For instance, the href property might be assigned to cause navigation to occur, but this property cannot be read if the URL is of a different domain. This would allow one page to learn where the user has been browsing, and to allow this is a breach of the user's privacy. Some restrictions that apply to pages of different domains include: window.location.href Property can be set to navigate, but cannot be read. Other window.location.href Functionality is blocked. document.location.href Property can be set to navigate, but cannot be read. Other document.location.href Functionality is blocked. IFRAME property can be set to navigate, but cannot be read.
Scripts that attempt to access parts of the object model to which they do not have access are blocked with a "permission denied" error. While domain security can prevent certain types of content interaction, it is important to understand that this restriction is necessary to ensure security. For example, without domain security, a rogue page could "snoop" on another page or, using DHTML, manipulate its content. <info><product rid="prod_IE" minver="4.0"><platform rid="plat_win" minver="95"><platform rid="plat_nt" minver="4.0">
soptest
|
|
|
|
|
Thanks. It's a strange thing occured. Yesterday, catch operator don't helped me (was Exception MessageBox). Today it works, both code:
try{spFrameDoc = spFrame->document; }
catch(_com_error e)
{
TRACE("Doc unavailable! %s\n", e.ErrorMessage());
}
try{spFrameDoc = spFrame->document; }
catch(...)
{
TRACE("Doc unavailable!\n");
}
And pair questions more.
1) Under debugger I saw
First-chance exception in IEEnumWindows.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. Is it correct? (I handled it).
2) Is it means, that it's impossible to access certain documents for my app? Or there is any way to pass security troubles?
|
|
|
|
|
This kind of stuff happens all the time.. It looks scary, but I think it's stuff that either the kernel or link/loader is doing. Try debugging any application and you'll see tons of these messages (at least in VC 6)
FreeBSD is sexy.
<< This space for rent >>
|
|
|
|
|
I have two DLLs written in VB6. The one DLL is for data access, the other is an intermediary. Both are in COM+ Server applications. My application accesses the intermediary DLL, which in turn accesses the data-access DLL.
One of the classes in the intermediary has transaction support set to "Required". The rest of the classes have transaction support set to "Supported".
When my application accesses a function on this particular class, the application hangs. But if I start the data-access DLL in debug mode, the application accesses the function without a hitch.
Am I missing a setting or service somewhere? (I have Win2K Server.)
|
|
|
|
|
I have a Composite Control with a list control drawn in my resource. I created my own CListCtrl derived class, which adds sorting of columns.
Now I want to do some custom drawing, but I can get this to work. Some how I do not receive the NM_CUSTOMDRAW message. I used ON_NOTIFY_REFLECT and also tried the OnNotify method to catch this message, but here I only got the message from the header, not from the list itself.
How can I receive this message ? Must I do something else with the message map?
By the way, I used m_mylist.SubclassWindow(GetDlgItem(IDC_LIST)) to link the list control object to the list control.
|
|
|
|
|
Hello,
I have 2 questions.. I have researched this for a while and I am very frustrated, so any help will be greatly appreciated. I finally figured out that if your deskband inherits from IPersistStream, explorer won't release the dll when you close the deskband. Why is this??? Second question. Is there a way for a deskband to close itself? In other words, can a deskband tell it's owner that it wants to close?
Thanks
|
|
|
|
|
Man I would kill for an answer to these questions!
|
|
|
|
|
Hi all,
how can i open, format the margins and save a ms word document programmatically?
by the way, my applicating is dos-based application. I tried to put
<br />
if(!AfxOleInit())<br />
{<br />
AfxMessageBox("Could not initialize COM dll");<br />
return FALSE;<br />
}<br /> in my application. but it doesn't work. so i searched through microsoft.com.
and found Automate Excel from C++ withoud using mfc or # import (q216686)
|
|
|
|
|
I need to know the number of "printable" pages of any web site as I have it on the IE. (skip the settings of landscape/portrait) - this number serves me for my plugin which would be located on the toolbar and would be used for any
webpage opened at that moment.
|
|
|
|
|
Hello,
I need to convert a VC application into a activex. Is it possible to do it. I do have the source code for a particular VC application. I need to convert the VC funtions to activex. So that It will be possible for me to use it in VB.
It is urgent, Please tell any paths to find the solution.
Rajesh Kannan
|
|
|
|
|
I need to connect to some BODY object events as soon as possible. WHEN I must do it, check BODY availability by timer? Events like OnDonloadComplete comes too later...
Question #2: if document contains frames, I need to enumerate it and connect to each frame events. Someone has code sample??
|
|
|
|
|
you can only access IE thru DOM interfaces after the DocumentComplete event when its ReadyState property is changed to READYSTATE_COMPLETE and not earlier.
|
|
|
|
|
You're not right, BODY object accessable before OnDocumentComplete firing. I'm trying to connect to BODY object when click button, and it was available before OnDocumentComplete!!!
When I must connect to it???
|
|
|
|
|
Hi,
I have a COM local server, EXE, which is killed. then the program identifies it is killed, releases all the pointers associated with it etc.
only then it CoCreateInstance() it again, as in the very first initialization.
Yet, when i refer to the pointers of this COM server (only after being re-initialized), I get the msg: "the RPC server is unavailable" or "The server endpoint cannot perform this operation"
why?
thanks!
s.
|
|
|
|
|
I want use a bitmap as the background of a composite control.
What can I do?
If I add a message WM_CTLCOLORDLG, the bitmap will envelop all the composite control, and all the son controls reside in the composte control will invisible.
thanks your help
|
|
|
|
|
You should probably use the WM_ERASEBKGND to draw the bitmap on the background.
|
|
|
|
|
Hello all, I am brand new to COM/ATL programming and am trying to figure out if what I want to do is doable. I've gone through the great DCOM tutorial by Brian Hart and it's given me a good start.
Here's my situation. I've written a (free) port of the boardgame Settlers of Catan using OpenGL for 3D graphics. I recently added networking capability to it and have been cleaning up things according to user's desires. The biggest problem they all have is that my chat window, which is currently a modeless dialog box, loses the focus anytime there is an in-game event, which causes their typing to suddenly disappear in mid-sentence as the focus suddenly gets set to the main window. A screenshot of the game w/ chat window is is here.
My brilliant idea was to rewrite the chat window as a COM object, which would solve the problem of it losing focus since it would be its own window. I've got the basic COM object figured out with a dialog box in it, and a connection point back to the main app for wanting to chat. However, I can't figure out how to connect a CRichEditCtrl to the dialog box, because I don't really understand how CWindow and CWnd work, and do your controls have to be CWindow classes to be used in ATL? The current chat window is a CRichEditCtrl and I'd really like to avoid creating my own control for chatting via the COM object. Can anyone explain this a little better or point me to some resources that do? Thanks.
Jason
|
|
|
|
|
Hi Jason,
Using ATL CRichEditCtrl is about the same than using Win32 API call. If you have used MFC, then this is not really a problem, since it provides about the same interfaces (function name). Even though I didn't see how that would fix your problem (having ActiveX container) since your main
window will still capture the focus with every event. It is better to fix that with the main window, why does it need to capture the focus?
Anyway, just create it:
DWORD dwStyle = WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL;
dwStyle |= ES_MULTILINE|ES_AUTOHSCROLL|ES_AUTOVSCROLL;
m_ctlRichEdit.Create(m_hWnd, rc, NULL, dwStyle);
BTW, when do you plan to release your game? (it looks good)
Last Article:
Adding VBScript/JScript to C++ App
|
|
|
|
|
Thanks for the quick reply! I was thinking about it a little more after writing it and I thought of two ways that are probably better fixes:
1) Write an actual mini-dialog app that is just the CRichEditCtrl chat dialog and have one COM interface that talks between the main app and the chat dialog. Running two different .exe files would guarantee two different windows.
2) Fix the main app (like you suggest) so that it doesn't steal the focus on game events. Honestly, I didn't actually consider it at first because I figured it would be too complex to try and find every instance where it happened, but I may look at this again.
Thanks for the compliment on the game. If you go to the main site, you can download the current BETA version (0.8.8). The game itself is complete, I'm just working on some remaining UI issues and cleanup before a 1.0 release.
|
|
|
|
|
Thanks, did you consider also having your chat window being able to stay on top?
By the way, I noticed that the chat window didn't have 'close' button. I will wait
for 1.0 release. Thanks and good luck!
Last Article:
Adding VBScript/JScript to C++ App
|
|
|
|
|
I want to create an COleDispatchDriver through class wizzard to call an object within a ATL project.
I have tried implement the object both as a CCmdTarget and an Atl Simple object. But to no joy.
When my Project calls the createdispatch method of COleDispatch driver it just fails.
Can anyone offer me any advice.
Cheers
Richard
|
|
|
|
|
I can now call "simple Atls objects" in Atl Projects, i hadn't called AfxOleInit.
But i still can't call CCmdTargets which are in a Atl Dll projects.
|
|
|
|
|
Hello to all,
I'm using ContourCube. I have the following problem. The grid
displays data at design but when I try to run my application it's
empty. Is any idea how i can make it to work?
Thanks in advance
paul
|
|
|
|
|
You need to expose the property in the property map section
BEGIN_PROP_MAP(...)
I guess you want your control to load these properties at runtime!
|
|
|
|
|
Hi all
I have a property page control and i want to insert another "custom control"(like FlexGrid control) in the property page's resource window. I tried making a CContainedWindow of the control inside my property page control. But unfortunately it got too complicated when it comes to handling events and setting properties for the custom control. Can someone suggest me how to do this (perhaps some sample code)or point me to any prev. article/link.
Thanks
srisan
|
|
|
|