474,034 Members | 65,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Identifying harddisk

tyr
I want to identify a harddisk over a network or any other component in a
computer. The IP address did not work beccause it change everytime.

The following code works fine on a single computer but returns 0 if you try
it over a netword.

Any ideas
thanks
Alfred
'Copy this code into the declarations section of the project.

Private Declare Function GetVolumeInform ation Lib _
"kernel32.d ll" Alias "GetVolumeInfor mationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuf fer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialN umber As Long, lpMaximumCompon entLength _
As Long, lpFileSystemFla gs As Long, ByVal _
lpFileSystemNam eBuffer As String, ByVal _
nFileSystemName Size As Long) As Long

'Code

Function GetSerialNumber (strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim Temp1 As String
Dim Temp2 As String
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInform ation(strDrive, Temp1, _
Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
GetSerialNumber = SerialNum
End Function
Aug 14 '06 #1
1 2522
Do a search for WScript.Network , there might be a call using that.

tyr wrote:
I want to identify a harddisk over a network or any other component in a
computer. The IP address did not work beccause it change everytime.

The following code works fine on a single computer but returns 0 if you try
it over a netword.

Any ideas
thanks
Alfred
'Copy this code into the declarations section of the project.

Private Declare Function GetVolumeInform ation Lib _
"kernel32.d ll" Alias "GetVolumeInfor mationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuf fer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialN umber As Long, lpMaximumCompon entLength _
As Long, lpFileSystemFla gs As Long, ByVal _
lpFileSystemNam eBuffer As String, ByVal _
nFileSystemName Size As Long) As Long

'Code

Function GetSerialNumber (strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim Temp1 As String
Dim Temp2 As String
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInform ation(strDrive, Temp1, _
Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
GetSerialNumber = SerialNum
End Function
Aug 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
9725
by: tom | last post by:
Hi, How do I get the serial number of the harddisk in .NET? I want this to be the same number even if the user has reformatted, so I do not want the volume serial number. Thanx, t
2
318
by: JanakiRaman | last post by:
Hi, Can I install visual studio .NET 2003 from harddisk? Thanks in advance, JanakiRaman S
0
1810
by: Jonas Hei | last post by:
I need to implement a listener that listens on a certain UDP port. I am trying to use Socket.BeginReceiveFrom for this purpose. In this scenario the remote clients (hundreds of them) send most of the UDP messages between 17:00 and 19:00 hours. Rest of the time any incoming messages are extremely rare. So after I execute a Socket.BeginReceiveFrom, we just wait for the AsyncCallback to happen and this can sometimes take 20 or more hours. ...
6
2684
by: angus | last post by:
Dear All, how to read the and write a file to the client's harddisk when using asp.net? is it possible to do so? Thank you. Regards,
4
1673
by: JoskeXP | last post by:
Hi I have pictures as Jpeg file on harddisk How can I load a picture from Harddisk in a PictureBox I have the name of the picture in a textbox (databinding with a Database Th JoskeXP
6
1538
by: mohamed azaz | last post by:
hi I want to know how can I create a simple doc file to drive D in Harddisk by using c++ code please answer me Quickly bye bye
9
6338
rpnew
by: rpnew | last post by:
Hi All, i recently got new Compaq laptop- CQ 45-106 AU (If i'm not wrong- will update it after reaching home.). Now i have two questions regarding this. First one is i want to make partition of my hard disk. My laptop harddisk is around ~ 250GB. Now i would like to make partition of lets say 50GB each. Presently there are two partitions.One is of recovery and that is of 10 GB and rest is allocated to C drive. Now what i want is to make...
0
10515
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11584
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8667
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6627
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6793
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4919
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3943
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.