Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Three topics - help greatly appreciated!

Three topics - help greatly appreciated!

Scheduled Pinned Locked Moved Visual Basic
csharpjsonperformancehelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    re infecta
    wrote on last edited by
    #1
    1. How to get a list of all drive letters and names, including USB-memory sticks, eg. "D: Removable drive"? Am I right that every drive has an individual ID-number or name? If so, how to get this name/ID from vb.net? I would like to compare if the two USB sticks are the same when used one after the other in the same USB-port. 2) What code snippet would tell my app to make "foo.exe" start on every Windows log in? 3) Is there an API to compress a folder into a zip-file or is the only way to use some 3rd party command line application?
    C T 2 Replies Last reply
    0
    • R re infecta
      1. How to get a list of all drive letters and names, including USB-memory sticks, eg. "D: Removable drive"? Am I right that every drive has an individual ID-number or name? If so, how to get this name/ID from vb.net? I would like to compare if the two USB sticks are the same when used one after the other in the same USB-port. 2) What code snippet would tell my app to make "foo.exe" start on every Windows log in? 3) Is there an API to compress a folder into a zip-file or is the only way to use some 3rd party command line application?
      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      1 - The System.IO namespace has a class that returns a list of all drives. All drives do have a semi unique ID/name, that would require WMI. They can have a name given to them when formatted, .NET can see that, I suspect most USB drives wouldn't have it. 2 - none, as your app would not be running. Put a shortcut to foo.exe in the run registry key ( I search for runonce, to find it, it's the first one above ), or in the Startup folder of the start menu 3 - are you using .NET 2.0 ? If so, there is zip support in the framework.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      R 2 Replies Last reply
      0
      • R re infecta
        1. How to get a list of all drive letters and names, including USB-memory sticks, eg. "D: Removable drive"? Am I right that every drive has an individual ID-number or name? If so, how to get this name/ID from vb.net? I would like to compare if the two USB sticks are the same when used one after the other in the same USB-port. 2) What code snippet would tell my app to make "foo.exe" start on every Windows log in? 3) Is there an API to compress a folder into a zip-file or is the only way to use some 3rd party command line application?
        T Offline
        T Offline
        The ANZAC
        wrote on last edited by
        #3

        You can place a shortcut to your app or that exe in the start menu: start->all programs->startup. or you can create a value in the registry subkey: HKEY_CURRENTUSER\SOFTWARE\MICROSOFT\WINDOWS\CURRENT VERSION\RUN that references your program.

        Posted by The ANZAC

        1 Reply Last reply
        0
        • C Christian Graus

          1 - The System.IO namespace has a class that returns a list of all drives. All drives do have a semi unique ID/name, that would require WMI. They can have a name given to them when formatted, .NET can see that, I suspect most USB drives wouldn't have it. 2 - none, as your app would not be running. Put a shortcut to foo.exe in the run registry key ( I search for runonce, to find it, it's the first one above ), or in the Startup folder of the start menu 3 - are you using .NET 2.0 ? If so, there is zip support in the framework.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          R Offline
          R Offline
          re infecta
          wrote on last edited by
          #4

          1. Yes, I am using .NET 2.0. How to use this zip support. Could you give me an example code to zip folder and all its subdirectories in "C:\temp\" to folder "D:\here" with the file name "myfold.zip". 2. How to make a registry entry for the startup? Could you give me an example code.

          1 Reply Last reply
          0
          • C Christian Graus

            1 - The System.IO namespace has a class that returns a list of all drives. All drives do have a semi unique ID/name, that would require WMI. They can have a name given to them when formatted, .NET can see that, I suspect most USB drives wouldn't have it. 2 - none, as your app would not be running. Put a shortcut to foo.exe in the run registry key ( I search for runonce, to find it, it's the first one above ), or in the Startup folder of the start menu 3 - are you using .NET 2.0 ? If so, there is zip support in the framework.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            R Offline
            R Offline
            re infecta
            wrote on last edited by
            #5

            So, what would be the best way to recognize if the inserted USB memory stick / USB hardrive is the same as the one used before?

            E 1 Reply Last reply
            0
            • R re infecta

              So, what would be the best way to recognize if the inserted USB memory stick / USB hardrive is the same as the one used before?

              E Offline
              E Offline
              Enriad
              wrote on last edited by
              #6

              This is used to detect when someone inserts or removes a USB drive, cd or dvd, provising plug and play is still on. It also tells you what kind of drive is used so I hope this can point you in the right direction or at least allows you to snip bits out. Private Const GWL_WNDPROC As Long = (-4) Private Const WM_DEVICECHANGE As Long = &H219 Private Const DBT_DEVNODES_CHANGED As Long = &H7 Private Const DBT_DEVICEARRIVAL As Long = &H8000& Private Const DBT_DEVICEREMOVECOMPLETE As Long = &H8004& Private Const DBT_DEVTYP_VOLUME As Long = &H2 ' Logical volume Private Const DBT_DEVTYP_DEVICEINTERFACE As Long = &H5 ' Device interface class Private Const DBTF_MEDIA As Long = &H1 ' Media comings and goings Private Const DBTF_NET As Long = &H2 ' Network volume Private Enum DriveType As Integer DRIVE_UNKNOWN = 0 DRIVE_NO_ROOT_DIR = 1 DRIVE_REMOVABLE = 2 DRIVE_FIXED = 3 DRIVE_REMOTE = 4 DRIVE_CDROM = 5 DRIVE_RAMDISK = 6 End Enum Private Structure DEV_BROADCAST_HDR Public dbch_size As Integer Public dbch_devicetype As Integer Public dbch_reserved As Integer End Structure Private Structure DEV_BROADCAST_VOLUME Public dbcv_size As Integer Public dbcv_devicetype As Integer Public dbcv_reserved As Integer Public dbcv_unitmask As Integer Public dbcv_Flags As Short End Structure Private Declare Auto Function GetDriveType Lib "kernel32.dll" (ByVal nDrive As String) As DriveType Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) If m.Msg = WM_DEVICECHANGE Then Dim WParam As Int32 = m.WParam.ToInt32() Dim dInfo As String = "" Select Case WParam Case DBT_DEVICEARRIVAL dInfo = showInfo(m, WParam) If Me.advancedMode Then If MsgBox("New Drive Detected: " & dInfo & vbCrLf & "Would you like to view the images on the drive?", CType(MsgBoxStyle.Question + MsgBoxStyle.YesNo, MsgBoxStyle), "New Drive Detected") = MsgBoxResult.Yes Then 'Me.treeBrowse_ExpTreeNodeSelected(Split$(dInfo, ":")(0) & ":\", ) loadImages(Split$(dInfo, ":")(0) & ":\") End If Else loadImagesUploader(Split$(dInfo, ":")(0) & ":\") End If

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups