|
Rank: Member
Joined: 12/4/2006 Posts: 14 Location: Barcelona (Spain)
|
Hello,
I'm using Authentic® 2007 Browser in a Windows WinForm. I tried to disable the right-button menu but I don't know if exist any function implemented to do that. Or maybe I have to build a wrapper around the active-x and control the click events outside the control?
could somebody help me? I would be very apreciated.
Thanks in advance.
|
|
Rank: Advanced Member
Joined: 9/9/2005 Posts: 483 Location: AT
|
Hello,
Try something like this:
Code:var g_button;
function OnButtonUp() { if(g_button == 1) { objPlugIn.event.cancelBubble = true; g_button = 0; } }
function OnButtonDown() { if(objPlugIn.event.button == 2) g_button = 1; else g_button = 0; }
function OnButtonDoubleClick() { if(objPlugIn.event.button == 2) { objPlugIn.event.cancelBubble = true; g_button = 1; } }
...along with:
Code:<script language="javascript" type="text/javascript" for=objPlugIn event="ControlInitialized">
objPlugIn.attachCallback("onbuttonup", OnButtonUp); objPlugIn.attachCallback("onbuttondown", OnButtonDown); objPlugIn.attachCallback("onbuttondoubleclick", OnButtonDoubleClick);
</script>
|
|
Rank: Member
Joined: 12/4/2006 Posts: 14 Location: Barcelona (Spain)
|
Thanks Paul,
I think it could be possible for a web form, but as i mentioned above I'm working with Windows Form and I can't use your javascript functions as in a web form.
I tried to translate your implementation to a Win Form and I have tried to attachCallback method but it doesn't work well when i register in the ControlInitialized event.
Somebody have more solutions?
Code (It doesn't work!!!)***********:
Code:private void axAuthentic1_ControlInitializedEvent(object sender, EventArgs e) { axAuthentic1.attachCallBack("onbuttondown", OnButtonDown()); axAuthentic1.attachCallBack("onbuttonup", OnButtonUp()); }
Code: public object OnButtonDown() { if (axAuthentic1.@event.button == 2) buttonAx = 1; else buttonAx = 0; return new object(); }
public object OnButtonUp() { if (buttonAx == 1) { axAuthentic1.@event.cancelBubble = true; buttonAx = 0; } return new object(); }
|
|
Rank: Advanced Member
Joined: 9/9/2005 Posts: 483 Location: AT
|
Hello,
You're quite right - sorry, I did miss the Windows Form reference. I'll try to find the time to take a look at this and let you know what I find...
|
|
Rank: Advanced Member
Joined: 11/28/2005 Posts: 93 Location: AT
|
Hi Xavier!
This is possible if you create an own class for the callback:
using System; using System.Windows.Forms; using System.Runtime.InteropServices;
namespace CallBacks { /// <summary> /// Summary description for CallBacks. /// </summary>
public class CallBack { [DispId(0)] public void MyMethod() { MessageBox.Show("OnKeyDown"); } }; }
And then attach it like here:
using CallBacks; ... AxXMLSPYPLUGINLib.AxAuthentic a = axAuthentic1; a.attachCallBack( "OnKeyDown", new CallBacks.CallBack() );
Hope this helps Regards
|
|
Rank: Member
Joined: 12/4/2006 Posts: 14 Location: Barcelona (Spain)
|
Thank you very much dev7 and Paul!!!
I can do it now!!!
Yes dev7!. Your solution for callbacks work fine. I have been all the day to accomplish it. The problems was that it runs immediately in a VS2003 code but doesn't work in VS2005... I had to modify the project assembly to access at the COM object (I found that after one day of continous crashes...).
Thank you very much, again. And I want to say that it have been impressive your attention and the short time to arise the solution. Good, good work!
Xavier
|
|
Rank: Advanced Member
Joined: 11/28/2005 Posts: 93 Location: AT
|
Hi Xavier!
I'm pleased to see that this works for you.
You are right that the code was created using VS2003. I'm sorry that it didn't work right away in VS2005 but I never tested it in the new version in the meantime. Is it possible for you to tell us in detail what you had to change in the assembly?
Regards
|
|
Rank: Member
Joined: 12/4/2006 Posts: 14 Location: Barcelona (Spain)
|
Hi dev7!
As you know, Microsoft is trying to apply new security rules for all applications and a new good practises for coding. In this way, the new AssemblyInfo.cs creates automatically (when you work with VS2005) an attribute named "ComVisible" for COM access.
ComVisible attribute determines how COM clients access managed code. Good design dictates that assemblies explicitly indicate COM visibility. COM visibility can be set for an entire assembly and then overridden for individual types and type members.
If the attribute is not present, the contents of the assembly are visible to COM clients (it's happen in VS2003 assembly). If you want to access in 2005 you have to change the attribute value to true [assembly: ComVisible(true)].
That's all.
With Regards
With Regards
|
|
Rank: Advanced Member
Joined: 11/28/2005 Posts: 93 Location: AT
|
I see. Thank you for sharing this with us.
Regards
|
|
guest |