Creating a dialog Window in a native Outlook add-in - visual-c++

I'm creating a native C++ Outlook add-in (.dll) and started my Visual Studio 2013 project using MS guidance. The idea is to get user input from a dialog box when the user clicks a Ribbon button and then act on the input after the dialog closes.
Where I need help is creating a Window in the ButtonClicked function. I've tried all the wrong ways which include MFC class wizard and ATL window (CAxDialogImpl). The common denominator is I don't have a valid parent window to create another window. Even if I get an active window handle from outlook.
Ideally, I wouldn't take a dependency on MFC but will use it if necessary. I'm looking for assistance creating a dialog/window, any ideas on how to achieve this?
I get C#/managed is the way to go, but the requirements dictate otherwise.

QI the Application.ActiveWindow property (it will be either Explorer or Inspector object) for IOleWindow and call IOleWindow::GetWindow().

Related

Custom Pane In Excel

I am trying to create a custom static pane on the right side. so it shall be independent of zoom and scroll function in excel. please see the image for more. I tried the following. but no success.
I not sure whether the split-screen function in excel can help to achieve this.
Please note: I want to do it in page layout mode. as I was to set cell sizes in inch.
I tried the following.
ActiveSheet.Range("H1").Select
ActiveWindow.FreezePanes = True
ActiveSheet.Range("H1").zoom = False
I have no idea to make it work, as I am new to VBA. I need a user interface something like in the picture below. so I can scroll on the left but static part on right. in the static part, I would be able to add custom controls like Combobox, command button, TextBox, etc. Thanks
You have 2 solutions:
VSTO Taskpane add-in:
Custom task panes give you a way to create your own task pane and provide users with a familiar interface to access your solution's features. Custom task panes let you integrate your features into a familiar user interface. You can create a custom task pane quickly by using Visual Studio tools.
Document: https://learn.microsoft.com/en-us/visualstudio/vsto/custom-task-panes?redirectedfrom=MSDN&view=vs-2019
Office JS Taskpane add-in:
You can create an Office Add-in by using the Yeoman generator for Office Add-ins or Visual Studio. The Yeoman generator creates a Node.js project that can be managed with Visual Studio Code or any other editor, whereas Visual Studio creates a Visual Studio solution. Select the tab for the one you'd like to use and then follow the instructions to create your add-in and test it locally.
Document: https://learn.microsoft.com/en-us/office/dev/add-ins/quickstarts/excel-quickstart-jquery?tabs=yeomangenerator

Cannot switch between popup window and Excel for Mac

I have made an Excel add-in, which pops up a window either by window.open or Dialog API.
I just tested it in Excel for Mac: when the window is opened, it seems that we can NOT put the focus back to Excel or the add-in taskpane; we have to close the window before choosing Excel or the add-in taskpane.
Does anyone know if there is a way to enable switching focus between popup window and Excel?
The dialog window is a modal in nature that forces the user to interact with it before they can go back to using the parent add-in/Office host. For interaction that requires back-n-forth with Excel, task-pane is the right place for UI.
The dialog API is meant to always show the dialog on top of other items. In terms of modality, you are correct that in Windows the dialog allows you to still interact with the spreadsheet while in other platforms, like Mac or Online is fully modal (cannot switch back to the spreadsheet). My recommendation is to design your add-in accounting for multi-platform so assume the dialog is modal in all platforms. As Sudhi recommends in his response, if your interaction requires the user to use the add-in and the spreadsheet back and forth, using a pane is a better model.

How to customize the Excel Function Wizard?

I would like to customize the Excel Function Wizard, for instance by adding some buttons to the window and/or by firing a new event when the user press the OK Button.
I know that It is possible because the Bloomberg Excel Add-in implemented it.
I found no information about it on the web. I guess that I have to intercept calls to the Windows API and to play with the handle of this window to achieve this but I'm not sure. I see no way to do it via the Excel COM API or the Excel C API but I may be wrong.
Does anyone know how to do this ?
ps: I'm taking about the following window :
EDIT
See below a screenshot of the Bloomberg Wizard with a hyperlink for the optional argument that open a new window (not natively supported by the Excel C API)

Keyboard Tab not working when cdialog application with CREATE method but working fine with DOMODAL

I have one MFC Application. there is one CBUTTON. I had write code create CDialog on CBUTTON click. If i am use DOMODAL method for creating cdialog then keyboard tab working fine but if i am use CREATE method then keyboard tab not working.
You probably are not calling the IsDialogMessage, which is required to ensure that modeless dialog boxes process keyboard input correctly.
This is not necessary with modal dialogs (i.e., those created by calling the DoModal method) because Windows handles it internally.
This doesn't make much sense as an explanation, though, because you're using MFC, which should ensure that IsDialogMessage is called in the message loop for modeless dialogs. That's the whole point of using a framework: it keeps you from forgetting details like this. I can't guess why it isn't working like it should for you; you didn't show us any code. Note that the Visual Studio wizards write the correct code for you automatically. It's recommended that you use them when adding new dialogs to your app.
Joseph Newcomer's article on Creating a Modeless Dialog Box with MFC might be helpful reading.

vb.net How to prevent modeless form from being blocked by modal tool dialog in ArcMap?

I have a vb.net project running as a toolbar extension in ArcMap. Each one of my tools opens a modal dialog using the .ShowDialog() method. My client wants to be able to open a PDF document from the tools that will serve as the help documentation tool rather than a traditional method like HTMLHelp or Windows Help Viewer.
So, I've imported the Interop.AcroPDFLib.dll and set up a form with an AxAcroPDF (veiwer) object on it. Whenever the user clicks the help button on any of the tool dialogs, the help form opens using .Show() and goes to the associated page in the document using the .setCurrentPage method. Everything works great up to this point.
However, as you can imagine, because the tool dialog is modal, it blocks the user from being able to interact with the PDF form. So, what I need is a technique to prevent this block so that the user will be able to scroll pages, click links within the PDF, etc. while the tool dialog is open. I.e., I need a solution that will mimic using the traditional HTMLHelp veiwer.
I've tried opening the PDF form in a new thread, but that causes ArcMap to crash at Application.Run(New PDFForm). Maybe this is because I have very little experience with multithreading, or maybe because ArcMap does not support multithreading. Not sure.
Anyway, any suggestions to get me started would be greatly appreaciated.

Resources