Results 1 to 15 of 15

Thread: msinfo32.exe (XP to Windows 10)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2020
    Location
    Florida
    Posts
    93

    msinfo32.exe (XP to Windows 10)

    I am revitalizing an old Project in VB6 which needs to be functional in all Operating Systems from XP to Windows 10. I would like to be able to incorporate the System Info (msinfo32.exe) Dialog Box as part of my Help System, just the way it used to be under Help ==> About <Application Name>. I have modified the built-in frmAbout in VB6, but I have posted an old Word About Microsoft Word for reference. The obvious problem is that the msinfo32.exe in XP is surely not the same as the msinfo32.exe in Windows 10, and definitely not interchangeable. In addition, I would have to incorporate the Logic into a Distributed Package. Is this even possible and is it worth the effort?
    Name:  aBOUT.JPG
Views: 538
Size:  61.4 KB

  2. #2
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: msinfo32.exe (XP to Windows 10)

    Not entirely sure what you are asking here, MSINFO32 is certainly present on Windows 10, are you just wanting to launch it or use it gather information to display in your About Dialog?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2020
    Location
    Florida
    Posts
    93

    Re: msinfo32.exe (XP to Windows 10)

    Quote Originally Posted by PlausiblyDamp View Post
    Not entirely sure what you are asking here, MSINFO32 is certainly present on Windows 10, are you just wanting to launch it or use it gather information to display in your About Dialog?
    Thanks for the quick response. I want to be able to launch it in any Operating System ranging from XP to Windows 10. msinfo32.exe is not the same in XP as it is in Windows 10 (XP version will not work in Windows 10, and the Windows 10 Version will not work in XP). Here is my dilemma. I'm guessing that I would need to dynamically determine the OS Version (probably in Sub Main()), then copy the correct File to the appropriate location. I imagine that I would have to incorporate both Versions of the File in the Package in order to implement this approach. I have been away from VB for a long time and just looking for some guidance.

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: msinfo32.exe (XP to Windows 10)

    Maybe you should show us the code that is launching it. In addition, if needed, show us the code where you are setting some variable to the path/filename of msinfo32.exe
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: msinfo32.exe (XP to Windows 10)

    Quote Originally Posted by ADezii View Post
    Thanks for the quick response. I want to be able to launch it in any Operating System ranging from XP to Windows 10. msinfo32.exe is not the same in XP as it is in Windows 10 (XP version will not work in Windows 10, and the Windows 10 Version will not work in XP). Here is my dilemma. I'm guessing that I would need to dynamically determine the OS Version (probably in Sub Main()), then copy the correct File to the appropriate location. I imagine that I would have to incorporate both Versions of the File in the Package in order to implement this approach. I have been away from VB for a long time and just looking for some guidance.
    No. You don't package copies of it, and you don't copy it anywhere. It is already present on Windows 10 as stated in the post you quoted. Why does it matter if it is a different version than XP if all you are doing is executing it?

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: msinfo32.exe (XP to Windows 10)

    Agreed, there is no reason to make copies of it or place it on the host computer, just locate it and run it if that is what you want to do.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jun 2020
    Location
    Florida
    Posts
    93

    Re: msinfo32.exe (XP to Windows 10)

    Thanks for all of the positive feedback. I did arrive at a solution, perhaps not the most elegant of solutions, but a solution nonetheless. I have tested it on several PCs and it appears to work quite well. Depending on the Version of Windows, msinfo32.exe resides in either one of two Folders, namely: C:\Windows\System32\ or C:\Program Files\Common Files\Microsoft Shared\MsInfo\. For right now, I wrote Code that checks to see if msinfo32.exe exists in either one of these Folders, no need to check for the specific Version as I see it: (msinfo32.exe in XP would never reside in C:\Windows\System32\, and msinfo32.exe in Windows 7, 10, etc. would never exist in C:\Program Files\Common Files\Microsoft Shared\MsInfo\). If the File is detected at either location, it is launched via Shell(). If msinfo32.exe is not detected, the User is notified. If it exists in either location, but for some reason fails to launch (Shell() does not return a task ID), the User is again notified. I still have more research to do, but for now here is the Code that I came up with. The Paths are hard coded instead of determined, but I'll probably change that. Any and all Comments are welcome - like I stated before, it has been a long time since I programmed in VB6. Thanks again.
    Code:
    Private Sub cmdSysInfo_Click()
    On Error GoTo Err_cmdSysInfo_Click
    Dim varRetVal As Variant
    
    '**************************** KNOWN MSINFO32.EXE LOCATIONS ****************************
    Const conWin10Path = "C:\Windows\System32\MsInfo32.exe"
    Const conXPPath = "C:\Program Files\Common Files\Microsoft Shared\MsInfo\MsInfo32.exe"
    '**************************************************************************************
    
    If Dir$(conWin10Path, vbNormal) <> "" Then      'msinfo32.exe exists in > XP OSs
      varRetVal = Shell(conWin10Path, vbNormalFocus)
    ElseIf Dir$(conXPPath, vbNormal) <> "" Then     'msinfo32.exe exists in XP Path
      varRetVal = Shell(conXPPath, vbNormalFocus)
    Else
      MsgBox "MsInfo32.exe could not be found!", vbExclamation, "File Not Found"
        GoTo Exit_cmdSysInfo_Click     'avoids the double Error Message
    End If
    
    'msinfo32.exe was found, but could not be Launched by Shell()
    If varRetVal = 0 Then   'Error, no Task ID was returned
      MsgBox "msinfo32.exe could not be launched", vbExclamation, "Failure to Launch"
    End If
    
    Exit_cmdSysInfo_Click:
      Exit Sub
    
    Err_cmdSysInfo_Click:
      MsgBox Err.Description, vbExclamation, "Error in cmdSysInfo_Click()"
        Resume Exit_cmdSysInfo_Click
    End Sub
    Last edited by ADezii; Jul 30th, 2020 at 09:26 AM.

  8. #8
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: msinfo32.exe (XP to Windows 10)

    You can use environment variable values to get the paths to the "Windows" folder and the "Common Files" folder.

    Code:
    MsgBox Environ("windir")
    MsgBox Environ("CommonProgramFiles")

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Jun 2020
    Location
    Florida
    Posts
    93

    Re: msinfo32.exe (XP to Windows 10)

    @OptionBase1:
    Wouldn't it be a little more complicated than just receiving Values from Environmental Variables? I know I can query the value of the Path Key in the following Registry Path using the API:
    Code:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\MsInfo
    which, in my case, would yield:
    Code:
    C:\Program Files\Common Files\Microsoft Shared\MSInfo\msinfo32.exe
    This I can accomplish, but it requires a lot of Code (API) which I am trying to avoid. The Base Code for System Info is in frmAbout (VB6). If the Paths to MsInfo32.exe are Static, of which I am not sure, do you think that I can leave them hard coded?

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: msinfo32.exe (XP to Windows 10)

    No idea why it makes sense for a program to do this at all, but:

    Code:
    Private Sub Command1_Click()
        Shell "msinfo32"
    End Sub
    All done.

    It is already on the Path (environment variable) unless a user has really screwed things up.

  11. #11
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: msinfo32.exe (XP to Windows 10)

    If you absolutely must know the path, then you can query the registry for its location.

    Since this file should be in a path that is included in the %PATH% environment variable, you can shell the exe and test for errors. If the file is not found, you can prompt the user to go and find it with a file open dialog? If the user does that, then you'd probably want to save the location for later instead of prompting the user every time thereafter. That option requires nearly no extra code/complexity on your part.

    edited: dilettante beat me to it
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  12. #12
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: msinfo32.exe (XP to Windows 10)

    Quote Originally Posted by dilettante View Post
    No idea why it makes sense for a program to do this at all, but:

    Code:
    Private Sub Command1_Click()
        Shell "msinfo32"
    End Sub
    All done.

    It is already on the Path (environment variable) unless a user has really screwed things up.
    Nope, not true. The folder path to MSInfo32 (C:\Program Files\Common Files\Microsoft Shared\MSInfo\) is not included in "Path" on multiple non-Windows 10 devices that I have access to, and in no case has the value of Path been manually interacted with. The above code throws a run-time error 53 File not Found.

    Edit: And before you reply with some snark about anything older than Windows 10 being outdated and unsupportable, I'll remind you that the OP has multiple times referenced the need for this code to work in Windows XP.

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Jun 2020
    Location
    Florida
    Posts
    93

    Re: msinfo32.exe (XP to Windows 10)

    Code:
    Shell "msinfo32.exe"
    will work in Windows 10 but will generate File not found in lower OSs. Thanks again for all your suggestions, I'll sit back and figure how I'm going to implement this.

  14. #14
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: msinfo32.exe (XP to Windows 10)

    If you go the registry route, you can find VB classes (likely 1 or 2 in the codebank section of this forum) that are already designed for registry searching. In any case, recommend only accessing the registry keys with Read-Only access. That should prevent potential access-denied errors if the your app is running under standard user rights.

    Also in our FAQ section, there are some registry examples
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  15. #15
    Addicted Member habenero's Avatar
    Join Date
    Aug 2015
    Posts
    224

    Re: msinfo32.exe (XP to Windows 10)

    just to throw in my 2 cents worth - enclose the full path in parentheses - for me its - Shell ("c:\program files\common files\microsoft shared\msinfo\msinfo32.exe")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width