Results 1 to 30 of 30

Thread: [Resolved!]Get HD serial number?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    301

    Resolved [Resolved!]Get HD serial number?

    hello,

    I am searching for an code who gets the HD Serial Number.
    Maybe that it iwll display in a textbox.

    I g2g for now, thank you and good bye
    Last edited by Account; Jan 12th, 2007 at 11:42 AM.

  2. #2

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get HD serial number?

    It looks like it only returns the volume serial number. This number is changed each time the hd is formatted. I couldnt get the example to run as it has a typeo with the StripNulls but now the image list isnt initialized. Really unexpected code example from that site as its usually very good. No time to see what else is missingwrong. Maybe you have time RB?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    301

    Re: Get HD serial number?

    First I wanna say, thanks for the reactions.

    S2cnd, I think the Hard Disk has a static serialnumber?
    So you have 2 things, the Volume Serial Number(dynamic) and Static Serial Number, how to get the static one?

    Account

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get HD serial number?

    Its the physical HD serial number that is the static number you are referring to. I havent found a solution that actually works but in .NET there is. Have you looked at using WMI for this?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Get HD serial number?

    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Get HD serial number?

    Quote Originally Posted by RobDog888
    I couldnt get the example to run as it has a typeo with the StripNulls but now the image list isnt initialized. Really unexpected code example from that site as its usually very good. No time to see what else is missingwrong. Maybe you have time RB?
    The typo is just an 's'. Either add it to the function or delete it from the function call. (StripNull and StripNulls)
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get HD serial number?

    Yes, I did mention that but there is still another error with the imagelist not being initialized and I didnt have time to go through it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Get HD serial number?

    I downloaded the http://vbnet.mvps.org/files/projects/windriveinfo.zip base (code bare) Project, and Cut 'n' Pasted the Module and Form Code.

    Besides the 's' in the Function Call, I only had 2 other (small) issues. Replace the Command1 with 'cmdLoadAll' (whos Caption is being prematurly changed by the Combo Event - but that can be fixed), and finally, replace the 'Check1' with 'chkExpandNodes'.

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get HD serial number?

    You didnt get an Imagelist error?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

  13. #13
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Get HD serial number?

    Quote Originally Posted by RobDog888
    You didnt get an Imagelist error?
    When I read you had that problem, I delibratley used the code bare Project to ensure I had the required Components (ImageList, TreeView etc) (and the fact I'm lazy )

    RB, did you use the downloadable Project aswell?

    It must Vista Rob

  14. #14
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Get HD serial number?

    Quote Originally Posted by Bruce Fox
    When I read you had that problem, I delibratley used the code bare Project to ensure I had the required Components (ImageList, TreeView etc) (and the fact I'm lazy )

    RB, did you use the downloadable Project aswell?

    It must Vista Rob
    I sure did so it must be tha Vista thing - I forgot Rob has it.

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get HD serial number?

    No, I created a new project, added the cmd buttons, lables, and cbo and treeview. Then pasted in the form code, added a module and pasted in the module code.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Get HD serial number?

    Quote Originally Posted by RobDog888
    No, I created a new project, added the cmd buttons, lables, and cbo and treeview. Then pasted in the form code, added a module and pasted in the module code.
    So the images that were loaded (assumption), TreeView ImageList association at build etc won't be available to you in this case.

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get HD serial number?

    Nope, but if I add my own it should be all good then.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  18. #18
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Get HD serial number?

    Bugger!

    I just checked the source code and the ImageList is assigned to the TreView at RunTime. So, strike that out.


    [hands in the air] It must be Vista [/hands in the air]

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get HD serial number?

    No its not lol.

    I didnt add any images. Guess I didnt phrase it clearly in my previous post

    You should also be able to get the physical HD serial number using WMI too.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20
    New Member
    Join Date
    Jan 2007
    Posts
    1

    Re: Get HD serial number?

    use follow code :
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.     Label1.Caption = SerNum("C") 'C is the standard harddisk
    5. End Sub
    6.  
    7. Public Function SerNum(Drive$) As Long
    8.     Dim No&, s As String * MAX_FILENAME_LEN
    9.     Call GetVolumeInformation(Drive + ":\", s, MAX_FILENAME_LEN, _
    10.     No, 0&, 0&, s, MAX_FILENAME_LEN)
    11.     SerNum = No
    12. End Function

  21. #21

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    301

    Re: Get HD serial number?

    Doesnt that get the (dynamic) Volume Serial Number?

  22. #22
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Get HD serial number?

    Yes, it does. This is the info that changes each time you reformat your hd. We want to get the physical hard drive serial number like the manufacturer uses.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  23. #23
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Get HD serial number?

    see attachment ...

    and create Product Key from HDD Serial.
    http://www.vbforums.com/showpost.php...5&postcount=11

    Note:
    This will not get a serial number if the user of the program is logged in as a Limited user; they have to be logged in as an Administrator.
    Last edited by rory; Oct 11th, 2007 at 03:15 AM.

  24. #24

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    301

    Re: Get HD serial number?

    ok that works

    Now I have other problem:

    I have this:

    VB Code:
    1. Private Sub Form_Load()
    2.     Text1 = getHDD
    3.     If Text1.Text = "AA-ABCD12345678" Then Exit Sub
    4. Else
    5. MsgBox "Wrong!"
    6. Unload Me
    7.  
    8. End If
    9. End Sub

    I get this error:

    Else without if
    I thought everything is ok?
    Last edited by Account; Jan 12th, 2007 at 08:32 AM.

  25. #25
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: Get HD serial number?

    your error is that Exit Sub would need to be on its own line ..
    otherwise ...

    VB Code:
    1. Private Sub Form_Load()
    2.     Text1 = getHDD
    3.     If Not Text1 = "AA-ABCD12345678" Then
    4.         MsgBox "Wrong!"
    5.         Unload Me
    6.     End If
    7. End Sub

  26. #26
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Get HD serial number?

    VB Code:
    1. Private Sub Form_Load()
    2.  
    3.     Text1 = getHDD
    4.     If Text1.Text = "AA-ABCD12345678" Then Exit Sub
    5.  
    6.     MsgBox "Wrong!"
    7.     Unload Me
    8.  
    9. End Sub
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  27. #27

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    301

    Re: [Resolved!]Get HD serial number?

    Last question, for example:
    Your hd address = 1111.2222.3333

    Will the program always at start give the same serial number?
    So if you use this code:

    Code:
    Private Sub Form_Load()
        Text1 = getHDD
        If Not Text1 = "AA-ABCD12345678" Then
            MsgBox "Wrong!"
            Unload Me
        End If
    End Sub
    And you run it on a other computer, it will always say wrong?

    Actually question = "Will it always give the same serial number on 1 hardware address?"

  28. #28
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [Resolved!]Get HD serial number?

    All HDs have unique hardware serial numbers so if it truely gets the physical SN then it will be unique on every system.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  29. #29
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: [Resolved!]Get HD serial number?

    Does this work on every OS? At least from 98 to XP?

  30. #30
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: [Resolved!]Get HD serial number?

    Ive only tested it on XP SP1 and SP2

    To answer the other question, it is unique to the Hardware, as it uses the Manufacturer's Hard Drive Serial Number. Ive used the Activation code part for over a year and it has never let me down yet. If they reinstall windows, it still works. If they install on another computer, they email me for re-activation.

    So yes, if I run that code here, or someone else does, we get "Wrong", as our HDD Serial Number is not equal to that.

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