| หาค่า serial number ของ harddisk |
|
|
|
|
วันจันทร์ที่ 08 มีนาคม 2010 เวลา 17:20 น.
|
|
จริงๆ แล้วผมใช้ codeอีกแบบครับ แต่ต้องประกาศCONSTANT ซะวุ่นวาย มาเจอตัวอย่างนี้ สั้นดีครับ ทดสอบแล้ว Okครับ (PB8) เริ่มแรกก็ประกาศ External function ก่อนนะครับ FUNCTION long GetVolumeInformation & (string lpRootPathName, REF string lpVolumeNameBuffer, long nVolumeNameSize, & REF long lpVolumeSerialNumber, REF long lpMaximumComponentLength, & REF long lpFileSystemFlags, REF string lpFileSystemNameBuffer, & long nFileSystemNameSize) & LIBRARY "Kernel32.dll" ALIAS FOR "GetVolumeInformationA" ทีนี้ก็ตัวอย่าง การใช้งานครับ String ls_volbuffer, ls_fsname Long ll_serial, ll_MaxCompLength, ll_FileSystemFlags, ll_rtn ls_volbuffer = Space(255) ls_fsname = Space(255) ll_maxCompLength = 0 ll_FileSystemFlags = 0 ll_rtn = GetVolumeinformation("C:", ls_volbuffer, 255, ll_serial, & ll_MaxCompLength, ll_FileSystemFlags , ls_fsname, 255) // ls_volbuffer - volume name // ll_serial - hard disk serial number // ls_fsname - file system name ex. NTFS MessageBox('www.Thaipbl.com','volume name = '+ ls_volbuffer+ ' serial number = '+string(ll_serial)+ ' type ='+ls_fsname ) |