I need to add one menu item in IE context menu. It is similar with Google customized context menu "Search Google for xxx" when you right click on IE.
I did a research and found that overriding IDocHostUIHandler::ShowContextMenu in a IE BHO can customized IE context menu. The sample project can be found in Popup blocker project published in codeproject. It works well and is easy to implement. However this approach has a problem. The problem is it will conflict with other add-ons' context menu customization per MSDN.
In MSDN Internet Explorer Center forum, there are some discussions about this topic. However there is not a proper implementation posted.
If anybody has experience on this, please share your idea. Thanks!
See Adding Entries to the Standard Context Menu on MSDN.
For some sample code, download and extract the Web Accessories for Internet Explorer 5 (the mechanism still works in IE versions up to and including 8). Look at ie5wa.inf and *.html for examples of various IE context menu extensions.
Note that the abive is achieved without COM, purely via one registry setting and a file containing a blob of script (Javascript, JScript, VBScript etc.) The script (JScript, VBScript) may in turn work with COM objects, should your menu action logic reside in such an object, e.g.
create a HKCU\Software\Microsoft\Internet Explorer\MenuExt\My &Context Menu" registry key (&` precedes the menu accelerator letter, if any)
set the default value for the key to point to a file containing the script code implementing the context menu action(s), possibly interacting with a COM object (must support IDispatch IIRC; also read up on the My Computer Security Zone)
create a binary contexts value (0x02 for images, 0x10 for selections, etc.) which regulates when the new context menu should be displayed
I customized my IE in order to navigate to a selected text. You can read the full story and get detailed source code here.
The hearth of my solution is built around the following javascript code and the Registry key [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt]:
var parentwin = external.menuArguments;
var doc = parentwin.document;
var sel = doc.selection;
var rng = sel.createRange();
var str = new String(rng.text);
if(0 < str.length)
{
if (str.indexOf("http")!=0)
window.open("http://"+str, "_blank");
else
window.open(str, "_blank");
}
Related
I am very new to activeX control and I need to embed adobe activex control in my MFC dialog.
I use the example code in https://www.codeproject.com/Articles/9537/Adobe-ActiveX-Control-with-MFC to implement an Adobe ActiveX control, it works and display the pdf file successfully.
I need the pdf to be displayed without toolbar, navigation bar, bookmark and right click, but the sample code only contains a method like following:
It works for disabling toolbar. But there is no method for navigation bar etc.
I searched online for InvokeHelper(0x3, DISPATCH_METHOD, VT_EMPTY, nullptr, parms, On); and realize that 0x3 is the DISPATCH ID and it is invoking the Adobe API by this ID.
Therefore, I guess there must be other method in Adobe for navigation bar and bookmark etc, but I cannot find the corresponding document about the method DISPATCH ID.
Anyone knows that please ?
I even cannot find any documents about the setShowToolBar method DISPATCH ID.
By reading Interapplication Communication API reference from Adobe, I find out how to close the bookmark automaticlly.
I called SetPageMode(L"none"), it works for closing bookmark.
But I haven't figured out how to close the navigation bar and status bar.
I'm trying to develop an application in Silverlight for Windows Embedded 7, which uses C++.
I was able to run a simple page with a button, which calls another function (a simple Hello world message box).
The great question here is: how can I make a function display another page, defined in another XAML file? All the examples I found online, and even in Microsoft resources, uses a single XAML file with everything done inside it.
Thanks in advance!
I'm a student who is suffering from the same problem now. Hope there's someone to help us solve it.
I have searched and found that FRAME is not supported in the SWE.
I have found an alternative way to solve this problem but I'm not familiar with C++ code.
If you knows how to program in C++, would you please read through this and teach me a bit?
Thanks so much.
You can search for"Create a Custom User Control in Silverlight for Windows Embedded".
You'll found a PDF file released by Microsoft.
With this way you can create a custom user control to hold your "multi page".
I have done this step, and with the control I created, I am able to "hide" and "show" it in order to achieve the "multipage" effect.
In my User Control, I have some more buttons to let users to click. However, from the mainpage which hosting the user control, the buttons inside cannot be detect.
In the PDF tutorial they teach how do we call out the methods in the custom control, but I don't understand the C++ code.
If you can get the user control done make the controls in your custom control function correctly, would you please tell me? thank you.
To do multi-page applications, you need multiple xaml files. Not sure what the Microsoft tutorials you found were referencing, but i am developing an application now which has more than 20 different pages or screens. You need to design the layouts in XAML/ExpressionBlend and then using event handlers and pointers to the XAMl, implement the views in the C++ source code.
// ============================================================================
// LockDataLogger_Click
//
// Description: Event handler implementation
//
// Parameters: pSender - The dependency object that raised the click event.
// pArgs - Event specific arguments.
// ============================================================================
HRESULT MainPage::LockDataLogger_Click (IXRDependencyObject* pSender, XRMouseButtonEventArgs* pArgs)
{
HRESULT hr = E_NOTIMPL;
if ((NULL == pSender) || (NULL == pArgs))
{
hr = E_INVALIDARG;
}
//m_pDeviceSettings_Lang->m_pYear->Focus(false);
if(m_pDeviceSettings_Lang)
{
m_pDeviceSettings_Lang->m_pYear->SetIsDropDownOpen(false);
}
m_pLoginScreen->SetVisibility(XRVisibility_Visible);
m_pLogin_Password->SetPassword(L"");
m_pHome_LoginOptions->SetVisibility(XRVisibility_Collapsed);
return hr;
}
So this is an event handler implementation for when you clock the "Lock" button on the home screen of my device. All you need to do is name your different pages/menus accordingly and based on event handler implementations, using points, set/change the visibility of the different pages. Very straightforward and hope the example code provides some insight.
I have a simple console application written in C++ that acts as a stub for launching another application through it's jumplist. Purpose is to add jumplist abilities to applications that do not support this. Call it stub.exe. When running stub.exe it creates a custom jumplist using these steps (taken right form the MS samples):
create an ICustomDestinationList
ICustomDestinationList::BeginList()
create an IObjectCollection
for_each item_to_add
create an IShellLink, set its path/arguments/title/icon
add IShellLink to the IObjectCollection
get the IObjectArray interface from the IObjectCollection
call ICustomDestinationList::AddUserTasks( IObjectArray interface )
ICustomDestinationList::CommitList()
When pinning stub.exe to the taskbar and right-clicking it, the jumpilst appears and it contains all IShellLinks added. When clicking an item, it will launch the corresponding process.
Now I'd like a process launched through this jumplist have it's window(s) grouped under stub.exe's taskbar icon, instead of having it's own group. They key to get this working seems to be the AppUsermodelID. This is what I tried so far:
just for testing, create a couple of shortcuts and set the id through IPropertyStore->SetValue( PKEY_AppUserModel_ID, "id" ). Indeed, when launching these shortcuts, they will all group under the same taskbar icon.
since the shortcuts do what I want, I tried adding shortcuts to stub.exe's jumplist: no effect. The shortcuts don't even show up in the jumplist (maybe one cannot have a shortcut to a shortcut?), yet all methods return S_OK
setting the PKEY_AppUserModel_ID on each of the IShellLinks that get added to the jumplist: no effect
calling ICustomDestinationList->SetAppID(): no effect
instead of using SubTasks, tried with SHAddToRecentDocs: no effect. The recent doc list does not show up. But now things get messy. After setting the AppUserModelID on the shortcut that is responsible for the pinned taskbar item (the one in %APPDATA%/Roaming/Microsoft/Internet Explorer/Quick Launch/User Pinned/TaskBar), the jumplist changed: it does not show the 'Tasks' item anymore, but does show 'Recent' and the items I added using SHAddToRecentDocs. Now when clicking them I get a dialog box with a title that starts with 'd:\desktop' followed by Chinese characters. Hovering the items in the jumplist also shows Chinese characters instead of the descirption I set.
Questions:
What's with the Chinese characters in the jumplist?
How come setting the app id on the taskbar shortcut toggles between 'Tasks' and 'Recent' sections, why are they not both there?
What would be the way, if even possible, to achive what I actually want: a custom jump list of which the items launched will group under it's taskbar icon? (note that the processes I plan to laucnh their do not have their app id set currently)
not much reactions here ;]
In the meantime I managed to solve the main problem myself; it's not quite a straightforward solution but it fullfills the requirements: a program runs in the backround and installs a CBT hook. Each time an application creates a window (HookProc code = HCBT_CREATEWND), the hook checks the application's path against a map containing paths and desired application ids. If a match is found, the application id of the HWND is set. Since this occurs before the window is actually shown and is combined with the custom task list, from a user's point of view the application behaves just like one that does support a recent/pinned document list.
I have IWebBrowser2 ctrl embedded into my own dialog. I want to simply
display a promo banner within it from my url. How to disable all popup
menu items from the control and force it to open links in new window
(currently when I click on link in the banner, it is being opened
within the same control).
Regards
Dominik
Have a look at the following article:
WebBrowser Customization
I don't know if there is a more convenient way of doing this - but you could always intercept BeforeExplorerNavigate2(), set the out-parameter cancel to true and from there either do a new Navigate() with a different target frame name or open a new window.
As Rob pointed out, there might be problem with filtering out navigate events originating from scripts, see this question.
I have a MFC MDI application that I've recently ported from VS2003 to VS2008, and at the same time moved from Stingray Objective Studio 2006 v2 to v10.1. On the previous versions of my application, if I had more than one view open, the Window menu would be populated by an enumerated list of available views, e.g. 1 MyViewA, 2 MyViewB etc... If I had a large number of views, I would also get a Windows... menu option to allow me to select a view. This no longer happens, which is breaking some of my GUI level regression tests. My guess is that this functionality was implemented by either CMDIFrameWnd or SECMDIFrameWnd but I couldn't find a reference to it in the documentation. Does anyone know how I can get this functionality back.
First thing I'd do is create a new MDI application with the ClassWizard and check if the functionality you're missing is present. If so, poke around and see if you can tell what's different. One place to look may be the menu resource for the main menu.
If there is no in-built functionality to provide what you need, you can dynamically build the menu with the following pseudocode:
foreach registered CDocumentTemplate
foreach document
foreach view
{
if (numberOfWindowMenuItems < 5)
{
Add menu item
}
else
{
Add "Windows..." menu item
break all loops;
}