Windows registry. Start single instance (not many) of application. - contextmenu

I have created a .NET application and I need to add a reference to it, to windows context menu.
I've did it this way: added HKEY_CLASSES_ROOT\*\shell\myapp\command to my registry.
It works but starts the same number of instances of my app as the number of files I selected. I really need only one instance of the app.
To start and collect the parameters of all the rest instances, I have implemented mutex. But I don't think that this is the right way.
For instance, I have watched 7-zip performance in procmon when I select multiple files -> context menu -> add to archive. Only one instance of 7-zip started. I guess the logic of single instance app when you select multiple files -> context menu -> my app should be done in registry. Could not find any usefull tutorial. Thanks!

Related

JBPM 6.0.1 adding custom task to workbench

I've created task in ecplise which calls DB stored procedure. I've written WID and Work Item Handler for this (running from eclipse works). But now I would like to add this task to workbench to let workbench users creating processes with it. How to do it?
Can you please elaborate a little bit more about what you are doing?
Take a look at this blog post to see if it answer your questions:
http://salaboy.com/2013/10/22/kie-wb-jbpm-console-ng-configurations/
Create a new process and open it in designer. After doing that, you should also see a work definitions file being created in the same folder (by default with 4 predefined service tasks), if you open that, add your custom wid and save, reopening the process should show your custom service task in the palette under the service tasks category.

ExcelDNA Memory Space

I am writing an application that has multiple potential user interfaces and I am using MEF to inject the appropriate implementation during startup. One implementaiton of IDisplay uses ExcelDNA (Excel is the interface). The code launches Excel as a process through
var processInfo = new ProcessStartInfo
{
FileName = PATH_TO_EXCEL,
Arguments = PATH_TO_EXCELDNA_ADDIN
};
Process.Start(processInfo);
This works fine except that Excel is now in a seperate memory space so UI callbacks (i.e. Ribbon button clicks) cannot get access to any injected or assigned properties.
One possible solution is to launch Excel first then have ExcelDNA's AutoOpen() hook (which gets called once the add in has loaded in Excel) call the bootstrapper class to configure MEF however I'm wondering if it is possible to share memory between the C# and Excel processes? Would starting Excel via Excel.Application app = new Excel.Application { Visible = true; } resolve? I would try this but have not been able to find out how to specify the path of the ExcelDNA addin for it to load (like above).
Excel will always run as a separate process. So you can't share memory between the Excel process and another process. However, C# code can run inside the Excel process - this is exactly how an Excel-DNA add-in works.
You can also communicate between the Excel process and some other process. One option for this is to use the COM Automation interop - this is what you're doing when you call new Excel.Application from your own executable. You are starting a separate Excel process (or connecting to an existing running process), and then getting back an inter-process communication proxy (the Application object).
If you then want to tell that Excel process to load an Excel-DNA add-in, you can call Application.RegisterXLL(path_to_add_in) to have it load the .xll. How you hook up the Excel-DNA add-in and the rest of your code is still to be figured out.
You might still need some kind of cross-process communication, like .NET Remoting, WCF with named pipes or something like that.

Windows installer self-healing using ProvideComponent

