Re: Toggle between SP1 and SP2

From: KM (konstmor_at_nospam_yahoo.com)
Date: 12/23/04


Date: Wed, 22 Dec 2004 23:19:32 -0800

Lucvdv,

Nice code. Will save someone hours of thinking whether to have only SP1, only SP2 or both together :-)

KM

PS. Minor suggestion to make the code less directory setup specific: Instead of hardcoded "C:\Documents and
Settings\lucvdv\Application Data" you can use an enviroment var like APPDATA. IIRC, ssfAPPDATA of ShellSpecialFolderConstants.

> For the TIPS section:
>
> Some time ago, there was a discussion about installing SP1 and SP2 side by
> side and toggling between them for different projects.
> ( Message-ID: <#gjNqJH3EHA.524@TK2MSFTNGP09.phx.gbl> )
>
> I just created something that may be useful to those who installed it that
> way.
>
> I've always had shortcuts to TD, component designer and the component
> database manager on my quick launch bar. Today I added a fourth icon that
> displays which service pack version is current, and flips to the other when
> clicked.
>
> Behind it is a small VB6 app, of which you find the source below.
>
>
> The shortcut icon is either the "R1" or "R2" icon from moricons.dll and
> must be preset to one of those when the shortcut is created.
> Moricons.dll is normally present in the system32 folder by default.
>
> The icon indexes in the file are 82 and 83 on XP Pro, on Win2000 you may
> have to change the VB source a little if they happen to be different.
>
>
> The actual switching from one SP to the other is done by two .cmd files (I
> already had those and didn't modify them, just call them from the VB app).
>
> The .cmd files follow first.
> "|" indicates start of a line, if your newsreader breaks a line in
> mid-command it won't be there so you know it's a continuation of the
> previous line.
>
> This is the file that switches to SP1, for the other one just replace SP1
> by SP2 in the paths. You'll probably have to adjust them to where you
> installed the repositories on your system anyhow.
>
> On my system, the SP1 database and repositories are installed in D:\Windows
> Embedded\XPeSP1\ and SP2 in D:\Windows Embedded\XPeSP2\.
>
> "osql" is osql.exe in the SQL Server binn folder, add it to your path if
> necessary (I think it's there by default, but I'm not certain).
>
> | osql -E -Q "sp_detach_db 'MantisSQLDB'"
> | net share Repositories /DELETE
> | net share Repositories="D:\Windows Embedded Data\XPeSP1\Repositories"
> | osql -E -Q "sp_attach_db 'MantisSQLDB', 'D:\Windows Embedded Data\XPeSP1\MantisSQLDB_Data.mdf', 'D:\Windows Embedded
> Data\XPeSP1\MantisSQLDB_Log.ldf'"
> | pause
>
>
> Now the VB app.
> Create a new standard application, remove Form1 from the workspace and add
> a standard module instead, make sure the entry point in project properties
> is "Sub Main", add "Microsoft Shell Controls and Automation" to the project
> references, and paste the code below into the module.
>
> You'll have to adjust the line with the path to the Quick Launch toolbar
> folder so it matches your system.
>
> It alse expects two .cmd files called "XPeSP1.cmd" and "XPeSP2.cmd" in its
> own folder or accessible through the path.
>
> When the application is compiled, create a shortcut called "ToggleSP" to it
> in the quick launch toolbar (make sure it has no extension in explorer: the
> filename in a DIR command in a cmd window should be "ToggleSP.lnk").
>
>
> Sub Main()
> Dim sh As Shell32.Shell
> Dim sc As Shell32.ShellLinkObject
> Dim fo As Folder
> Dim fi As FolderItem
> Dim IconIndex As Long, IconPath As String
>
> Set sh = CreateObject("Shell.Application")
>
> ' Next line broken by newsreader
> Set fo = sh.NameSpace("C:\Documents and Settings\lucvdv\Application
> Data\Microsoft\Internet Explorer\Quick Launch")
> ' The lines above are one statement
>
> For Each fi In fo.Items
> If fi.Name = "ToggleSP" And fi.IsLink Then Exit For
> Next
>
> If Not fi Is Nothing Then
> Set sc = fi.GetLink
> IconIndex = sc.GetIconLocation(IconPath)
> Select Case IconIndex
> Case 82
> sc.SetIconLocation IconPath, 83
> sc.Save
> Shell "XPeSP2.cmd", vbNormalFocus
> Case 83
> sc.SetIconLocation IconPath, 82
> sc.Save
> Shell "XPeSP1.cmd", vbNormalFocus
> End Select
> End If
> End Sub
>
>
>
> BTW: I tried turning it into a .vbs script instead of a compiled
> application, but it seems that sc.GetIconLocation doesn't work in a script
> (it gives a Type Mismatch error).



Relevant Pages

  • Re: Toggle between SP1 and SP2
    ... > Moricons.dll is normally present in the system32 folder by default. ... > in the quick launch toolbar (make sure it has no extension in explorer: ... > Dim sc As Shell32.ShellLinkObject ... > Dim IconIndex As Long, ...
    (microsoft.public.windowsxp.embedded)
  • Re: HTML Item properties vs. Regular item properties
    ... I don't use the MSN provider, but AFAIK the date in the default store's is ... OutlookSpy - Outlook, CDO ... as well as the Sent Items folder on the MSN server. ... Dim app As Outlook.Application ...
    (microsoft.public.outlook.program_vba)
  • RE: If Statement help
    ... Dim newbk As Variant ... Right now the macro takes all the files in the current folder, ... 'This is very useful in quickly archiving and storing daily batch files ... Dim objFile As File, strSourceFolder As String, strDestFolder As String ...
    (microsoft.public.excel.programming)
  • RE: If Statement help
    ... Dim newbk As Variant ... Right now the macro takes all the files in the current folder, ... 'This is very useful in quickly archiving and storing daily batch files ... Dim objFile As File, strSourceFolder As String, strDestFolder As String ...
    (microsoft.public.excel.programming)
  • RE: If Statement help
    ... "Denise Pollock" wrote: ... Dim newbk As Variant ... Right now the macro takes all the files in the current folder, ... Dim objFile As File, strSourceFolder As String, strDestFolder As String ...
    (microsoft.public.excel.programming)