Simplest way of localizing InstallShield Registry keys - localization

Which is the simplest way to localize the registry keys based on the selected language of an InstallShield setup?
I am thinking about writing an VBS which sets some properties based on the selected language. These properties could be used from within the registry key dialog of InstallShield. But isn't there a simpler way?

Found a way myself.
Instead of writing a vbscript you can add two components. The first components adds the english registry keys and the second one the german ones. In order to use only the correct component during install you can set the condition of the german component to "ProductLanguage=1031" and the englisch component condition to "ProductLanguage=1033".
Thats all :)
Of course it is arguable whether the use of multiple components or a script which changes properties used by only one component makes more sense but by using multiple components you can create your registry keys through the designer. Using a script which changes properties will certainly lead to more errors since the script has to work and every property has to be set correctly. In my eyes its more simple by using the components way.

Related

Modifying Feature name at run time or using environment variable/system property in feature file

I have an automation project that i've recently updated to run both a set of Android and iOS tests in parallel. I've got my report files aggregating ok, but since they're running the same features, the reports at the end can't really identify which ran on Android and which on iOS.
It is a pretty standard Cucumber, Gherkin, Java project. I'm trying to figure out the best way to get the word Android/iOS into the Feature name field, so on the generated report it can be easily identified.
The two options i've thought about are either during the #Before step, to somehow modify the feature name. However, it looks like all of the fields of the Scenario object have getters only.
The second option was if it was possible to reference a system property or environment variable in the .feature file itself. However, I haven't seen any ways that that is possible.
Has anyone tried this before? I can post code as necessary, it is more of a general question of how could I dynamically change a feature name, or alter a feature file itself by environment variable when it runs.
Thanks
I think this similar question may have the answer you're seeking.
Basically, you're going to create your own runner type (or modify the existing one) and inside it set a custom report path.

ActiveX Registration

