PDA

View Full Version : HardDisk



lukas kain
10-27-2009, 07:39 AM
Hi All;
Between 2 HardDisks in AMS
How can i get main serial's of HardDisks?
Best

Sakuya
10-27-2009, 08:32 AM
Drive.Enumerate and Drive.GetInformation should help there. (I think these are the right function names.)

lukas kain
10-27-2009, 10:07 AM
In Drive.Enum we cant see HardDisk Name.

Sakuya
10-27-2009, 10:27 AM
In Drive.Enum we cant see HardDisk Name.

http://farm3.static.flickr.com/2455/4049559249_b2dd61fd9d_o.png


local Drives = Drive.Enumerate();
local Constructed = "Drive information is as follows.\r\n";

for K, V in pairs(Drives) do
local Information = Drive.GetInformation(V);

if (Information) then
Constructed = Constructed..[[
Label: ]]..Information.Label..[[
File System: ]]..Information.FileSystem..[[
Serial Number: ]]..Information.SerialNumber..[[
Display Name: ]]..Information.DisplayName..[[
]];
else
Constructed = Constructed.."\r\nCouldn't get information for drive "..V..", Skipping..\r\n";
end
end

Dialog.Message("Information", Constructed);

lukas kain
10-27-2009, 10:33 AM
Dear Sakuya;
Thanks for saple but
in this how can i get HardDisk name like "MAXTOR G765UD"
And how can i find that Drive C in wich HardDisk?

Sakuya
10-27-2009, 11:46 AM
Not possible with AutoPlay at the moment, a DLL or ActiveX component may help you though.

lukas kain
10-27-2009, 01:03 PM
I can Get Hardware ID.
But i want to find if User have 2 HardDisks How Can i understand that Drive C:\ in wich one?
Every body
Help
Regards

longedge
10-27-2009, 01:27 PM
Drive.GetType will provide the information you seem to need after you've enumerated the drives you can then get the type of each one.

lukas kain
10-27-2009, 03:22 PM
If I Have 2 HardDisks how can i find that Drive like D:\ For wich HardDisks?

longedge
10-27-2009, 03:43 PM
As mentioned previously use Drive.Enumerate. That will return a table containing e.g. A: C: D: E: and you can loop through table checking each drive type as you go.

lukas kain
10-27-2009, 04:04 PM
I Checked it.
Whene i have 2 HardDisks that all fixed in my case and for example they have 4 Drive partition like C D E F
All drive in Drive.type have a one type that is the :
DRIVE_FIXED-3-The drive is a non-removable (fixed) drive.

Scriptonite
10-28-2009, 12:29 AM
http://www.indigorose.com/forums/showthread.php?t=24401&highlight=volume

lukas kain
10-28-2009, 12:59 AM
all think that i need CD\DVD Drive Label or type.
But my question is not never it.
I want to find how can i find "HardDisk" Label that wich Drive Partition is in use by it .
Sampel:
HardDisk: MAXTOR DR63TR Partmgr: C:\ , D:\
HardDisk: TOSHIBA 788KU7 Partmgr:E:\
How can i find That C:\ is in use by MAXTOR DR63TR

lukas kain
10-28-2009, 02:53 PM
Hi All
I find a new Function but I want convert it to AMS
This Code is a VB Lang and Get HardDisk SerialNumber
1- With API :
Private Declare Function GetVolumeSerialNumber Lib "kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long
2- Define Var :
Public Function DiscSerialNumber(ByVal RootPath As String) As String
Dim VolLabel As String
Dim VolSize As Long
Dim Serial As Long
Dim MaxLen As Long
Dim Flags As Long
Dim Name As String
Dim NameSize As Long
Dim S As String
Dim r As Boolean
r = GetVolumeSerialNumber(RootPath, VolLabel, VolSize, Serial, MaxLen, Flags, Name, NameSize)
DiscSerialNumber = Serial
End Function
3- Call Function
Text1.Text = DiscSerialNumber("c:\")

Now you can get your SN HD with Certain Partition.
Please Help to Convert it to AMS.
Regards

IdeasVacuum
10-30-2009, 05:18 PM
kernel32 is a Windows API DLL (Dynamic Link Library).

Take a look at the AMS help on the DLL.CallFunction, you might get somewhere with that, but Basic is a good choice for this sort of thing. You could run a Basic program or DLL from your AMS program.

Alternatively, one of the expert AMS users such as AMSWaves may be able to produce a plugin for you at reasonable cost:

http://www.amswaves.com/

AMSWaves already have a plugin that gives AMS projects the ability to use Visual Basic Scripts, which may be all you need.