C++ mfc create a mail sending button? - c++

is it possible to create a button in C++ MFS dialog based document so that after pressing that it sends some data to your email?

You can use the functions that come with the MAPI ActiveX control, to send an email. I had done this in Visual C++ 6.
Edit :
The ActiveX control does not show up in the toolbox on Visual Studio 2010 , so you have add them.
You need to add both the controls. After adding the controls, create a variable for the controls and the respective classes shall be generated .
Mapi Session to keep track of the session - Logon / Logoff
Mapi Messages to compose the message and send them.

Related

Can we create a custom notification popup for Microsoft Teams's application

Can we have a custom notification popup for Microsoft Teams's application; similar to below but with customized buttons.
If you want to get a pop up in team chat window you can use Task module deeplink. If you want to get a popup in a meeting then you can use Content Bubble.

C++ Outlook MailItem replace body and discard on close

I have an addon in Outlook which adds warning to mailbody and links in the email when email is coming from external or untrusted sources.
Anyway, when I replace something in body, when email is opened in full view (no reading pane, double click full view of mail item), I hook mailItem close even and I discard changes, everything works well. (mailitem.onclose(olDiscard))
When I do this with reading pane on, when I discard the changes, Outlook still either saves the changes or when user is trying to close Outlook it asks user "Do you want to save changes to ....." and if user clicked on multiple emails during this period, it shows popup question for ALL emails user clicked and we replaced its body.
What's the solution here? What can I do to fix this? I want to make changes to link and to body, but discard them when user clicks away on another email. End goal is not having Outlook to ask user "Do you want to save changes ..." popups. Please advise.
I can't also make changes to inspector, because inspector is read-only.
P.S. plugin is written in C++.
The solution is to avoid modifying the message body if you do not want to keep the changes.
If you want to show a warning to the user, add a task pane to the inspector. Or simply stamp the message with a category - it will be shown in the inspector.
The Outlook object model doesn't provide anything for handling hyperlinks clicks. As a possible workaround you may consider implementing the following functionality:
When the item is selected or opened in Outlook you may replace the original URL with your own where you can pass the original URL as an encoded parameter if needed. So, if it is allowed to open the URL you can redirect the request further. Note, you can use the SelectionChange event of the Explorer class which is fired when the user selects a different or additional Microsoft Outlook item programmatically or by interacting with the user interface. This event also occurs when the user (either programmatically or via the user interface) clicks or switches to a different folder that contains items, because Outlook automatically selects the first item in that folder. However, this event does not occur if the folder is a file-system folder or if any folder with a current Web view is displayed.
Also you may consider handling the Open event of Outlook items which is fired when an instance of the parent object is being opened in an Inspector. When this event occurs, the Inspector object is initialized but not yet displayed. The Open event differs from the Read event in that Read occurs whenever the user selects the item in a view that supports in-cell editing as well as when the item is being opened in an inspector.
Another possible solution is to register a custom URL handler. So, basically, your registered application will be launched instead of a web browser where you can decide whether to launch a web browser and follow the URL or not. See Installing and Registering Protocol Handlers for more information.

CDHTMLDialog : Notification not received when HTML loaded via Frameset tags

I am using CDHTMLDialog from MFC to get Click notifications from HTML Element in Web pages. However I am not getting any notification, if the Webpage has Frameset Tags. Please let me know the steps on how to get notifications.
Thanks,
Edwin.
The MFC DHTML event macros are not designed for elements inside frames. The MFC implementation only look for elements in the top level document.
Hook up the event sink manually with the MFC source as a reference. See Handling HTML Element Events and How to get the WebBrowser object model of an HTML frame

Web Browser control in C++: Detecting mouse click on specific button

My C++ application is using a web browser (IE) control. I need to detect when the user clicks a button on a specific web page (using the element ID of that button).
How can I do this? I already have an event sink implemented, but I do not know how to catch mouse click on DOM elements.
The event you are looking for is probably related to:
onclick event
But whether this is accessible from the MS IE API from C++ via EventSinks, I don't know.
Other Round-About Way to Get Click Information to Your C++ Code
I am not an expert on it, but companies like UserZoom, analyze the information by inserting Javascript via a plug-in to the web browser. Here is a quote from their FAQ of how they collect the click-streams:
UserZoom FAQ
Data Collection & Tracking
What type of information is UserZoom
capable of tracking during the tasks?
With the plug-in version or non plug-in with JavaScript tracking code,
UserZoom can track participants’ navigation paths as well as where
participants have clicked on pages throughout the tasks (heatmaps).
With the non plug-in version, navigation paths and participant clicks
cannot be captured.
Now with this knowledge, go find a javascript library that can get the clicks and the document object model info.
Google Search: "how to get where the user clicked element in javascript"
How to get the target element when clicked?
StackOverflow: JavaScript: Get clicked element
Then you need to insert that bit of javascript into the webpages into the browser the user is using.
Adding Javascript with an add-on/extension/plugin in Firefox and Chrome is relatively easy, I've heard, but for IE, I think you have your work cut out for you to create the add-on in IE. After much searching I found this:
Inject HTML and JavaScript into an existing page with BHO using MS Visual Studio 2010 and C#
And lastly, get that information out of the javascript and into your code using JSON or AJAX and setting up a local webserver to receive it:
Google Search: receive ajax c++
Jquery Ajax Calling Functions
AJAX and the C++ Programmer
Hopefully that information gives you a starting point. Good luck.

MFC : How to capture a link click event in a web browser control?

I have an MFC application that has a webcontrol. When clickable links are clicked, it opens using IE, not the default browser.
Questions :
Is there a way to force it to open using the default browser?
If not, how do I capture the Link Click event so I could just manipulate the click event later?
Thanks...
No, not as far as I know.
Check out the articles on http://ehsanakhgari.org/article/visual-c/webbrowser-goodies . It has a number of articles that show how to set up an event sink using IDocHostUIHandler etc. to handle events like clicking of links. I'm not sure which interface to implement, it's been years since I last did this. Then, you use ShellExecute() with a url as the third parameter to open a url with the default browser.
You can capture click events by using "HRESULT STDMETHODCALLTYPE Invoke" see MSDN for more details.
And here's a great example that shows how to open your URL using the default browser in the same window, or opening a new window > http://www.codeproject.com/KB/IP/urlnewwindow.aspx