domls
Posts: 222
Score: 0
Joined: 4/26/2002
From: WY
Status: offline
|
And now for the magic...my InstallerC4.exe program. OK, it's really NOT magic, and most of the code comes from Microsoft sample code (I can't recall the folder that it's in, in VS.NET 2003). I highly recommend the book "Microsoft .NET Compact Framework" Core Reference (written by Wigley and Wheelwright). Chapter 6 is called "Completing and Distributing Your Application" and explains that there's 5 different methods of distributing your app. Of course, in these posts, I'm covering the ActiveSync distribution method. This method is covered on pages 218-221 "Deploying Through ActiveSync". Page 219 of the text contains the Visual C++ code necessary to create installation program. Per the text..."The following Visual C++ code, from the Setup application in this book's sample files, checks the registry keys...". So the sample code is readily available. What the installer does, is it first checks the registry to be sure that ActiveSync is installed on the user's machine, then it gets the path to the Application Manager (this is the Add/Remove program that you see on the screen), and finally it prepares the Setup.ini file to be used as a parameter for the install. In other words, the Setup.ini file (and path) and passed as a parameter when the installer program executes (launches) the Application Manager program. From here, the trick was how to get the installer to pass mutliple Setup.ini files in order to execute them cleanly using the Add/Remove program screen. After a lot of research, I found that the method indicated by Microsoft for concatenating multiple Setup.ini files simply didn't work correctly with the Application Manager. In other words, there's a bug or something not quite right in the Application Manager for recognizing and executing multiple Setup.ini files. However, I was able to find a solution that DOES work, and works very well. What we're all looking for is the 'cleanest' installation possible. When I tried the examples (for multiple Setup.ini's) as given by the texts...well, unfortunately, it wasn't very clean. Instead, what I found was that each of the cabs that I was installing would appear in the Add/Remove programs box, with check boxes. The user was then forced to check all 4 programs for a fully successful installation process. Of course, what would happen is that the user wouldn't know to install the 3 supporting cab files, and your program would crash. I can't recall where I read about this method...but needless to say, since it doesn't work....let's move on... And now the finale... The key to this whole process is, as I mentioned, the InstallerC4.exe program. It's really a modified version of the Microsoft Setup program as mentioned above. So, locate the Setup.sln file and run it. Open the Setup.cpp file that's in the project. Now, if you only have 1 cab file to install, you could just Build the .exe (and maybe rename it InstallerC1.exe if you'd like), but I have the feeling that you need to install more than 1 cab file. So here's the code that you'll need to copy/paste within the Setup.cpp file:
[size=2]
szParams[0] = TCHAR(0);
_tcscat(szParams, TEXT("\""));
_tcscat(szParams, szCurPath);
_tcscat(szParams, TEXT("\\Setup1.ini\""));
_tcscat(szParams, TEXT(" \""));
_tcscat(szParams, szCurPath);
_tcscat(szParams, TEXT("\\Setup2.ini\""));
_tcscat(szParams, TEXT(" \""));
_tcscat(szParams, szCurPath);
_tcscat(szParams, TEXT("\\Setup3.ini\""));
_tcscat(szParams, TEXT(" \""));
_tcscat(szParams, szCurPath);
_tcscat(szParams, TEXT("\\Setup4.ini\""));
_tcscat(szParams, TEXT(" \""));
_tcscat(szParams, szCurPath);
_tcscat(szParams, TEXT("\\Setup5.ini\""));[/size]
When I Build this project, I wind up with an .exe that's ready to support 5 Setup.ini files. If I only need 3 or 4, then I just comment out the unneeded lines (in C++ just type in // to comment out each line). I can then Build for each type of installation I need, whether it be for 1,2,3,4, 5 or more cab files. So, this is the Holy Grail that we need in order to successfully install multiple cabs to ActiveSync. The final outcome is that we now have the ability to create a sophisticated, professional installation, and if you don't need or want to use the WinZip self extractor, then this installation process doesn't cost a dime! Thumbnail Image
Attachment (1)
|