I have an application(app1) that uses another application(app2)'s DLL to do some things. The problem is that I need to have some current user registries set for the DLL to work. If I call app2 from the advertised shortcut it will invoke windows installer self-healing and populate its registries. However if I've just installed app2 from another user,logged in for the first time, and used app1 it will fail as the DLL will not have it's registries populated.
With this in mind I tried to use the Self-Invoked Resiliency method to trigger MSI self-healing.
The "HKCU" feature is the top feature containing a single component "HCKURegistry" which only contains registry keys. The keypath for the "HCKURegistry" component is a key in the HKCU hive.
I'm using Delphi XE3 and here is the line of code:
szProductCode :='{293A0959-6ECF-4026-929B-ECC777934525}';
szComponent:= '{45282475-634F-4222-81BA-030FA63703BD}' ;
MsiProvideComponent(pwidechar(szProductCode),pwidechar('HKCU'),pwidechar(szComponent),INSTALLMODE_DEFAULT, lpPathBuf,#pcchPathBuf);
When, however, my app1 executes this line the Windows Installer displays a windows installer "Preparing to install..." window and stays like this forever. If I click "Cancel" it says "Canceling..." and stays like this until I kill the app from the task manager.
The Event log shows two items:
Detection of product '{293A0959-6ECF-4026-929B-ECC777934525}', feature 'HKCU', component '{45282475-634F-4222-81BA-030FA63703BD}' failed.
Detection of product '{293A0959-6ECF-4026-929B-ECC777934525}', feature 'HKCU' failed during request for component '{45282475-634F-4222-81BA-030FA63703BD}'
A possibly relevant information. When I trigger the self healing the normal way I get the same two lines but the second one has additional sentence (the keypath registry key for the component):
Detection of product '{293A0959-6ECF-4026-929B-ECC777934525}', feature 'HKCU', component '{45282475-634F-4222-81BA-030FA63703BD}' failed. The resource 'HKEY_CURRENT_USER\Software\MyData\SomePath' does not exist.
I moments of desperation I tried using:
res:=MsiReinstallFeature(pwidechar(szProductCode),pwidechar('HKCU'),REINSTALLMODE_USERDATA);
And swapping INSTALLMODE_DEFAULT for REINSTALLMODE_USERDATA in the MsiProvideComponent call. Both behaved differenty in that they did not put anything into the Event log. Otherwise they both stuck in "Preparing to install..." just as the original call...
I'm stuck on this for a while now. Can someone spot what I'm doing wrong?

ASP.NET MVC failed to deploy on Windows Azure

I'm trying to upload an ASP.NET MVC 3.0 application to Windows Azure. The upload ok but the configuration (automatic operation just after upload) failed.
Any idea ? (I'm new in Windows Azure)
In the new portal you have to explicitly check a check box to allow deployment with less that two instances:
There is absolutely no obligation to use 2 instances. There is only SLA that comes into place only if you have 2 or more instances. I have production roles with 1 instance and I am very happy to use the Windows Azure services.
UPDATE
Just ntoed the "Linked Resources" comment on the first answer. So here are my 2 cents on it too: Linked resources feature is just a way for us developers to have a quick overview of our application and to quickly navigate between the components. There is nothing to do with our application's configuration files. You can set your Windows Azure SQL Database connection string as you normaly do with regular apps - in web.config (web.release.config)
The answer is right there in the second screen shot.
When you upload your package from the portal the dialog has a checkbox at the bottom that says "Deploy even if one or more roles contain a single instance" That needs to be checked if you are choosing to deploy to a single instance.
This is required since the SLA cannot be maintained with a single instance. There are times when the single instance needs to have OS updates applied or sometimes there are hardware failures. Having more than one instance is the only way to continue serving requests when one of these events occur.
You probably will not want to deploy a production solution with a single instance. But, for the dev cycle you can certainly get by with 1.

ActiveX Control always working on my machine - unpredictable behavior on others?

I have a question about my ActiveX control not always working in IE on other machines.
Context: I'm working on an internal app for my company. It is designed to be a standalone web-page config tool for viewing a static customized version of our web app. The user may select the colors, images, and other settings they would like to see, and these will be present in the static mockup/preview version on their machine when they click a button.
Implementation: my javascript file creates a filesystem/activex object that essentially creates a temporary javascript file to which a list of values are written. Then when the user previews the configuration, the javascript file is located and values are loaded dynamically into the dom, etc etc. Naturally this functionality only works in Internet Explorer and is shady at best, but is my only way of implementing a purely zero configuration, client-side dynamic webapp.
Problem: When I test out my script, Internet Explorer prompts me twice about ActiveX controls and I say "yes" to them and the ActiveX functions work. I do this every single time I open my page. But sometimes when I send the file to another person so they can use it, they don't get the notifications so it doesn't work. However sometimes they do get notifications and it does work! I am using default security settings for IE so there should be no difference between my settings and theirs.
Could this be related to my user permissions vs theirs, or the fact that the files are read-only (because they are coming from source control and are also being made read-only when put on the shared drive.) or unknown dark Microsoft forces beyond human comprehension?
Thanks,
Josh
I believe you may want to create an HTA (HTML Application) instead of a web page. Writing HTA's gives you more privileges as far as ActiveX objects are concerned. Check out this page from Microsoft: http://msdn.microsoft.com/en-us/library/ms536496(v=vs.85).aspx.
To answer your question about privileges, I believe that some of your coworkers' IE settings probably prevent web pages from using ActiveX objects. Your settings may be such that you are prompted whenever ActiveX object are about to be created.

Resources