Latest OxygenBasic.zip at GitHub (Click on the Wizard)
0 Members and 1 Guest are viewing this topic.
includepath "$/inc/" '$filename "t.exe" 'include "rtl32.inc" include "MinWin.inc" extern lib "KERNEL32.DLL" ! AttachConsole alias "AttachConsole" (sys pp) as sys ! AllocConsole alias "AllocConsole" () as sys ! FreeConsole alias "FreeConsole" () as sys ! SetConsoleMode alias "SetConsoleMode" (sys h,m) ! GetCommandLine alias "GetCommandLineA" () as char* ! GetStdHandle alias "GetStdHandle" (sys handle) as sys ! WriteConsole alias "WriteConsoleA" (sys hConsoleOutput, lpBuffer, nNumberOfCharsToWrite, *lpNumberOfCharsWritten, lpReserved) as sys ! ReadConsole alias "ReadConsoleA" (sys hConsoleInput,lpBuffer,nNumberOfCharsToRead, *lpNumberOfCharsRead, *pInputControl) as sys ! SetConsoleTitle alias "SetConsoleTitleA" (char*lpConsoleTitle) as sys ! ShellExecute alias "ShellExecuteA" lib "Shell32.dll" _ (sys Hwnd, char* operation,file,parameters,directory,sys ShowCmd) as sys end extern %STD_INPUT_HANDLE = -10 %STD_OUTPUT_HANDLE = -11 %STD_ERROR_HANDLE = -12 function DOS(string s) ====================== string c STARTUPINFO infs PROCESS_INFORMATION infp if s then c="cmd.exe /c" else c="cmd.exe" CreateProcess null,c+" "+s,0,0,0,0,0,0,@infs,@infp CloseHandle infp.hProcess CloseHandle infp.hThread end function sys q,consIn,consOut,consErr q=AllocConsole 'q=AttachConsole -1 ConsIn =GetStdHandle (%STD_INPUT_HANDLE) ConsOut=GetStdHandle (%STD_OUTPUT_HANDLE) ConsErr=GetStdHandle (%STD_ERROR_HANDLE) ' string bufin long buflen,bufrit string tab,cr,qu ' tab=chr 9 qu=chr 34 cr=chr(13,10) bufin=nuls 1000 SetConsoleTitle "OxygenBasic" function output(bufout as zstring) ================================== buflen=len bufout WriteConsole ConsOut, strptr bufout,buflen,bufrit,0 end function function input() as string ========================== ReadConsole consin,strptr bufin,100,bufrit,0 function=left bufin,bufrit end function function outinput(s as zstring) as string ========================================= if s then output s ReadConsole consin,strptr bufin,100,bufrit,0 function=left bufin,bufrit end function function commandline() as string ================================ dim byref z as zstring &z=GetCommandLine function=z end function function Console(string ti) =========================== zstring dt[256] 'GetCurrentDirectory 256, strptr dt output ti cr cr output GetCommandline() cr cr do string s=outinput(dt+chr(32,2,32)) le=len(s)-2 s=lcase left s,le if s="exit" then exit do if s then DOS s end do end function Console "CUSOMISED CONSOLE" FreeConsole