Tutoriale Linux, Tutoriale Programare, Tutoriale retele, tutoriale photoshop

Un cod care face exact ce face si functia din VB "MsgBox()".Aveti si un exmplu cum trebuie folosit.

Cod:

#constant MsgOKOnly           = 0
#constant MsgOKCancel         = 1
#constant MsgAbortRetryIgnore = 2
#constant MsgYesNoCancel      = 3
#constant MsgYesNo            = 4
#constant MsgRetryCancel      = 5
#constant MsgCritical         = 16
#constant MsgQuestion         = 32
#constant MsgExclamation      = 48
#constant MsgInformation      = 64
#constant MsgDefaultButton1   = 0
#constant MsgDefaultButton2   = 256
#constant MsgDefaultButton3   = 512
#constant MsgApplicationModal = 0
#constant MsgSystemModal      = 4096
#constant MsgOK     = 1
#constant MsgCancel = 2
#constant MsgAbort  = 3
#constant MsgRetry  = 4
#constant MsgIgnore = 5
#constant MsgYes    = 6
#constant MsgNo     = 7

i as integer
repeat
i = msgbox("Do you want to Exit?",MsgYesNo+MsgCritical,"Quit")
if i = MsgNo then wait 500
until i = MsgYes

function MsgBox(msg as string,opts as integer,title as string)
local dll_num as integer : local hwnd as integer
local response as integer
dll_num = FreeDll()
if dll_num > 0
  load dll "user32.dll",dll_num
    hwnd = call dll (dll_num,"GetActiveWindow")
    response = call dll (dll_num,"MessageBoxA",hwnd,msg,title,opts)
  delete dll dll_num
else
  response = -1
endif
endfunction response

function FreeDll()
local i as integer : stop as integer
repeat
  inc i
  if i < 256 then if dll exist(i)=0 then stop = 1
until stop = 1 or i > 255
if i > 255 then i = 0
endfunction i

Codul nu este scris de mine bineinteles.Dar l-am postat pentru cei care au nevoie de el.

Ethical hacking and programming community