I am working in an application. In this user enter his email id to get the some application setting.
After some time he will get mail with settings embedded and an apply button. Once user click on that we need to set the setting (in some file or registry).
Desktop application will read the setting(File / Registry) once it is launched.
This is the requirement. My question is,
How to call Win32/MFC application on clicking apply button with setting parameter.
You cannot arbitrarily execute something in an email message for obvious reasons.
The closest integration you could get would be to pass the configuration data as an argument to a custom URL handler in an HTML anchor; your mileage would likely vary wildly depending on browser/email client/webmail service so this is a bad idea.
Far better to simply send the configuration as an attachment with a file extension associated with your application and tell the user to open it, your app reads the config file and your done.
Related
I have a web product that integrates with a another product that runs on Win10 PCs. The core product launches an IE 11 browser session calling to my URL. The core product has a VERY basic parameter set such that I need to setup a local cookie to hold additional configuration data that can be read by my site when the PC connects. Due to how IE is launched on the PC, this configuration needs to be done once per user that logs into the PC. I need an easier way to get the cookie data into every user that uses the PC instead of requiring each user to perform the action that causes the core application to launch my page, stop their process, change to a config screen, enter all the config data, save it, return to the prior screen, and then test the process.
Thoughts? I HAVE to use a cookie and I HAVE to store the configuration data in the cookie due to the core application limitations and site requirements.
Thanks.
Cookie is created for specific user on a machine.
It did not designed for sharing that data with other users whether on same machine or on same work station.
So it looks like your approach for solving this specific problem is not correct. You can try to rethink about it and try to use any other way for sharing the data between the users on same work station.
If you continue with this approach than it can cause security related issues.
I tried to find but did not got any useful information for sharing the cookie between users on same work station.
Reference:
Can one cookie be shared by multiple users logged on to the same device?
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.
I am designing an integration process where my Plone 4 site can share objects and content with other systems when a user decides to publish an object to remote servers. One of the first steps towards making this a reality is adding a "Remote Publish" CMF action off of an ATFolder for instance. I did this in the portal_actions tool provided in the ZMI. I set the URL expression to ${globals_view/getCurrentFolderUrl}/publish.
Now I understand that I need to register the action somewhere to get it to present a form that asks for the remote server address that handles the web service calls. How do I build and send a POST REQUEST with the folder object's new properties and children when the user has clicked the new "Remote Publish" button?
You need to split this problem to subproblems and solve each individually
How to customize Plone
http://developer.plone.org/getstarted/index.html
How to add actions to content items
https://developer.plone.org/functionality/actions.html
How to create a form which asks for a remote server address and where you can program Python logic
http://developer.plone.org/reference_manuals/external/plone.app.dexterity/schema-driven-forms/index.html and https://developer.plone.org/forms/z3c.form.html
How to read folder and object content in Plone
http://developer.plone.org/content/listing.html
http://developer.plone.org/content/archetypes/fields.html#accessing-archetypes-field-value
How to create a POST request in Python
http://docs.python-requests.org/
How to make remote server to handle the incoming request
[not part of the question]
Unless you do not have enough Python and Plone experience this is quite big question to tackle. To solve this problem I suggest you create a new sub-question for every part and solve them independently.
I'm currently using ShellExecute "open" to open a URL in the user's browser, but running into a bit of trouble in Win7 and Vista because the program runs elevated as a service.
When ShellExecute opens the browser, it seems to read the "Local Admin" profile instead of the user's. So for example, if the user at the keyboard has Firefox as his default browser, it may open IE (which is the admin's default).
I know that the "runas" verb can be used to elevate, but how do you do it the other way around? Is there a way to open a URL in the default browser on a standard user's desktop from a service?
ShellExecute will execute the program in the context of the same session and same user as the process you are running.
If you'd like to use a different session or user token you can use the CreateProcessAsUser Win32 API.
There are several ways to obtain a user token, for example you can call the Win32 API:
LogonUser if you know the username and password
WTSQueryUserToken for any given session ID.
OpenProcessToken if you have another process handle
After a while of testing, the best way to determine the default browser is the following:
NOTE: It is strange but it's true...
It has nothing to say that an application is the default application for
some file type or web protocol like 'http'. What matters to determine the default
web browser is just what is registered in the start menu entry (see reg key below).
So forget all the HKCR\http, HKCU\Software\Classes\http, HKLM\Software\Classes\http and their friends.
read from "HKEY_CURRENT_USER\Software\Clients\StartMenuInternet"
read command line from "HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet\\shell\open\command"
truncate the command line after ".exe"
Of course you need to impersonate as the logged on user first.
If this solution does not work (like with w2k), use the handler for the http protocol.
To actually start the default browser from a service we use an extra process which is within the service using the logged on user-context. This process starts the above commandline (using ShellExecute on platforms >= Vista). Be sure to use same integrity level (medium) as a default user (else IE won't work because it uses DDE).
HTH.
Aaron Margosis has a seven-step native code example at http://blogs.msdn.com/aaron_margosis/archive/2009/06/06/faq-how-do-i-start-a-program-as-the-desktop-user-from-an-elevated-app.aspx. Won't help you from your service if that is what you have - I agree your service shouldn't be trying to launch an app as the logged in user, especially since there might not be one.
How can I launch a URL in a NEW window using C++ (Windows only)?
The straight-forward approach seems to open a new tab in an existing browser window. (Or, if tabbed browsing is disabled, the new URL hijacks the existing browser window).
This is for a (large) desktop app, using MFC and Qt.
I've used this for showing locally generated html in the default browser, in my case filename is something like "c:\temp\page.html", perhaps replacing filename with the URL might work??
ShellExecute(NULL,"open",filename,NULL,NULL,SW_SHOWNORMAL);
Updated:
http://support.microsoft.com/kb/224816
How ShellExecute Determines Whether to Start a New Instance
When ShellExecute looks through the registry, it looks for the shell\open subkey. If the shell\open\ddeexec key is defined, then a Dynamic Data Exchange (DDE) message with the specified application IExplore and the topic WWW_OpenURL is broadcast to all top-level windows on the desktop. The first application to respond to this message is the application that goes to the requested URL. If no application responds to this DDE message, then ShellExecute uses the information that is contained in the shell\open\command subkey to start the application. It then re-broadcasts the DDE message to go to the requested URL.
So it looks like you have no control over opening a new window. Whatever browser currently running can handle opening it in whatever way they want.
This is controlled by windows. The only way to explicitly tell it to open in a new browser window is to spawn the browser explicitly and give it the url.
Here's a link to some code that will open a URL in a new browser. The code looks up the default application for handling an HTML document and then explicitly opens that application with a ShellExecute call.
You can't in general. The user's browser is free to do whatever the user wants it to do.
One way to achieve your desired effect might be to embed a particular browser in a window of your own (say, the IE ActiveX control) and have that render your URL.