Error while disabling the toolbar and menu bar in InfoPath

Error while disabling the toolbar and menu bar in InfoPath

Post by Reetu Agar » Wed, 13 Apr 2005 03:22:51


Hi All,

I was using jscript to disable the tool bar and menu bar in infopath. I had
some issues with converting the form to fully trusted.
So I thought of using managed code to disable the toolbar and menubar.
When I try to run the form I get the following error:

System.Security.SecurityException
Security error.
at InfoPathProject2.InfoPathProject2.OnLoad(DocReturnEvent e)
at
Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad
(DocReturnEvent pEvent)

Below I have listed the code I am using

********************************************************
// Write your code here.
BindingFlags MethodFlags = BindingFlags.InvokeMethod |
BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance;

ObjectWrapper commandBars = (ObjectWrapper)
thisApplication.ActiveWindow.CommandBars;

object[] args4 = new object[] {10,30003};

CommandBarControl commandBarMenu = (CommandBarControl)
commandBars.InvokeByName(
"FindControl",
MethodFlags,
args4,
null);

commandBarMenu.Enabled = false;

**********************************************

Do I need to convert the form to fully trusted whe I am using managed code?

Regards,
-Reetu

--
Message posted via http://www.yqcomputer.com/
 
 
 

1. how to disable toolbar address bar, menu bar when user open a page?

2. how to disable tool bar,menu bar, status bar?


Javascript cannot do it either [1].

Restricting chrome when a new window is opened can be attempted, but
pop-up blocking, user veto of such actions and content inserting
re-writing proxies stripping the chrome specification strings make the
outcome uncertain, to the point of many never opening the window at all
(rendering any web page displayed in it non-viable).

Richard.

[1] Netscape/Gecko browsers have a facility for switching chrome in the
current window but it requires security privileges that are not normally
available to an Internet page. IE provides no facility at all.

3. how to hide toolbar, menu bar, address bar, other non-essentials.

4. I've lost the Menu Bar, Address Bar, and all other toolbars...

5. Customize Address bar, Toolbar, Menu bar

6. PDFMaker and Toolbar / Menu Bar having blank menus

7. Disable Delete option from all menus, toolbars, context menus

8. Disable Start Button, Task Bar and Menu Bar

9. Disable menu item in entry application menu bar

10. How To: disable 'Save As' menu option in the menu bar of IE

11. Add-ins like Google toolbar disabled when IE opened from Outlook m

12. A2003 - custom menu bar problem with multiple log ins

13. Outlook menu and tool bars freezing, and add-ins

14. Disabling Add-Ins, plug ins