I have been trying recently to create a simple installer using Visual Studio .Net 7.1 setup project.
All i needed my installer to do was to run a simple program from a shell. I didn’t need any program folders, registry keys and of course no entry into the Add Remove programs. Such thing is simply impossible! I ended up creating a dummy installer class, to use it as a custom action during install. What i did in that installer class was simply to throw an InstallException so that the installation rolls back and thus not getting the entry of my installation into Add Remove programs.
Next problem was that i didn’t want the user to know about this intended failure. I tried to play with the installers gui but things there are sort of ‘hardcoded’ so you can’t change the messages of your installer’s Finish screen. One sollution that came to me was to erase all dialogs (since i required no input from the user during installation).
All the above was quite a mess for a simple almost do-nothing installer. Among other things, due to the use of the installer class i created, the user of the installer was also required to have the .Net Framework 1.1 on his system!!!
Finally i used Inno Setup and everything was ready in minutes. In specific the functionality in wanted (no entry in Add Remove programs) was simply one checkbox.
What a mess…
Here we go again with another usefull piece of code. The following code is for determining if the user that runs your application belongs to a specific group. In the following example i check if the user belongs to group ‘Administrators’
The following code applies in Namespace System.Security.Principal
Dim user As WindowsIdentity
user = WindowsIdentity.GetCurrent()
Dim principal As New WindowsPrincipal(user)
If Not principal.IsInRole(“BUILTIN\Administrators”)
MsgBox(“Sorry you have to be an administrator”)
Ok that’s it. In VB .Net 2005 there is the My.User object which provides such functionality, so there is no need to do the above.
Happy coding 🙂
Ok i know it’s a big title … but it describes the problem.
Lets say that you have a C++ class and you wrap it using swig. Now you decide to inject some code of your own into the constructor wrapper. If you try defining a typemap(out) you will not succeed. Instead the way to do it is this:
Β #include “MyClass.h”
%feature(“ref”) MyClass ” Here between the quotes add your code ”
Well that’s it. Let me note, in case you are not aware, that the above code should go inside the *.i file that will be parsed by swig. You have now managed adding extra code into the _wrap_new_MyClass function that wraps the costructor of your class. Keep in mind that the above solution goes if you are targeting Ruby. Perhaps for other scripting languages you can add code into contructor wrapper function using %typemap(out) MyClass*, but that doesn’t work for Ruby. The above case is valid for swigwin-1.3.27 that i use currently.
If you need badly to use LoadResData in .Net VB you will have to use the VisualBasic.Compatibility namespace. This also applies to otherΒ VB6 functions that areΒ notΒ supported in .Net VB any more.
First of all right clickΒ onΒ your project in the solution explorer pane. Choose add reference and in the tab named .NET choose the ‘Microsoft Visual Basic .Net Compatibility’ and press select button. Then press ok.
Now write Microsoft.VisualBasic.Compatibility.VB6.LoadResData (…) and do whatever you want. If you don’t want to constantly write all the above extremely long line you can go to your project’s properties, select Common Properties->imports on the left window and add the namespace Microsoft.VisualBasic.Compatibility.VB6 into your project. After that you can directly write LoadResData(…)
Ok. Firebolt is ready again for major changes. Next releaseΒ willΒ be 0.3v which will not be refactored dramatically again (lets hope). It has been a little unpleasant geting breaking changes with each new release.
EasySockets is the new feature as you already know. It is a simple mini socket api. It is asynchronous in receiving data. It is synchronous in sending. It also supports sending packets. So if you tryΒ to send a packet of 1K size then the other socket will receive an OnRead event with exactly 1K size of data. This is not quaranteed by the Tcp/ip protocol, since it is a stream protocol. If you send 1K data using tcp/ip it is not quaranteed that the receiver will get it all with one recv() and not in 3 or more portions of various sizes.
Thus after a lot of troubles Firebolt 0.3v will beΒ even more robust and reliable.
Here is a usefull link for all those who make deployment (setup) projects using visual studio.
It is a list of properties that can be used for Launch conditions.
Based on the above info i will give you an example.Β If you want to create an installer that only the administrator will execute, you can create a launch condition and in it’s property ‘Condition’ place ”AdminUser” (without the quotes). If you read the above link you will know that AdminUser is true if the current user executing the installer is an administrator. If this condition fails then a dialog box appears containing the error message that you provided in the property Message.
Soon i will also host Firebolt’s page here, since sourceforge doesn’t provide dynamic web pages.
Wellcome websurfer. What brought you here? Speak your mind. Hehe just kidding… This is my very recent homepage so enjoy. I try udpate things as soon as i can.