Jump to content
phantomas90

Un cod sursa funny!

Recommended Posts

; Beer - example of tiny (one section) Win32 program

format PE GUI 4.0

include 'win32a.inc'

; no section defined - fasm will automatically create .flat section for both

; code and data, and set entry point at the beginning of this section

invoke MessageBoxA,0,_message,_caption,MB_ICONQUESTION+MB_YESNO

cmp eax,IDYES

jne exit

invoke mciSendString,_cmd_open,0,0,0

invoke mciSendString,_cmd_eject,0,0,0

invoke mciSendString,_cmd_close,0,0,0

exit:

invoke ExitProcess,0

_message db 'Do you need additional place for the beer?',0

_caption db 'Desktop configuration',0

_cmd_open db 'open cdaudio',0

_cmd_eject db 'set cdaudio door open',0

_cmd_close db 'close cdaudio',0

; import data in the same section

data import

library kernel32,'KERNEL32.DLL',\

user32,'USER32.DLL',\

winmm,'WINMM.DLL'

import kernel32,\

ExitProcess,'ExitProcess'

import user32,\

MessageBoxA,'MessageBoxA'

import winmm,\

mciSendString,'mciSendStringA'

end data

Luati codul si il compilati cu Flat Assembler. Va aparea un msgbox care intreaba "Do you need additional place for beer?" Click "Yes" si va deschide CD-ROM-ul.

Edited by phantomas90
Link to comment
Share on other sites

  • Moderators

Mai usor..

Deschizi notepad si scrii asta :


rst = MsgBox("vrei un loc in plus pentru o bere?",4,"rstcenter")
If rst = 6 then
Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
End If
End If

Si salvezi ca nume.vbs si apoi deschizi.

Link to comment
Share on other sites

  • Moderators
AutoIT (cel mai scurt code:D)

E: -e driveul

$rasp = MsgBox(36,"Intrebare","Vrei un loc in plus pentru o bere?")
If $rasp = 6 Then
CDTray("E:","open")
EndIf

Pentru toate...


$rasp = MsgBox(36,"Intrebare","Vrei un loc in plus pentru o bere?")
If $rasp = 6 Then
$var = DriveGetDrive( "CDROM" )
If NOT @error Then
For $i = 1 to $var[0]
CDTray($var[$i],"open")
Next
EndIf
EndIf

Link to comment
Share on other sites

Da aveti toti dreptate.Se poate in script si mai usor.Dar avand in vedere ca Asm-ul se executa mai repede poti pune la un interval de jumatate de secunda codul de deschidere si de inchidere intr-ul loop infinit(pana se plictiseste useru si da restart).

il bagi la startup prin mai multe metode :]

oh the good old days...

Link to comment
Share on other sites

Mai usor..

Deschizi notepad si scrii asta :


rst = MsgBox("vrei un loc in plus pentru o bere?",4,"rstcenter")
If rst = 6 then
Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
End If
End If

Si salvezi ca nume.vbs si apoi deschizi.

Intrebare de noob: ce limbaj de programare sau mai ales ce este "acesta"???

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...