Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Oct 22, 2017 11:29 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: VB code to get serial number of Hard Drive [SOLVED]
PostPosted: Fri Jun 06, 2008 6:35 pm 
Offline

Joined: Mon Oct 29, 2007 10:30 pm
Posts: 302
Location: Argentina
I have the DiskSerial.dll to obtain the serial number and model of the Hard Disk's, and the code in VB is:

Declare Integer GetSerialNumber In DiskSerial.Dll ;
   Integer nNumDisco, String cCadRet

Declare Integer GetModelNumber IN DiskSerial.dll ;
   Integer nNumDisco, String cBuffer

Local cSerial, cModelo

cSerial = Space(40)
cModelo = Space(40)

=GetSerialNumber(0, @cSerial)
=GetModelNumber(0, @cModelo)

=Messagebox("Serial : " + cSerial, 64, "Serial")
=Messagebox("Modelo : " + cModelo, 64, "Modelo")


The First part in RB is some as

Declare Function GetSerialNumber Lib "DiskSerial.dll" (nNumDisco As Integer, cCadRet As CString) as Integer
Declare Function GetModelNumber Lib "DiskSerial.dll" (nNumDisco As Integer, cBuffer As CString) as Integer


But no know how translate all the code. Help please.

_________________
Pablo Schwindt
RealBasic 2007R5
Windows 7 32bits
Mac OSX SL 10.6.4


Last edited by pamoxi on Mon Jun 09, 2008 6:49 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: VB code to get serial number of Hard Drive
PostPosted: Sat Jun 07, 2008 12:21 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Looks like you're allocating 40 bytes for each string, so that would be

dim cSerial as New MemoryBlock(40)
dim cModelo as New MemoryBlock(40)

dim retVal as Integer
retVal = GetSerialNumber(0, cSerial)
retVal = GetModelNumber(0, cModelo)

MsgBox "Serial: "+ cSerial.Cstring(0)
MsgBox "Modelo: "+ cModelo.Cstring(0)

Tim


Top
 Profile  
Reply with quote  
 Post subject: Re: VB code to get serial number of Hard Drive
PostPosted: Sun Jun 08, 2008 6:27 pm 
Offline

Joined: Mon Oct 29, 2007 10:30 pm
Posts: 302
Location: Argentina
Thanks Tim, but I probe you code and canĀ“t get any result.

Declare Function GetSerialNumber Lib "DiskSerial.dll" (nNumDisco As Integer, cCadRet As CString) as Integer

dim cSerial as New MemoryBlock(40)

dim retVal as Integer
retVal = GetSerialNumber(0, cSerial)

MsgBox "Serial: "+ cSerial.Cstring(0)


The DiskSerial.dll is here:

DiskSerial.dll (MediaFire service)

_________________
Pablo Schwindt
RealBasic 2007R5
Windows 7 32bits
Mac OSX SL 10.6.4


Top
 Profile  
Reply with quote  
 Post subject: Re: VB code to get serial number of Hard Drive
PostPosted: Sun Jun 08, 2008 10:37 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Change the declaration to cCadRet as Ptr

Tim


Top
 Profile  
Reply with quote  
 Post subject: Re: VB code to get serial number of Hard Drive
PostPosted: Mon Jun 09, 2008 6:42 am 
Offline

Joined: Mon Oct 29, 2007 10:30 pm
Posts: 302
Location: Argentina
Very thanks Tim, working perfectly.

_________________
Pablo Schwindt
RealBasic 2007R5
Windows 7 32bits
Mac OSX SL 10.6.4


Top
 Profile  
Reply with quote  
 Post subject: Re: VB code to get serial number of Hard Drive [SOLVED]
PostPosted: Mon Jun 11, 2012 2:23 pm 
Offline

Joined: Mon Jun 11, 2012 2:06 pm
Posts: 1
I have now a similar problem.
But can somebody send me the DiskSerial.dll file because the link is dead.
kindly regards


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group