|
-
Jan 10th, 2007, 12:19 PM
#1
Thread Starter
Hyperactive Member
[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.
-
Jan 10th, 2007, 12:23 PM
#2
Re: Get HD serial number?
-
Jan 10th, 2007, 02:31 PM
#3
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 10th, 2007, 04:07 PM
#4
Re: Get HD serial number?
I will check it later and post the "fix".
-
Jan 10th, 2007, 04:52 PM
#5
Thread Starter
Hyperactive Member
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
-
Jan 10th, 2007, 05:11 PM
#6
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 10th, 2007, 05:16 PM
#7
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
-
Jan 10th, 2007, 06:02 PM
#8
Re: Get HD serial number?
 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
-
Jan 10th, 2007, 07:14 PM
#9
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 10th, 2007, 08:31 PM
#10
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'.
-
Jan 10th, 2007, 09:23 PM
#11
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 10th, 2007, 10:16 PM
#12
Re: Get HD serial number?
Other than what was mentioned with Function/Controls names I had no issues - project ran just fine after making those minor changes.
-
Jan 10th, 2007, 10:36 PM
#13
Re: Get HD serial number?
 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
-
Jan 10th, 2007, 10:43 PM
#14
Re: Get HD serial number?
 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.
-
Jan 10th, 2007, 11:33 PM
#15
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 10th, 2007, 11:43 PM
#16
Re: Get HD serial number?
 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.
-
Jan 10th, 2007, 11:45 PM
#17
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 10th, 2007, 11:53 PM
#18
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]
-
Jan 10th, 2007, 11:58 PM
#19
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 11th, 2007, 12:57 AM
#20
New Member
Re: Get HD serial number?
use follow code :
VB Code:
Option Explicit
Private Sub Command1_Click()
Label1.Caption = SerNum("C") 'C is the standard harddisk
End Sub
Public Function SerNum(Drive$) As Long
Dim No&, s As String * MAX_FILENAME_LEN
Call GetVolumeInformation(Drive + ":\", s, MAX_FILENAME_LEN, _
No, 0&, 0&, s, MAX_FILENAME_LEN)
SerNum = No
End Function
-
Jan 11th, 2007, 04:31 PM
#21
Thread Starter
Hyperactive Member
Re: Get HD serial number?
Doesnt that get the (dynamic) Volume Serial Number?
-
Jan 11th, 2007, 04:53 PM
#22
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 11th, 2007, 06:05 PM
#23
PowerPoster
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.
-
Jan 12th, 2007, 08:24 AM
#24
Thread Starter
Hyperactive Member
Re: Get HD serial number?
ok that works 
Now I have other problem:
I have this:
VB Code:
Private Sub Form_Load()
Text1 = getHDD
If Text1.Text = "AA-ABCD12345678" Then Exit Sub
Else
MsgBox "Wrong!"
Unload Me
End If
End Sub
I get this error:
I thought everything is ok?
Last edited by Account; Jan 12th, 2007 at 08:32 AM.
-
Jan 12th, 2007, 08:34 AM
#25
PowerPoster
Re: Get HD serial number?
your error is that Exit Sub would need to be on its own line ..
otherwise ...
VB Code:
Private Sub Form_Load()
Text1 = getHDD
If Not Text1 = "AA-ABCD12345678" Then
MsgBox "Wrong!"
Unload Me
End If
End Sub
-
Jan 12th, 2007, 11:21 AM
#26
Re: Get HD serial number?
VB Code:
Private Sub Form_Load()
Text1 = getHDD
If Text1.Text = "AA-ABCD12345678" Then Exit Sub
MsgBox "Wrong!"
Unload Me
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
-
Jan 15th, 2007, 02:22 AM
#27
Thread Starter
Hyperactive Member
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?"
-
Jan 15th, 2007, 02:30 AM
#28
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Jan 15th, 2007, 02:44 AM
#29
Re: [Resolved!]Get HD serial number?
Does this work on every OS? At least from 98 to XP?
-
Jan 15th, 2007, 04:27 AM
#30
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|