I'm working on an ActiveX where the same code base should be used to two different ActiveXs, meaning, I have the single solution which is built from several DLLs.
When I build the solution for creating the CAB for ActiveX A, I change the DLLs class IDs to specific ones and when I built it for creating the CAB for the second ActiveX, I changed the class IDs to something else.
I need both ActiveXs to be able to run on the same machine.
Basically, it works fine except for that in certain scenarios where I run different versions of the ActiveXs (ActiveX A is from older code version than ActiveX B) there is un-desired behavior.
It looks like that ActiveX loads some DLLs from ActiveX B (which is from different code version).
Sorry for the long description but last important information, since both ActiveXs come from the same code, I have the same class name which is exposed to the javascript which calls the ActiveX.
In the registry there is total separation in all keys except for the following (NetworkInterface is the exposed class):
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MyActiveX.NetworkInterface\CLSID]
#="{31ED2205-F6AE-4133-AD30-60CA2783ADA6}"
When installing ActiveX I see this entry with the right class ID but when installing the second ActiveX the key is overridden by the second ActiveX.
Is it possible to achieve what I'm trying to achieve?
Is there any way to have the same class registered with different class IDs?
Thanks.
#Lior, You answered your question yourself in this phrase: "to have the same class registered with different class IDs". In fact, we are talking about ProgID's, or programmatic identifiers - MyActiveX.NetworkInterface in your case.
There is just one dedicated registry hive for ProgID's - HKEY_LOCAL_MACHINE\SOFTWARE\Classes\, and if you use a ProgID in your client code to instantiate a component, you can do it only for one ActiveX component. When you create an instance using a ProgID, the corresponding CLSID is determined using that registry hive, and the executable DLL/OCX/EXE which implements that class is used. For the latter case, the corresponding registry hive looks like this:
HKEY_CLASSES_ROOT\Wow6432Node\Clsid{6935DB93-21E8-4ccc-BEB9-9FE3C77A297A}\InProcServer32
The best thing which can be done in this case is to use two different ProgID's for your two ActiveX components. Even if you use the same source code for the main classes, you can use them "as is" in two different projects which are used to compile components with separate ProgID's. It seems, all dev environments (VB6 you're maybe using) allow you to do that.
Some more info about this can be found in this article: http://www.vbaccelerator.com/progid.htm
We had the same issue with our ActiveX components, and our experience tells us that to have different ProgID's is the best choice. Even if you release a next version, change the ProgID. This will allow both versions to coexist in the same OS without any problems, and the developers can upgrade the existing projects step-by-step.
===
As an answer to your question, I have an idea of how you can try to solve your problem if you cannot change ProgID's. As I know, you can activate ActiveX's using directly their CLSID's, and different dev environments use different techniques for that. I do not have your project, but if you use JavaScript, you can try the recipe from this article:
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/08652e9e-7deb-40a3-8c1a-f9becdcbf56e/
In a nutshell, you do not need to create your ActiveX objects using a call like this:
myobject = new ActiveXObject("SAMPLEACTIVEX.sampleActiveXCtrl.1");
You need to put your two ActiveX controls on the page using the OBJECT tag and call the methods of your objects using their names (id's) on the webpage. If you look at an example of the HTML OBJECT tag, you'll see something like this:
As you can see, you can use the specified ID to access the members of the object you exactly need. Many examples of that are already on SO - here is one of them:
javascript: "Object doesn't support this property or method" when ActiveX object called

A CSV Import/Export wizard for Delphi?

To avoid reinventing the wheel, I'm looking for some dialog wizard components/libraries that will simplify my job of importing CSV and similar text files into my Delphi/C++Builder application.
In other words, the user of our app can 'open' a suitable text file, and they can 'describe' through the UI how the columns are laid out and how the file columns relate to the datafields that our app offers.
Basic requirements:-
Handle different newline styles
Handle Tab, Comma and user-specified fixed-width columns
User definable column ordering with visual preview of results
Handle optional and mandatory columns
Extra goodies:-
Be able to save all settings as a 'profile' that can be easily reapplied later.
Try these two components
EMS Advanced Data Import VCL
EMS Advanced Data Export VCL
SMImport comes to mind : http://www.scalabium.com/
My text streams classes in the unit CsiTextStreamsUnt.pas (you can download the utility classes at http://www.csinnovations.com/framework_utilities.htm) provide the basic functionality to cover everything you need. All you would need to do is develop the GUI.

How to use project version information inside a Delphi application?

I use Project Options / Version to manage the version info (N.N.N.N format).
Anyway inside my project I duplicate those info.
So if in project options I am working on release 2.4.3.178
inside my application I have 4 integer variables that hold the 4 numbers.
I manually set them
Major := 2;
Minor := 4;
Release := 3;
Build := 178;
The reason of this is simple: I have licensing based on version number. So if the user buys release "2.4" it is not allowed to upgrade to version "3.0".
But if I rely on project version info the user can (with Resource Hacker tools) change the version info and therefore "activate" the product.
The user cannot change the 4 variables in the same way (not as easily at least).
This works but forces me duplicate the info.
Could you suggest a better approach?
Otherwise said: is there a way to write the version info using the data I write in those 4 variables. Something like in Post Build Events, but how do I pass data to post build events?
You'd need a pre-build event rather than a post-build event since you'd want to get the .res file built before linking.
I do something very similar with a simple Perl script that reads an include file (.inc) containing constant declarations of the version numbers. I read them in using a regex and then create my .rc file which I pass to brcc32. It's all invoked as a pre-build action.
Since you're on Delphi-XE and have Final Builder, why don't you put it to good use and make your "final" build from it? It can give a very nice solution to the version number problem, and can do a lot more.
Here's how I'd do it.
Set up a small INI file that holds the relevant parts of the version information.
Optionally make a small Delphi forms application that reads the version number from the INI files and gives you a chance to change it. When changes are saved to the INI file, the delphi application should automatically generate a small Delphi PAS file that defines the constants!
Create a FinalBuilder project that does the following:
Calls your Delphi exe to set up version number. You'll be in charge of changing whatever needs changing, and this is probably appropriate since your licensing scheme depends on version information.
Set up a few project variables to hold the version information numbers
Add "Read INI file" actions to read the version information from the ini files into your project variables.
(optional) Build the unit test project, if you have one.
(optional) Call the unit test project.
Add a "build Delphi project" action, set it up to build your project using whatever options you need. Add a small "Before" script to set up the version information numbers to what you've got in the project variables you just read from the INI file.
(optional) create setup packages using whatever tool you use.
(optional) upload those setup packages to a website.
In other words, take the opportunity to start using Final Builder.
Moving your version numbers into code is also easy to get around.
One way to pass the information is to generate a version.rc file programmatically (you write a tiny build tool yourself using delphi or a scripting language of your choice), and link the resources to the program, instead of using the built in version-info feature.
Your question seems to be fundamentally a matter of preventing the user from modifying (easily) the version number once you have determined it.
So my suggestion is that you encrypt the version number and you use the encrypted version, instead of the version in the VersionInfo structure.
I have used DCPCRYPT for things like this. But if you hope to be hacker-proof let me just say this; Anything you can do, hackers can undo. If you want to be more secure, you will also need to tamper proof your whole application. There are commercial tamper proofing solutions but none work fabulously out of the box with Delphi.

Elastic tabstop editors and plugins

What Windows code editors allow the use of elastic tabstops, either natively or through a plugin?
I know about a gedit plugin, but it only works on Linux.
Code Browser may be the first for windows. I would love to see this feature as a plugin for other editors as well.
I did quite a bit of googling trying to find this answer. There are plenty of people asking for it:
http://developers.slashdot.org/comments.pl?sid=414610&cid=21996944
http://www.arguingwithmyself.com/archives/75-the-biggest-feature-your-editor-is-missing
http://intype.info/blog/screencast-parser-in-editor/#comment-221
http://codewords.wordpress.com/2006/10/16/eclipses-achilles-heel/
just to name a few...
so I don't think one exists yet, sorry :(
Code Browser supports elastic tabstops, but it appears to be the only thing for Windows that currently supports it. Unfortunately, it has an unusual UI which may render it unsuitable for multi-person projects, and may even make it difficult for you to use even if no other editors are involved.
According to the elastic tabtops website, he's working on plugins for eclipse and Visual Studio 2010 (though the Eclipse plugin is stalled pending a bugfix, and jedit should support elastic tabstops in an upcoming version.
Finally, though this probably isn't an option, you could try running an x server (such as Cygwin/X or Xming on your Windows computer and ssh into a Linux client (either a virtual machine or another computer) to run Gedit. This approach has many problems though: you need to keep your files on a separate computer (perhaps using Dropbox to keep them in sync), X over SSH is notoriously slow, and you need either another computer or a virtual machine.
XMLQuire is an XML editor developed for windows to showcase virtual formatting. This concept goes a step further than elastic tabstops, indentation is simply a function of the position of the preceding line-feed character and the nesting level and context assessed by the parser:
It's the XML parser that determines the nesting level and therefore the required indentation, there's no reformat key or tab key to press, the XML formatting just reflows as you edit, drag and drop etc.
This means that XML is always properly indented, but without leading tabs or spaces. The concept should also work for more conventional code (except for languages like F# that exploit whitespace), but this has not yet been tried out.
Note that, unlike elastic tabstops, virtual formatting only works from the left-margin and only uses the parser context. The parser context is more than just about nesting level though, factors such as mixed content, node-type, length of parent element name and attribute name all come into the equation. This allows alignment of attributes and attribute values that occur on new lines also (as shown).
Word-wrapped text naturally just fits to the indentation scheme. If further text formatting is required then space characters are added by the user in the conventional way.
As with elastic tabstops there's a potential issue when virtually formatted text is opened in a more conventional editor. However, because no characters have been added for XML formatting (it was all virtual), conventional editors can simply apply conventional formatting according to the settings for that editor, uses tabs or spaces.
Here's a elastic tabstop plugin for Visual Studio 2010 by ferveo (Ramunas Geciauskas):
http://visualstudiogallery.msdn.microsoft.com/ccff2b55-201f-4263-aea5-3e66024d6c0e
Another option is jedit which has already added support for elastic tabstops. It is available on Windows, Linux, OS X, and Unix.
The problem is that only a few toolkits/platforms have text widgets that offer the ability to set non-uniform tabstops on different lines. To my knowledge, those toolkits/platforms are Java Swing (used by the demo on the elastic tabstops page), GTK (used by Gedit and the Gedit plugin), and apparently the new version of Visual Studio (VS 2010).
Expect to (eventually) see more developments on all of those platforms.
Textadept has an elastic tabstop plugin.
Atom also has a plugin.

Resources