Jump to content

Help Me! Anyone!


Recommended Posts

that doesnt work for me both msgbox have 1 in the title and my cd is locked

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

OMG i just ran it again, my cd drive started spinning at what seemeed faster than full speed, then explorer froze for 5 minutes. im not running it again!

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

This uses an actual boolean pointer... instead of int... works same for me, but perhaps safer for others... needs beta.

MsgBox(4096,LockDevice("e:",1),"Try yo CD")
MsgBox(4096,LockDevice("e:",0),"All Better")

Func LockDevice($szDriveWithColon,$bLock)
    Local Const $INVALID_HANDLE_VALUE = -1
    Local Const $OPEN_EXISTING = 3
    Local Const $FILE_ATTRIBUTE_NORMAL = 128
    Local Const $FILE_SHARE_WRITE = 2
    Local Const $GENERIC_READ = 2147483648
    Local Const $IOCTL_STORAGE_MEDIA_REMOVAL = 2967556

    $bLock = Not(Not $bLock)
    $szDriveWithColon = StringReplace($szDriveWithColon,"\","")
    If StringLen($szDriveWithColon) <> 2 Then Return -1
    
    $szDriveWithColon = "\\.\" & $szDriveWithColon

    $hDrive = DllCall("kernel32.dll","int","CreateFile","str",$szDriveWithColon, _
            "int",$GENERIC_READ,"int",$FILE_SHARE_WRITE,"ptr",0,"int",$OPEN_EXISTING, _
            "int",$FILE_ATTRIBUTE_NORMAL,"ptr",0)

    If $hDrive[0] = $INVALID_HANDLE_VALUE Then Return -2
    
    $bool = DLLStructCreate("byte")
    DLLStructSetData($bool,1,$bLock)

    $LockMediaRslt = DllCall("kernel32.dll","int","DeviceIoControl","int",$hDrive[0], _
            "int",$IOCTL_STORAGE_MEDIA_REMOVAL, "ptr",DllStructGetPtr($bool),"int",1, _
            "int",0,"int",0,"int_ptr",0,"ptr",0)
    DllCall("kernel32.dll","int","CloseHandle","int",$hDrive[0])
    
    $bool = 0
    
    Return $LockMediaRslt[0]
EndFunc

10x very much. it works on me very good!

Link to comment
Share on other sites

;===============================================================================
; Description:  Open, Close, and Toggle CD Door
; Usage       _OpenCDDoor(DriveName)
;               _CloseCDDoor(DriveName)
;               _ToggleCDDoor(DriveName)
; Author(s):    Ward
;===============================================================================

Func _MCISendString($Str)
    DllCall("winmm.dll", "int", "mciSendString", "str", $str, "int", 0, "int", 0, "int", 0)
EndFunc

Func _OpenCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    _MCISendString("Set Drive" & $Drive & " Door Open")
EndFunc

Func _CloseCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    _MCISendString("Set Drive" & $Drive & " Door Closed")
EndFunc

Func _ToggleCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    $Timer = TimerInit()
    _MCISendString("Set Drive" & $Drive & " Door Open")
    If TimerDiff($Timer) < 200 Then
        _MCISendString("Set Drive" & $Drive & " Door Closed")
    EndIf
EndFunc

[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Link to comment
Share on other sites

;===============================================================================
; Description:  Open, Close, and Toggle CD Door
; Usage       _OpenCDDoor(DriveName)
;               _CloseCDDoor(DriveName)
;               _ToggleCDDoor(DriveName)
; Author(s):    Ward
;===============================================================================

Func _MCISendString($Str)
    DllCall("winmm.dll", "int", "mciSendString", "str", $str, "int", 0, "int", 0, "int", 0)
EndFunc

Func _OpenCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    _MCISendString("Set Drive" & $Drive & " Door Open")
EndFunc

Func _CloseCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    _MCISendString("Set Drive" & $Drive & " Door Closed")
EndFunc

Func _ToggleCDDoor($Drive)
    _MCISendString("Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio")
    $Timer = TimerInit()
    _MCISendString("Set Drive" & $Drive & " Door Open")
    If TimerDiff($Timer) < 200 Then
        _MCISendString("Set Drive" & $Drive & " Door Closed")
    EndIf
EndFunc

it's ok! works!

but

i try to convert

BOOL DeviceIoControl( (HANDLE) hDevice, // handle to device

IOCTL_CHANGER_GET_PARAMETERS, // dwIoControlCode

NULL, // lpInBuffer

0, // nInBufferSize

(LPVOID) lpOutBuffer, // output buffer

(DWORD) nOutBufferSize, // size of output buffer

(LPDWORD) lpBytesReturned, // number of bytes returned

(LPOVERLAPPED) lpOverlapped //

OVERLAPPED structure);

into au3

this function detect if cd-rom is lock, unlock, opened, closed and much more parameters....

try: Autorun Pascal Builder 2

function CD_DoorIsLocked(DRIVE : DWORD) : boolean;

function CD_DoorIsOpen(DRIVE : DWORD) : boolean;

Edited by psandu.ro
Link to comment
Share on other sites

hm.. how would I make the _ToggleCDDoor($Drive) by using CdTray() ? Or is it not possible?:)

Edit: Or get just the status of the cd tray (opened or closed)

Edit 2: I just read some old posts, I think it's possible heh.

Edited by forger
Link to comment
Share on other sites

i use base function:

Toggle_CD_Door()

Func Toggle_CD_Door()

$cddrive = DriveGetDrive('CDROM')

$togglecronos = TimerInit()

CDTray($cddrive[1], 'Close')

If TimerDiff($togglecronos) < 500 Then CDTray($cddrive[1], 'Open')

EndFunc ;==>Toggle_CD_Door

but, how i can detect if drive (cd_door) is open(close;lock;unlock)???

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...