Exportfile for AOT version 1.0 or later Formatversion: 1 ***Element: CLS ; Navision Axapta Class: WinAPI descargados en Miércoles 16/01/2008 ; -------------------------------------------------------------------------------- CLSVERSION 1 CLASS #WinAPI PROPERTIES Name #WinAPI Extends # RunOn #Called from ENDPROPERTIES METHODS Version: 3 SOURCE #classDeclaration #class WinAPI #{ # #define.sizeOfInt(4) # #define.offset0(0) # #define.offset2(2) # #define.offset4(4) # #define.offset6(6) # #define.offset8(8) # #define.offset10(10) # #define.offset12(12) # #define.offset16(16) # #define.offset20(20) # #define.offset21(21) # #define.offset22(22) # #define.offset23(23) # #define.offset24(24) # #define.offset25(25) # #define.offset26(26) # #define.offset27(27) # #define.offset28(28) # #define.offset32(32) # #define.offset34(34) # #define.offset36(36) # #define.offset38(38) # #define.offset40(40) # #define.offset44(44) # #define.offset48(48) # #define.offset52(52) # #define.offset56(56) # #define.offset58(58) # #define.offset60(60) # #define.offset64(64) # #define.offset68(68) # #define.offset72(72) # #define.offset76(76) # # #define.CommonDialogDLL('COMDLG32') # #define.UserDLL('USER32') # #define.KernelDLL('KERNEL32') # #define.GDIDLL('GDI32') # #define.ADVAPI32DLL('ADVAPI32') # #winapi #} ENDSOURCE SOURCE #adjustTokenPrivileges ##winapi ##define.structSize(16) #client server static boolean adjustTokenPrivileges(int _token, boolean _disableAllPrivileges, Binary _luid, int _attributes) #{ # DLL winApiDLL = new DLL(#ADVAPI32DLL); # DLLFunction adjustTokenPrivileges; # Binary value = new Binary(#structSize); # container con = WinAPI::getVersion(); # # // OpenProcessToken is not supported on Windows 9x # if (conPeek(con, 4) != #VER_PLATFORM_WIN32_NT) # return FALSE; # # adjustTokenPrivileges = new DLLFunction(winApiDLL, 'AdjustTokenPrivileges'); # # adjustTokenPrivileges.returns(ExtTypes::DWord); # adjustTokenPrivileges.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord); # # value.dWord(#offset0, 1); // count # value.dWord(#offset4, _luid.dWord(#offset0)); # value.dWord(#offset8, _luid.dWord(#offset4)); # value.dWord(#offset12, _attributes); # # return adjustTokenPrivileges.call(_token, _disableAllPrivileges, value, 0, 0, 0); #} ENDSOURCE SOURCE #appendMenu #client static int appendMenu(int hMenu, # int uFlags, # int uIDNewItem, # str lpNewItem) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _appendMenuA = new DLLFunction(_winApiDLL, 'AppendMenuA'); # # _appendMenuA.returns(ExtTypes::DWord); # _appendMenuA.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::String); # # return _appendMenuA.call(hMenu, uFlags, uIDNewItem, lpNewItem); #} ENDSOURCE SOURCE #bringWindowToTop #static boolean bringWindowToTop(HWND _HWND) #{ # DLL DLL; # DLLFunction DLLFunction; # ; # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'BringWindowToTop'); # DLLFunction.returns(ExtTypes::Word); # DLLFunction.arg(ExtTypes::DWord); # # return DLLFunction.call(_HWND); #} ENDSOURCE SOURCE #browseForPath ##define.structSize(32) ##define.folderNamelength(260) # #static client str browseForPath(int hwnd, str title = "@SYS63310") #{ # str folder; # int il; # # DLL DLL = new DLL('shell32.dll'); # DLLFunction shBrowseForFolder = new DLLFunction(DLL, 'SHBrowseForFolder'); # DLLFunction shGetPathFromIDList = new DLLFunction(DLL, 'SHGetPathFromIDList'); # # DLL dllOle = new DLL('ole32.dll'); # DLLFunction coTaskMemFree = new DLLFunction(dllOle, 'CoTaskMemFree'); # # Binary struct = new Binary(#structSize); # Binary titleStruct = new Binary(strLen(title) + 1); # Binary folderStruct = new Binary(#folderNamelength); # # if (!hwnd) # hwnd = infolog.hWnd(); # # shBrowseForFolder.returns(ExtTypes::DWord); # shBrowseForFolder.arg(ExtTypes::Pointer); # # shGetPathFromIDList.returns(ExtTypes::DWord); # shGetPathFromIDList.arg(ExtTypes::DWord, ExtTypes::Pointer); # #// coTaskMemFree.returns(ExtTypes::VOID); # coTaskMemFree.arg(ExtTypes::DWord); # # titleStruct.string(0, title); # # struct.dWord(0, hwnd); // hwndOwner # struct.dWord(4, 0); // pidlRoot # struct.dWord(8, 0); // pszDisplayName # struct.binary(12, titleStruct); // lpszTitle # struct.dWord(16, 0); // ulFlags # struct.dWord(20, 0); // lpfn # struct.dWord(24, 0); // lParam # struct.dWord(28, 0); // iImage # # il = shBrowseForFolder.call(struct); # # if (il) # { # // extract folder name # if (shGetPathFromIDList.call(il, folderStruct)) # { # folder = folderStruct.string(0); # } # # // clean up # coTaskMemFree.call(il); # } # # return folder; #} ENDSOURCE SOURCE #cancelIO #client server static int cancelIO(classId handle) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _removeDirectory = new DLLFunction(_winApiDLL, 'CancelIo'); # # _removeDirectory.returns(ExtTypes::DWord); # _removeDirectory.arg(ExtTypes::String); # # if (_removeDirectory.call(handle) == 0) # return WinAPI::getLastError(); # else # return 0; #} ENDSOURCE SOURCE #chooseColor ##define.CC_RGBINIT(1) ##define.CC_FULLOPEN(2) ##define.structSize(36) ##define.CustColorSize(64) # #client static container chooseColor(int hwnd, # int r, # int g, # int b, # Binary custColor, # boolean fullOpen=false) #{ # DLL _winApiDLL = new DLL(#CommonDialogDLL); # Binary struct = new Binary(#structSize); # DLLFunction _chooseColor = new DLLFunction(_winApiDLL, 'ChooseColorA'); # Info info = new Info(); # int Rgb; # int flags = (fullOpen?#CC_FULLOPEN:0); # # _chooseColor.returns(ExtTypes::DWord); # _chooseColor.arg(ExtTypes::Pointer); # # struct.dWord ( #offset0, #structSize); # struct.dWord ( #offset4, hwnd ); # struct.dWord ( #offset8, info.instance() ); # struct.dWord ( #offset12, WinAPI::RGB2int(r,g,b)); # if (! custColor) # custColor = new Binary(#custColorSize); # struct.binary(#offset16, custColor); # struct.dWord (#offset20, #CC_RGBINIT | flags); # struct.dWord (#offset24, 0); # struct.dWord (#offset28, 0); # struct.dWord (#offset32, 0); # # if (_chooseColor.call(struct)) # { # RGB = struct.dWord(#offset12); # return WinAPI::RGBint2Con(RGB); # } # return conNull(); #} ENDSOURCE SOURCE #chooseFont ##define.CF_SCREENFONTS (0x00000001) ##define.CF_PRINTERFONTS (0x00000002) ##define.CF_BOTH (CF_SCREENFONTS | CF_PRINTERFONTS) ##define.CF_SHOWHELP (0x00000004) ##define.CF_ENABLEHOOK (0x00000008) ##define.CF_ENABLETEMPLATE (0x00000010) ##define.CF_ENABLETEMPLATEHANDLE (0x00000020) ##define.CF_INITTOLOGFONTSTRUCT (0x00000040) ##define.CF_USESTYLE (0x00000080) ##define.CF_EFFECTS (0x00000100) ##define.CF_APPLY (0x00000200) ##define.CF_ANSIONLY (0x00000400) ##define.CF_SCRIPTSONLY (CF_ANSIONLY) ##define.CF_NOVECTORFONTS (0x00000800) ##define.CF_NOOEMFONTS (CF_NOVECTORFONTS) ##define.CF_NOSIMULATIONS (0x00001000) ##define.CF_LIMITSIZE (0x00002000) ##define.CF_FIXEDPITCHONLY (0x00004000) ##define.CF_WYSIWYG (0x00008000) // must also have CF_SCREENFONTS & CF_PRINTERFONTS ##define.CF_FORCEFONTEXIST (0x00010000) ##define.CF_SCALABLEONLY (0x00020000) ##define.CF_TTONLY (0x00040000) ##define.CF_NOFACESEL (0x00080000) ##define.CF_NOSTYLESEL (0x00100000) ##define.CF_NOSIZESEL (0x00200000) ##define.CF_SELECTSCRIPT (0x00400000) ##define.CF_NOSCRIPTSEL (0x00800000) ##define.CF_NOVERTFONTS (0x01000000) ##define.SizeOfStruct (60) ##WinApi # #client static container chooseFont(int _hwnd, SysFontType _fonttype = SysFontType::ScreenFont, fontName _fontName = '', int _fontsize = 8) #{ # DLL _winApiDLL = new DLL(#CommonDialogDLL); # Binary struct = new Binary(#SizeOfStruct); # Binary logFont = new Binary(#SizeOfStruct); # DLLFunction _chooseFont = new DLLFunction(_winApiDLL, 'ChooseFontA'); # int Rgb; # int flags; # int height; # HWND deviceContext; # PrintJobSettings printJobSettings; # # _chooseFont.returns(ExtTypes::DWord); # _chooseFont.arg(ExtTypes::Pointer); # # flags = #CF_TTONLY | # #CF_LIMITSIZE | # #CF_INITTOLOGFONTSTRUCT | # #CF_NOSTYLESEL | # #CF_NOSCRIPTSEL | # #CF_NOSIMULATIONS; # # if (_fontSize) # { # deviceContext = WinAPI::createDC(); # height = WinAPI::getDeviceCaps(deviceContext, #LogPixelSy)*_fontsize div 72; # winApi::deleteDC(deviceContext); # } # # logFont.dWord (#offset0, height); // LONG lfHeight; # logFont.dWord (#offset4, 0); // LONG lfWidth; # logFont.dWord (#offset8, 0); // LONG lfEscapement; # logFont.dWord (#offset12, 0); // LONG lfOrientation; # logFont.dWord (#offset16, 0); // LONG lfWeight; # logFont.byte (#offset20, 0); // BYTE lfItalic; # logFont.byte (#offset21, 0); // BYTE lfUnderline; # logFont.byte (#offset22, 0); // BYTE lfStrikeOut; # logFont.byte (#offset23, 0); // BYTE lfCharSet; # logFont.byte (#offset24, 0); // BYTE lfOutPrecision; # logFont.byte (#offset25, 0); // BYTE lfClipPrecision; # logFont.byte (#offset26, 0); // BYTE lfQuality; # logFont.byte (#offset27, 0); // BYTE lfPitchAndFamily; # logFont.string(#offset28, _fontName); // TCHAR lfFaceName[LF_FACESIZE=32]; # # struct.dWord (#offset0, #SizeOfStruct); // DWORD lStructSize; # struct.dWord (#offset4, _hwnd ); // HWND hwndOwner; # # if (_fonttype == SysFontType::PrinterFont) # { # printJobSettings = new PrintJobSettings(); # struct.dWord ( #offset8, printJobSettings.hDC()); // HDC hDC; # flags = flags | #CF_PRINTERFONTS; # } # else # { # struct.dWord ( #offset8, 0); // HDC hDC; # flags = flags | #CF_SCREENFONTS; # } # # struct.binary(#offset12, logFont ); // LPLOGFONT lpLogFont; # struct.dWord (#offset16, 0); // INT iPointSize; # struct.dWord (#offset20, flags); // DWORD Flags; # struct.dWord (#offset24, 0); // DWORD rgbColors; # struct.dWord (#offset28, 0); // LPARAM lCustData; # struct.dWord (#offset32, 0); // LPCFHOOKPROC lpfnHook; # struct.dWord (#offset36, 0); // LPCTSTR lpTemplateName; # struct.dWord (#offset40, infolog.instance()); // HINSTANCE hInstance; # struct.dWord (#offset44, 0); // LPTSTR lpszStyle; # struct.dWord (#offset48, 0); // WORD nFontType; # // WORD ___MISSING_ALIGNMENT__; # struct.dWord (#offset52, 8); // INT nSizeMin; # struct.dWord (#offset56, 72); // INT nSizeMax; # # if (_chooseFont.call(struct)) # { # return [logFont.string(#offset28), struct.dWord(#offset16) div 10]; # } # return conNull(); #} ENDSOURCE SOURCE #clientToScreen #client static container clientToScreen(int hwnd, int x, int y) #{ # Binary point = new Binary(#offset8); # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _clientToScreen = new DLLFunction(_winApiDLL, 'ClientToScreen'); # # _clientToScreen.returns(ExtTypes::DWord); # _clientToScreen.arg(ExtTypes::DWord, # ExtTypes::Pointer); # # point.dWord(#Offset0, x); # point.dWord(#SizeOfInt, y); # # _clientToScreen.call(hwnd, point); # # x = point.dWord(#Offset0); # y = point.dWord(#SizeOfInt); # # return [x, y]; #} ENDSOURCE SOURCE #closeClipboard #client static boolean closeClipboard() #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _closeClipboard = new DLLFunction(_winApiDLL, 'CloseClipboard'); # # _closeClipboard.returns(ExtTypes::DWord); # _closeClipboard.arg(); # # return _closeClipboard.call(); #} ENDSOURCE SOURCE #closeHandle #client server static boolean closeHandle(int hWnd) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _closeHandle = new DLLFunction(_winApiDLL, 'CloseHandle'); # # _closeHandle.returns(ExtTypes::DWord); # _closeHandle.arg(ExtTypes::DWord); # return _closeHandle.call(hWnd); #} ENDSOURCE SOURCE #closeRegistry #static client int closeRegistry(int key) #{ # DLL advApiDll = new DLL('advapi32.dll'); # DLLFunction regCloseKey = new DLLFunction(advApiDll, 'RegCloseKey'); # int status; # # regCloseKey.returns(ExtTypes::DWord); # regCloseKey.arg (ExtTypes::DWord); # # status = regCloseKey.call(key); # return status; #} # # ENDSOURCE SOURCE #coFreeUnusedLibraries #client server static void coFreeUnusedLibraries() #{ # DLL _winApiDLL = new DLL('OLE32'); # DLLFunction _method = new DLLFunction(_winApiDLL, 'CoFreeUnusedLibraries'); # ; # # _method.call(); #} ENDSOURCE SOURCE #commDlgExtendedError #client static int commDlgExtendedError() #{ # DLL _winApiDLL = new DLL('COMDLG32'); # DLLFunction _commDlgExtendedError = new DLLFunction(_winApiDLL, 'CommDlgExtendedError'); # # _commDlgExtendedError.returns(ExtTypes::DWord); # # return _commDlgExtendedError.call(); #} ENDSOURCE SOURCE #copyFile #client server static int copyFile(str fileName, str newFileName, boolean overwrite = false) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _copyFile = new DLLFunction(_winApiDLL, 'CopyFileA'); # # # _copyFile.returns(ExtTypes::DWord); # _copyFile.arg(ExtTypes::String, # ExtTypes::String, # ExtTypes::DWord); # # if (_copyFile.call(fileName, newFileName, !overwrite ) == 0) # return WinAPI::getLastError(); # return 0; #} ENDSOURCE SOURCE #createDC #// Returns hDC #client static int createDC() #{ # DLL _winApiDLL = new DLL(#GDIDLL); # DLLFunction _createDC = new DLLFunction(_winApiDLL, 'CreateDCA'); # # _createDC.returns(ExtTypes::DWord); # _createDC.arg(ExtTypes::String, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord); # # return _createDC.call('DISPLAY', 0, 0, 0); #} # ENDSOURCE SOURCE #createDirectory ##define.sizeOfStruct(9) #client server static int createDirectory(str name) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _createDirectory = new DLLFunction(_winApiDLL, 'CreateDirectoryA'); # Binary struct = new Binary(#sizeOfStruct); # ; # struct.dWord(#Offset0,#sizeOfStruct); # # _createDirectory.returns(ExtTypes::DWord); # _createDirectory.arg(ExtTypes::String, # ExtTypes::Pointer); # # if (_createDirectory.call(name, struct) == 0) # return WinAPI::getLastError(); # else # return 0; #} ENDSOURCE SOURCE #createFile ##winapi #client server static int createFile(str fileName, int flags = #OPEN_ALWAYS, int access = 0) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _createFile = new DLLFunction(_winApiDLL, 'CreateFileA'); # # _createFile.returns(ExtTypes::DWord); # _createFile.arg(ExtTypes::String); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # # return _createFile.call(fileName,access,0,0,flags,#FILE_ATTRIBUTE_ARCHIVE,0); #} ENDSOURCE SOURCE #createFileServer ##winapi #server static int createFileServer(str fileName, int flags = #OPEN_ALWAYS) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _createFile = new DLLFunction(_winApiDLL, 'CreateFileA'); # # _createFile.returns(ExtTypes::DWord); # _createFile.arg(ExtTypes::String); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # _createFile.arg(ExtTypes::DWord); # # return _createFile.call(fileName,0,0,0,flags,#FILE_ATTRIBUTE_ARCHIVE,0); #} ENDSOURCE SOURCE #createGUID ##define.Data1(0) ##define.Data2(4) ##define.Data3(6) ##define.Data4(8) # #static str createGUID() #{ # str s; // return value # Binary guid = new Binary(16); # DLL _winApiDLL = new DLL('OLE32'); # DLLFunction _createGUID = new DLLFunction(_winApiDLL, 'CoCreateGuid'); # int retval; # # // Functions for generating hex representations of # // bytes, words and longs. # str toHex2(int v) # { # str hex = '0123456789abcdef'; # return subStr(hex, (v / 16)+1, 1) + subStr(hex, (v mod 16)+1, 1); # } # # str toHex4(int v) # { # return toHex2(v >> 8) + toHex2(v & 0xFF); # } # # str toHex8(int v) # { # return toHex4(v >> 16) + toHex4(v & 0xFFFF); # } # # // Returns an int: 0 means OK # _createGUID.returns(ExtTypes::DWORD); # # // Takes an address of the structure defined above # _createGUID.arg(ExtTypes::Pointer); # # retval = _createGUID.call(guid); # if (retval == 0) # { // Success # s = toHex8(guid.dWord(#Data1)); // 8 bytes in hex (pad with 0) # s += '-' + toHex4( guid.word(#Data2)); // 4 bytes (pad with 0) # s += '-' + toHex4( guid.word(#Data3)) + '-'; // idem # # // The bytes from the byte array are copied and # // padded with leading zeros # s += toHex2(guid.byte(#data4+0)); # s += toHex2(guid.byte(#data4+1)); # s += '-'; # s += toHex2(guid.byte(#data4+2)) + toHex2(guid.byte(#data4+3)) + # toHex2(guid.byte(#data4+4)) + toHex2(guid.byte(#data4+5)) + # toHex2(guid.byte(#data4+6)) + toHex2(guid.byte(#data4+7)); # } # return s; #} ENDSOURCE SOURCE #createPopupMenu #client static int createPopupMenu() #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _createPopupMenu = new DLLFunction(_winApiDLL, 'CreatePopupMenu'); # # _createPopupMenu.returns(ExtTypes::DWord); # _createPopupMenu.arg(); # # return _createPopupMenu.call(); #} ENDSOURCE SOURCE #createSemaphore #static int createSemaphore(str name, int initialCount, int maxCount) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _createSemaphore = new DLLFunction(_winApiDLL, 'CreateSemaphoreA'); # # _createSemaphore.returns(ExtTypes::DWord); # _createSemaphore.arg(ExtTypes::DWord); // LPSECURITY_ATTRIBUTES Real a pointer - but we're calling with NULL... # _createSemaphore.arg(ExtTypes::DWord); // Initial Count # _createSemaphore.arg(ExtTypes::DWord); // Maximum Count # _createSemaphore.arg(ExtTypes::String); // Name # # return _createSemaphore.call(0,initialCount,maxCount,name); #} ENDSOURCE SOURCE #DefWindowProc #client static int defWindowProc( # int _handle, # int _stat ) #// function DefWindowProc; external user32 name 'DefWindowProcA'; #// function DefWindowProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; #{ # int ret; # DLL _DLL = new DLL('USER32'); # DLLFunction _defwproc = new DLLFunction(_DLL, 'DefWindowProcA'); # int _dllret; # ; # ret = -1; # # _defwproc.returns(ExtTypes::DWord); // LRESULT # _defwproc.arg(ExtTypes::DWord); // handle window # _defwproc.arg(ExtTypes::DWord); // message # _defwproc.arg(ExtTypes::DWord); // wparm # _defwproc.arg(ExtTypes::DWord); // lparm # # _dllRet = _defwproc.call(_handle, #WM_SYSCOMMAND, _stat, 0); # ret = _dllRet; # # return ret; #} ENDSOURCE SOURCE #deleteDC #client static void deleteDC(int hDC) #{ # DLL _winApiDLL = new DLL(#GDIDLL); # DLLFunction _releaseDC = new DLLFunction(_winApiDLL, 'DeleteDC'); # # _releaseDC.returns(ExtTypes::DWORD); # _releaseDC.arg(ExtTypes::DWORD); # _releaseDC.call(hDC); #} ENDSOURCE SOURCE #deleteFile #client server static int deleteFile(str fileName) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _deleteFile = new DLLFunction(_winApiDLL, 'DeleteFileA'); # # _deleteFile.returns(ExtTypes::DWord); # _deleteFile.arg(ExtTypes::String); # # if (_deleteFile.call(fileName) == 0) # return WinAPI::getLastError(); # return 0; #} ENDSOURCE SOURCE #deleteMenu #client static int deleteMenu(HWND popupHandle, int pos) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _deleteMenu = new DLLFunction(_winApiDLL, 'DeleteMenu'); # _deleteMenu.returns(ExtTypes::DWord); # _deleteMenu.arg(ExtTypes::DWord); # _deleteMenu.arg(ExtTypes::DWord); # _deleteMenu.arg(ExtTypes::DWord); # # return _deleteMenu.call(popupHandle, pos, 0); #} ENDSOURCE SOURCE #destroyMenu #client static int destroyMenu(HWND popupHandle) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _destroyMenu = new DLLFunction(_winApiDLL, 'DestroyMenu'); # _destroyMenu.returns(ExtTypes::DWord); # _destroyMenu.arg(ExtTypes::DWord); # # return _destroyMenu.call(popupHandle); #} ENDSOURCE SOURCE #destroyWindow #client static void destroyWindow(int hWnd) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _destroyWindow = new DLLFunction(_winApiDLL, 'DestroyWindow'); # _destroyWindow.returns(ExtTypes::DWord); # _destroyWindow.arg(ExtTypes::DWord); # # _destroyWindow.call(hWnd); #} ENDSOURCE SOURCE #emptyClipboard #client server static boolean emptyClipboard() #{ # DLL _winApiDLL = new DLL(#UserDLL); # DLLFunction _emptyClipboard = new DLLFunction(_winApiDLL, 'EmptyClipboard'); # # _emptyClipboard.returns(EXTTYPES::DWORD); # _emptyClipboard.arg(); # # return _emptyClipboard.call(); #} # ENDSOURCE SOURCE #exitWindows ##WinAPI #client static boolean exitWindows(int _flags) #{ # // we must give ourself reboot privileges on non-Win9x systems # int token; # Binary luid; # # // Get a token for this process. # token = WinAPI::openProcessToken(WinAPI::getCurrentProcess(), #TOKEN_ADJUST_PRIVILEGES | #TOKEN_QUERY); # if (token) # { # // Get the LUID for the shutdown privilege. # luid = WinAPI::lookupPrivilegeValue("", #SE_SHUTDOWN_NAME); # if (!luid) # { # // Close token after use # WinAPI::closeHandle(token); # return FALSE; # } # # // Get the shutdown privilege for this process. # WinAPI::adjustTokenPrivileges(token, FALSE, luid, #SE_PRIVILEGE_ENABLED); # # // Close token after use # WinAPI::closeHandle(token); # } # # // Shut down the system and force all applications to close. # return WinAPI::exitWindowsEx(_flags); #} # ENDSOURCE SOURCE #exitWindowsEx #client static boolean exitWindowsEx(int _flags) #{ # DLL winApiDLL = new DLL(#USERDLL); # DLLFunction exitWindowsEx = new DLLFunction(winApiDLL, 'ExitWindowsEx'); # # exitWindowsEx.returns(ExtTypes::DWord); # exitWindowsEx.arg(ExtTypes::DWord, # ExtTypes::DWord); # # return exitWindowsEx.call(_flags, 0); #} ENDSOURCE SOURCE #fileExists ##winapi #//This return true, if a file exists. #client server static boolean fileExists(str fileName) #{ # DLL _winApiDLL = new DLL(#KERNELDLL); # Binary bname = new Binary(fileName); # DLLFunction _fileCreate = new DLLFunction(_winApiDLL, 'CreateFileA'); # int handle; # ; # # _fileCreate.returns(ExtTypes::DWord); # _fileCreate.arg(ExtTypes::Pointer, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord); # # handle = _fileCreate.call(bname, #GENERIC_READ, 0, 0, #OPEN_EXISTING, #FILE_ATTRIBUTE_NORMAL, 0); # if (handle == #INVALID_HANDLE_VALUE) # return false; # # WinAPI::closeHandle(handle); # return true; #} ENDSOURCE SOURCE #fileExists2 #//This return true, if a file or directory exists. ##define.sizeofStruct(200) #client server static boolean fileExists2(filename fileName) #{ # return WinApi::folderExists(filename); #} ENDSOURCE SOURCE #fileExistsClient #static client boolean fileExistsClient(Filename filename) #{ # return WinAPI::fileExists(filename); #} ENDSOURCE SOURCE #fileExistsServer #static server boolean fileExistsServer(Filename filename) #{ # return WinAPI::fileExists(filename); #} # ENDSOURCE SOURCE #fileLocked ##winapi #client server static boolean fileLocked(Filename filename) #{ # int handle; #; # if (! WinApi::folderExists(filename)) # return false; # # handle = WinAPI::createFile(filename, #OPEN_EXISTING, #GENERIC_WRITE); # # if (handle == #INVALID_HANDLE_VALUE) # return true; # # WinAPI::closeHandle(handle); # # return false; #} ENDSOURCE SOURCE #fileSize #server client static int fileSize(str _filename) #{ # int hfile = WinAPI::createFile(_fileName); # int size = WinAPI::getFileSize(hfile); # ; # WinAPI::closeHandle(hfile); # return size; #} ENDSOURCE SOURCE #fileTimeToSystemTime #/* MAN #The FileTimeToSystemTime function converts a 64-bit file time to system time format. #The SYSTEMTIME structure represents a date and time using individual members #for the month, day, year, weekday, hour, minute, second, and millisecond. #*/ #client server static Binary fileTimeToSystemTime(Binary fileTime) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _fileTimeToSystemTime = new DLLFunction(_winApiDLL, 'FileTimeToSystemTime'); # # Binary systemTime = new Binary(#offset16); # # _fileTimeToSystemTime.returns(ExtTypes::DWord); # _fileTimeToSystemTime.arg(ExtTypes::Pointer); # _fileTimeToSystemTime.arg(ExtTypes::Pointer); # # if (_fileTimeToSystemTime.call(fileTime, systemTime)) # { # return systemTime; # } # return null; #} ENDSOURCE SOURCE #fileType #static client str fileType(str extention) #{ # #winAPI # container reg = conNull(); # str value; # int handle; # # handle = WinAPI::regOpenKey(#HKEY_CLASSES_ROOT, extention, #KEY_READ); # reg = WinAPI::regGetValue(handle, ''); # WinAPI::regCloseKey(handle); # # [value] = reg; # # if (reg) # { # [value] = reg; # handle = WinAPI::regOpenKey(#HKEY_CLASSES_ROOT, value, #KEY_READ); # reg = WinAPI::regGetValue(handle, ''); # WinAPI::regCloseKey(handle); # # if (reg) # { # [value] = reg; # return value; # } # } # return strDel(extention, 1, 1); #} # # ENDSOURCE SOURCE #findClose #client server static boolean findClose(int handle) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _findClose = new DLLFunction(_winApiDLL, 'FindClose'); # # _findClose.returns(ExtTypes::DWord); # # _findClose.arg(ExtTypes::DWord); # # return _findClose.call(handle); #} ENDSOURCE SOURCE #FindCloseChangeNotification #client static int findCloseChangeNotification( # int _FFChgNotHandle ) # #{ # int ret = -1; # DLL _DLL = new DLL('KERNEL32'); # DLLFunction _fclschgnot = new DLLFunction(_DLL, 'FindCloseChangeNotification'); # int _dllret; # ; # ret = FALSE; # # _fclschgnot.returns(ExtTypes::DWord); // BOOL # _fclschgnot.arg(ExtTypes::DWord); // NotifyHandle DWORD # _dllRet = _fclschgnot.call( _FFChgNotHandle ); # if (_dllRet) { # ret = _dllRet; # } # # return ret; #} ENDSOURCE SOURCE #findExecutable ##WinAPI #client server static str findExecutable( # Filename _lpFile, # str _lpDirectory = '', # str _lpResult = '') #{ # DLL _winShellDLL = new DLL('SHELL32'); # DLLFunction _findExecuteA = new DLLFunction(_winShellDLL, 'FindExecutableA'); # # Binary b3 = new Binary(250); # # _findExecuteA.returns(ExtTypes::DWord); # _findExecuteA.arg( ExtTypes::String, # ExtTypes::String, # ExtTypes::Pointer); # # if (_findExecuteA.call(_lpFile, _lpDirectory, b3) > 32) # return b3.string(0); # # return ''; #} # ENDSOURCE SOURCE #FindFirstChangeNotification #client static int findFirstChangeNotification( # str _directory, # boolean _watchsub = FALSE, # int _filter = #FILE_NOTIFY_CHANGE_FILE_NAME ) # #{ # int ret = -1; # DLL _DLL = new DLL('KERNEL32'); # DLLFunction _ffrstchgnot = new DLLFunction(_DLL, 'FindFirstChangeNotificationA'); # int _dllret; # int _iBool; # ; # ret = FALSE; # if (_watchsub) # _iBool = 1; # else # _iBool = 0; # # # _ffrstchgnot.returns(ExtTypes::DWord); // HANDLE # _ffrstchgnot.arg(ExtTypes::String); // PAnsiChar # _ffrstchgnot.arg(ExtTypes::DWord); // BOOL # _ffrstchgnot.arg(ExtTypes::DWord); // DWORD Notify Filter # _dllRet = _ffrstchgnot.call(_directory, _iBool, _filter); # if (_dllRet) { # ret = _dllRet; # } # # return ret; #} ENDSOURCE SOURCE #findFirstFile #client server static container findFirstFile(str filename) #{ # Binary data = new Binary(0x200); # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _findFirstFile = new DLLFunction(_winApiDLL, 'FindFirstFileA'); # # _findFirstFile.returns(ExtTypes::DWord); # # _findFirstFile.arg(ExtTypes::String, # ExtTypes::Pointer); # # return [_findFirstFile.call(filename, data),data.string(#offset44)]; #} ENDSOURCE SOURCE #FindNextChangeNotification #client static int findNextChangeNotification( # int _FFChgNotHandle ) # #{ # int ret = -1; # DLL _DLL = new DLL('KERNEL32'); # DLLFunction _fnxtchgnot = new DLLFunction(_DLL, 'FindNextChangeNotification'); # int _dllret; # ; # ret = FALSE; # # _fnxtchgnot.returns(ExtTypes::DWord); // BOOL # _fnxtchgnot.arg(ExtTypes::DWord); // NotifyHandle DWORD # _dllRet = _fnxtchgnot.call( _FFChgNotHandle ); # if (_dllRet) { # ret = _dllRet; # } # # return ret; #} ENDSOURCE SOURCE #findNextFile #client server static str findNextFile(int handle) #{ # Binary data = new Binary(0x200); # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _findNextFile = new DLLFunction(_winApiDLL, 'FindNextFileA'); # # _findNextFile.returns(ExtTypes::DWord); # # _findNextFile.arg(ExtTypes::DWord, # ExtTypes::Pointer); # # if (_findNextFile.call(handle, data)) # return data.string(#offset44); # return ''; #} ENDSOURCE SOURCE #FindWindow #static HWND findWindow(str _class, str _title) #{ # DLL DLL; # DLLFunction DLLFunction; # HWND hWnd; # ; # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'FindWindowA'); # DLLFunction.returns(ExtTypes::DWord); # # if (_class == '') # { # if (_title == '') # throw error(strFmt("@SYS70750",funcName())); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::String); # hWnd = DLLFunction.call(0,_title); # } # else if (_title == '') # { # if (_class == '') # throw error(strFmt("@SYS70750",funcName())); # # DLLFunction.arg(ExtTypes::String,ExtTypes::DWord); # hWnd = DLLFunction.call(_class,0); # } # else # { # DLLFunction.arg(ExtTypes::String,ExtTypes::String); # hWnd = DLLFunction.call(_class,_title); # } # # return hWnd; #} ENDSOURCE SOURCE #findWindowEx #static client public HWND findWindowEx(HWND _parent, HWND _after, str _class, str _title) #{ # DLL DLL; # DLLFunction DLLFunction; # HWND hWnd; # ; # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'FindWindowExA'); # DLLFunction.returns(ExtTypes::DWord); # # if (_parent == 0) # { # return 0; # } # # if (_class == '' && _title == '') # { # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::DWord,ExtTypes::DWord); # hWnd = DLLFunction.call(_parent,_after,0,0); # } # else if (_class == '') # { # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::DWord,ExtTypes::String); # hWnd = DLLFunction.call(_parent,_after,0,_title); # } # else if (_title == '') # { # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::String,ExtTypes::DWord); # hWnd = DLLFunction.call(_parent,_after,_class,0); # } # else # { # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::String,ExtTypes::String); # hWnd = DLLFunction.call(_parent,_after,_class,_title); # } # # return hWnd; #} ENDSOURCE SOURCE #flashWindowEx #static boolean flashWindowEx(HWND _HWND, int _flags, int _count, int _timeOut) #{ # #define.STRUCTSIZE(20) # Binary struct; # DLL DLL; # DLLFunction DLLFunction; # ; # # struct = new Binary(#STRUCTSIZE); # struct.dWord(0, 20); // Specifies the size, in bytes, of the structure # struct.dWord(4, _HWND); // Handle to the window to be flashed. The window can be either opened or minimized # struct.dWord(8, _flags); // Specifies the flash status # struct.dWord(12, _count); // Specifies the number of times to flash the window # struct.dWord(16, _timeOut); // Specifies the rate, in milliseconds, at which the window will be flashed. If dwTimeout is zero, the function uses the default cursor blink rate # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'FlashWindowEx'); # DLLFunction.arg(ExtTypes::Pointer); # DLLFunction.returns(ExtTypes::Word); # # return DLLFunction.call(struct) ? true : false; #} ENDSOURCE SOURCE #folderExists #//This return true, if a file or directory exists. ##define.sizeofStruct(200) #client server static boolean folderExists(filename fileName) #{ # DLL _winApiDLL = new DLL(#KERNELDLL); # Binary bname = new Binary(fileName); # DLLFunction _fileOpen = new DLLFunction(_winApiDLL, 'OpenFile'); # int handle; # Binary of = new Binary(#sizeofStruct); # ; # # _fileOpen.returns(ExtTypes::DWord); # _fileOpen.arg(ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::DWord); # # handle = _fileOpen.call(bname, of,0x4000); // OF_EXIST # if (of.dWord(#offset2) == 2) # return false; # return true; #} ENDSOURCE SOURCE #ForceMaximizeWindow #client static boolean forceMaximizeWindow(int _handle) #{ # ; # return WinAPI::ShowWindow(_handle, #SW_MAXIMIZE); #} ENDSOURCE SOURCE #ForceMinimizeWindow #client static boolean forceMinimizeWindow(int _handle) #{ # ; # return WinAPI::ShowWindow(_handle, #SW_MINIMIZE); #} ENDSOURCE SOURCE #formatMessage ##define.FORMAT_MESSAGE_ALLOCATE_BUFFER( 0x00000100 ) ##define.FORMAT_MESSAGE_IGNORE_INSERTS ( 0x00000200 ) ##define.FORMAT_MESSAGE_FROM_STRING ( 0x00000400 ) ##define.FORMAT_MESSAGE_FROM_HMODULE ( 0x00000#offset800 ) ##define.FORMAT_MESSAGE_FROM_SYSTEM ( 0x00001000 ) ##define.FORMAT_MESSAGE_ARGUMENT_ARRAY ( 0x00002000 ) ##define.FORMAT_MESSAGE_MAX_WIDTH_MASK ( 0x000000FF ) ##define.LANG_NEUTRAL ( 0x00000000 ) ##define.SUBLANG_DEFAULT ( 0x00000001 ) ##define.structSize(250) # #static client server str formatMessage(int error) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _formatMessageA = new DLLFunction(_winApiDLL, 'FormatMessageA'); # Binary _b1 = new Binary(#structSize); # str result; # # _formatMessageA.returns(ExtTypes::DWord); # _formatMessageA.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer, # ExtTypes::DWord, # ExtTypes::DWord); # # if (_formatMessageA.call(#FORMAT_MESSAGE_FROM_SYSTEM | # #FORMAT_MESSAGE_IGNORE_INSERTS, # 0, # error, # #SUBLANG_DEFAULT<<10|#LANG_NEUTRAL, # _b1, # #structSize, # 0)) # { # result = _b1.string(#Offset0); # result = strRem(result, '\r\n\t'); # return result; # # } # return ''; #} ENDSOURCE SOURCE #getAsyncKeyState #client static int getAsyncKeyState(int vk) #{ # //return values # //0, not pressed # //1, pressed before function call # //>1, key is down # # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getKeyState = new DLLFunction(_winApiDLL, 'GetAsyncKeyState'); # # _getKeyState.returns(ExtTypes::WORD); # _getKeyState.arg(ExtTypes::DWORD); # # return _getKeyState.call(vk); #} # ENDSOURCE SOURCE #getClassInfo #static Binary getClassInfo(int _hInstance, str _className) #{ # #define.STRUCTSIZE(40) # # Binary struct; # DLL DLL; # DLLFunction DLLFunction; # ; # # struct = new Binary(#STRUCTSIZE); # struct.dWord(0); // style - Specifies the class style(s). Styles can be combined by using the bitwise OR (|) operator. # struct.dWord(4); // lpfnWndProc - Long pointer to the window procedure. You must use the CallWindowProc function to call the window procedure. # struct.dWord(8); // cbClsExtra - Specifies the number of extra bytes to allocate following the window-class structure. The system initializes the bytes to zero. # struct.dWord(12); // cbWndExtra - Specifies the number of extra bytes to allocate following the window instance. The system initializes the bytes to zero. # struct.dWord(16); // hInstance - Handle to the instance that the window procedure of this class is within. # struct.dWord(20); // hIcon - Unsupported; set to NULL. An application must draw an icon whenever the user minimizes the application window. # struct.dWord(24); // hCursor - Handle to the class cursor. This member must be a handle to a cursor resource. # struct.dWord(28); // hbrBackground - Handle to the class background brush. # struct.dWord(32); // lpszMenuName - Long pointer to a null-terminated character string that specifies the resource name of the class menu, as the name appears in the resource file. # struct.dWord(36); // lpszClassName - Either a long pointer to a null-terminated string or an atom. # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'GetClassInfoA'); # DLLFunction.arg(ExtTypes::DWord, ExtTypes::String, ExtTypes::Pointer); # DLLFunction.returns(ExtTypes::Word); # # return DLLFunction.call(_hInstance, _className, struct) ? struct : null; # #} ENDSOURCE SOURCE #getClassLong #static int getClassLong(HWND _HWND, int _nIndex) #{ # DLL DLL; # DLLFunction DLLFunction; # ; # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'GetClassLongA'); # DLLFunction.arg(ExtTypes::DWord, ExtTypes::DWord); # DLLFunction.returns(ExtTypes::DWord); # # return DLLFunction.call(_HWND, _nIndex); #} ENDSOURCE SOURCE #getClockFrequency #static int getClockFrequency() #// returns frequency in MHz #{ # #WINAPI # int clockFrequency = 0; # int key; # # container con; # ; # key = WinAPI::regOpenKey(#HKEY_LOCAL_MACHINE, 'HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0', #KEY_QUERY_VALUE); # if (key) # { # con = WinAPI::regGetValue(key, '~MHz'); # WinAPI::regCloseKey(key); # if (conLen(con)==1) # { # clockFrequency = conPeek(con,1); # # } # } # if (!clockFrequency) # clockFrequency = WinAPI::getClockFrequency2(); # return clockFrequency; #} ENDSOURCE SOURCE #getClockFrequency2 #static int getClockFrequency2() #// returns frequency in MHz #{ # DLLFunction _getFrequency ; # DLL _DLL = new DLL(#kernelDLL); # int frequency; # Binary struct = new Binary(8); # _getFrequency = new DLLFunction(_DLL, 'QueryPerformanceFrequency'); # _getFrequency.returns(ExtTypes::Byte); # _getFrequency.arg(ExtTypes::Pointer); # struct.dWord(#offset0,0); # struct.dWord(#offset4,0); # # if (_getFrequency.call(struct)) # { # frequency =struct.dWord(#offset0); # if (frequency<10000000) # frequency= 0; # else # frequency = round(frequency/1000000.0,1); # return frequency; // the upper byte is so far not necessary struct.dWord(#offset4)+ # } # else # return 0; # # # #} # ENDSOURCE SOURCE #GetCommandLine #client server static str getCommandLine() #{ # DLLFunction _getcommandLineA; # DLL _DLL = new DLL('KERNEL32'); # # _getcommandLineA = new DLLFunction(_DLL, 'GetCommandLineA'); # _getcommandLineA.returns(ExtTypes::String); # _getcommandLineA.arg(); # # return _getcommandLineA.call(); #} ENDSOURCE SOURCE #getComputerName ##define.structSize(255) #client server static str getComputerName() #{ # DLLFunction _getComputerNameA ; # Binary bSize = new Binary(#SizeOfInt); # Binary bStr = new Binary(#structSize); # DLL _DLL = new DLL('KERNEL32'); # # _getComputerNameA = new DLLFunction(_DLL, 'GetComputerNameA'); # _getComputerNameA .returns(ExtTypes::DWord); # _getComputerNameA .arg(ExtTypes::Pointer, # ExtTypes::Pointer); # # bSize.dWord(#Offset0,#structSize); # # if (_getComputerNameA .call(bStr,bSize)) # { # return bStr.string(#Offset0); # } # return ''; #} ENDSOURCE SOURCE #getCurrentDirectory #client server static str getCurrentDirectory() #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getCurrentDirectory = new DLLFunction(_winApiDLL, 'GetCurrentDirectoryA'); # Binary struct = new Binary(0x100); # ; # struct.dWord(#Offset0,256); # # _getCurrentDirectory.returns(ExtTypes::DWord); # _getCurrentDirectory.arg(ExtTypes::DWord, # ExtTypes::Pointer); # # if (_getCurrentDirectory.call(0x100, struct) == 0) # return ''; # else # return struct.string(#Offset0); #} ENDSOURCE SOURCE #getCurrentProcess #client server static int getCurrentProcess() #{ # DLL winApiDLL = new DLL(#KERNELDLL); # DLLFunction getCurrentProcess = new DLLFunction(winApiDLL, 'GetCurrentProcess'); # # getCurrentProcess.returns(ExtTypes::DWord); # # return getCurrentProcess.call(); #} ENDSOURCE SOURCE #getCursorPos #client static container getCursorPos() #{ # int x, y; # Binary point = new Binary(#offset8); # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getCursorPos = new DLLFunction(_winApiDLL, 'GetCursorPos'); # _getCursorPos.returns(ExtTypes::DWord); # _getCursorPos.arg(ExtTypes::Pointer); # _getCursorPos.call(point); # # x = point.dWord(#Offset0); # y = point.dWord(#SizeOfInt); # # return [x, y]; #} ENDSOURCE SOURCE #getDefaultGUIFont #/* # * Returns a container containing the following information on the Graphical User Interface font (Used for menus, text and other controls) # * [Pointsize, Height, Width, Italic, Name] #*/ #static container getDefaultGUIFont() #{ # int hFont = WinAPI::getStockObject(#DEFAULT_GUI_FONT); # int dc = winapi::createDC(); # int dev = winapi::getDeviceCaps(winapi::createDC(), #LOGPIXELSY); # Binary binary = winapi::getObject(hfont); # int pointsize = round(-dev * binary.dWord(#offset0)/72, 0)-4; # ; # winapi::deleteDC(dc); # pointsize = max(pointsize, 8); # if (binary) # { # return [pointsize, binary.dWord(0), binary.dWord(4), binary.byte(12), binary.string(28)]; # } # return connull(); #} ENDSOURCE SOURCE #getDesktopColorDepth ##winapi #client static int getDesktopColorDepth() #{ # int hDC; # int depth = 4; # ; # # hDC = WinAPI::getWindowDC(0); # if (hDC) # { # depth = WinAPI::getDeviceCaps(hDC, #BITSPIXEL); # WinAPI::releaseDC(0, hDC); # } # # return depth; #} ENDSOURCE SOURCE #getDeviceCaps #client static int getDeviceCaps(int hDC, # int idx) #{ # DLL _winApiDLL = new DLL(#GDIDLL); # DLLFunction _getDeviceCaps = new DLLFunction(_winApiDLL, 'GetDeviceCaps'); # # _getDeviceCaps.returns(ExtTypes::DWord); # _getDeviceCaps.arg(ExtTypes::DWord, # ExtTypes::DWord); # # return _getDeviceCaps.call(hDC, idx); #} # ENDSOURCE SOURCE #getDiskFreeSpace #client server static int getDiskFreeSpace(str 2 rootdrive) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # Binary _sectorprcluster = new Binary(#SizeOfInt); # Binary _bytesprsector = new Binary(#SizeOfInt); # Binary _freeclusters = new Binary(#SizeOfInt); # Binary _totalclusters = new Binary(#SizeOfInt); # DLLFunction _getDiskFreeSpace = new DLLFunction(_winApiDLL, 'GetDiskFreeSpaceA'); # # _getDiskFreeSpace.returns(ExtTypes::DWord); # _getDiskFreeSpace.arg(ExtTypes::String, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer); # # if (_getDiskFreeSpace.call(rootdrive, _sectorprcluster, _bytesprsector, _freeclusters, _totalclusters) == 0) # return -1; # else # return _sectorprcluster.dWord(#Offset0) * _bytesprsector.dWord(#Offset0) * _freeclusters.dWord(#Offset0); #} ENDSOURCE SOURCE #getDiskFreeSpaceInKb #client server static int getDiskFreeSpaceInKb(str 2 rootdrive) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # Binary _sectorprcluster = new Binary(#SizeOfInt); # Binary _bytesprsector = new Binary(#SizeOfInt); # Binary _freeclusters = new Binary(#SizeOfInt); # Binary _totalclusters = new Binary(#SizeOfInt); # DLLFunction _getDiskFreeSpace = new DLLFunction(_winApiDLL, 'GetDiskFreeSpaceA'); # # _getDiskFreeSpace.returns(ExtTypes::DWord); # _getDiskFreeSpace.arg(ExtTypes::String, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer); # # if (_getDiskFreeSpace.call(rootdrive, _sectorprcluster, _bytesprsector, _freeclusters, _totalclusters) == 0) # return -1; # else # return (_sectorprcluster.dWord(#Offset0) div 8) * (_bytesprsector.dWord(#Offset0) div 128) * _freeclusters.dWord(#Offset0); #} ENDSOURCE SOURCE #getDiskTotalSpace #client server static int getDiskTotalSpace(str 2 rootdrive) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # Binary _sectorprcluster = new Binary(#SizeOfInt); # Binary _bytesprsector = new Binary(#SizeOfInt); # Binary _freeclusters = new Binary(#SizeOfInt); # Binary _totalclusters = new Binary(#SizeOfInt); # DLLFunction _getDiskFreeSpace = new DLLFunction(_winApiDLL, 'GetDiskFreeSpaceA'); # # _getDiskFreeSpace.returns(ExtTypes::DWord); # _getDiskFreeSpace.arg(ExtTypes::String, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer); # # if (_getDiskFreeSpace.call(rootdrive, _sectorprcluster, _bytesprsector, _freeclusters, _totalclusters) == 0) # return -1; # else # return _sectorprcluster.dWord(#Offset0) * _bytesprsector.dWord(#Offset0) * _totalclusters.dWord(#Offset0); #} ENDSOURCE SOURCE #getDiskTotalSpaceInKb #client server static int getDiskTotalSpaceInKb(str 2 rootdrive) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # Binary _sectorprcluster = new Binary(#SizeOfInt); # Binary _bytesprsector = new Binary(#SizeOfInt); # Binary _freeclusters = new Binary(#SizeOfInt); # Binary _totalclusters = new Binary(#SizeOfInt); # DLLFunction _getDiskFreeSpace = new DLLFunction(_winApiDLL, 'GetDiskFreeSpaceA'); # # _getDiskFreeSpace.returns(ExtTypes::DWord); # _getDiskFreeSpace.arg(ExtTypes::String, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer); # # if (_getDiskFreeSpace.call(rootdrive, _sectorprcluster, _bytesprsector, _freeclusters, _totalclusters) == 0) # return -1; # else # return (_sectorprcluster.dWord(#Offset0) div 8) * (_bytesprsector.dWord(#Offset0) div 128) * _totalclusters.dWord(#Offset0); #} ENDSOURCE SOURCE #getDriveType #client server static Drivetype getDriveType(str 2 rootdir) #{ # Drivetype drivetype; # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getDriveType = new DLLFunction(_winApiDLL, 'GetDriveTypeA'); # # _getDriveType.returns(ExtTypes::DWord); # _getDriveType.arg(ExtTypes::String); # drivetype = _getDriveType.call(rootdir); # return drivetype; #} ENDSOURCE SOURCE #getFileAccessedDate #/* MAN #Returns the last accessed date of a file #*/ #client server static Date getFileAccessedDate(Filename filename) #{ # return WinAPI::getFileDate(filename, 1); #} ENDSOURCE SOURCE #getFileAccessedTime #/* MAN #Returns the accessed time of a file #Note: Only supported by NTFS - Not Fat or Fat32. #*/ #client server static timeOfDay getFileAccessedTime(Filename filename) #{ # return WinAPI::getFileTimeEx(filename, 1); #} ENDSOURCE SOURCE #getFileAttributes #client server static int getFileAttributes(str name) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getFileAttributes = new DLLFunction(_winApiDLL, 'GetFileAttributesA'); # # _getFileAttributes.returns(ExtTypes::DWord); # _getFileAttributes.arg(ExtTypes::String); # # return _getFileAttributes.call(name); #} ENDSOURCE SOURCE #getFileCreatedDate #/* MAN #Returns the created datee of a file #*/ #client server static Date getFileCreatedDate(Filename filename) #{ # return WinAPI::getFileDate(filename, 0); #} ENDSOURCE SOURCE #getFileCreatedTime #/* MAN #Returns the created time of a file #*/ #client server static timeOfDay getFileCreatedTime(Filename filename) #{ # return WinAPI::getFileTimeEx(filename, 0); #} ENDSOURCE SOURCE #getFileDate ##winapi # #client server static date getFileDate(Filename filename, int type) #{ # int hFile = WinAPI::createFile(filename, #OPEN_EXISTING); # Binary filetime; # Binary systemTime; # # if (hFile) # { # filetime = WinAPI::getFileTime(hFile, type); # WinAPI::closeHandle(hFile); # if (filetime) # { # systemTime = WinAPI::fileTimeToSystemTime(filetime); # # if (systemTime) # return WinAPI::SystemTimeToDate(systemTime); # } # } # return dateNull(); #} ENDSOURCE SOURCE #getFileModifiedDate #/* MAN #Returns the modified date of a file #*/ #client server static Date getFileModifiedDate(Filename filename) #{ # return WinAPI::getFileDate(filename, 2); #} ENDSOURCE SOURCE #getFileModifiedTime #/* MAN #Returns the modified time of a file #*/ #client server static timeOfDay getFileModifiedTime(Filename filename) #{ # return WinAPI::getFileTimeEx(filename, 2); #} ENDSOURCE SOURCE #getFileSize #client server static int getFileSize(int hFile) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getFileSize = new DLLFunction(_winApiDLL, 'GetFileSize'); # # _getFileSize.returns(ExtTypes::DWord); # _getFileSize.arg(ExtTypes::DWord); # _getFileSize.arg(ExtTypes::DWord); # return _getFileSize.call(hFile, 0); #} ENDSOURCE SOURCE #getFileTime #/* MAN #The GetFileTime function retrieves the date and time that a file was created, last accessed, and last modified. #*/ #client server static Binary getFileTime(int hFile, int type = 0) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getFileTime = new DLLFunction(_winApiDLL, 'GetFileTime'); # Binary create = new Binary(#offset8); # Binary access = new Binary(#offset8); # Binary write = new Binary(#offset8); # _getFileTime.returns(ExtTypes::DWord); # _getFileTime.arg(ExtTypes::DWord); # _getFileTime.arg(ExtTypes::Pointer); # _getFileTime.arg(ExtTypes::Pointer); # _getFileTime.arg(ExtTypes::Pointer); # # if (_getFileTime.call(hFile, create, access, write)) # { # switch (type) # { # case 0: return create; # case 1: return access; # case 2: return write; # } # } # return null; #} ENDSOURCE SOURCE #getFileTimeEx ##winapi #client server static timeOfDay getFileTimeEx(Filename filename, int type) #{ # int hFile = WinAPI::createFile(filename, #OPEN_EXISTING); # Binary filetime; # Binary systemTime; # # if (hFile) # { # filetime = WinAPI::getFileTime(hFile, type); # WinAPI::closeHandle(hFile); # if (filetime) # { # systemTime = WinAPI::fileTimeToSystemTime(filetime); # # if (systemTime) # return WinAPI::SystemTimeToTimeOfDay(systemTime); # } # } # return 0; #} ENDSOURCE SOURCE #getFileTimeServer #/* MAN #The GetFileTimeServer function retrieves the date and time that a file was created, last accessed, and last modified. Accessed from the server tier. #*/ #server static Binary getFileTimeServer(int hFile, int type = 0) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getFileTime = new DLLFunction(_winApiDLL, 'GetFileTime'); # Binary create = new Binary(#offset8); # Binary access = new Binary(#offset8); # Binary write = new Binary(#offset8); # _getFileTime.returns(ExtTypes::DWord); # _getFileTime.arg(ExtTypes::DWord); # _getFileTime.arg(ExtTypes::Pointer); # _getFileTime.arg(ExtTypes::Pointer); # _getFileTime.arg(ExtTypes::Pointer); # # if (_getFileTime.call(hFile, create, access, write)) # { # switch (type) # { # case 0: return create; # case 1: return access; # case 2: return write; # } # } # return null; #} ENDSOURCE SOURCE #getFileVersionInfo #/* MAN #The GetFileVersionInfo function retrieves version information for the specified file. #*/ # #client server static boolean getFileVersionInfo(str fileName, int _size, int _handle) #{ # DLL _winApiDLL = new DLL('Version'); # DLLFunction _getFileVersionInfo = new DLLFunction(_winApiDLL, 'GetFileVersionInfoA'); # # if (!_size) # return false; # # _getFileVersionInfo.returns(ExtTypes::DWord); # _getFileVersionInfo.arg(ExtTypes::String); # _getFileVersionInfo.arg(ExtTypes::DWord); # _getFileVersionInfo.arg(ExtTypes::DWord); # _getFileVersionInfo.arg(ExtTypes::DWord); # # return _getFileVersionInfo.call(fileName, 0, _size, _handle); #} ENDSOURCE SOURCE #getFileVersionInfoEx #// _versionInfo can be one of the following strings: #// Comments InternalName ProductName #// CompanyName LegalCopyright ProductVersion #// FileDescription LegalTrademarks PrivateBuild #// FileVersion OriginalFilename SpecialBuild #client server static str getFileVersionInfoEx(str _filename, str _versionInfo) #{ # #WinAPI # # int i; # int glbMem; # int versionInfoSize; # int versionInfoHandle; # str versionInfoRequest; # str versionInfoRead; # # int numOfCodePages = 4; # str codePage[numOfCodePages]; # codePage[1] = '040904E4'; # codePage[2] = '040904B0'; # codePage[3] = '000004E4'; # codePage[4] = '000004B0'; # # // Let's dive in and pull out the version information: # versionInfoSize = WinAPI::getFileVersionInfoSize(_filename); # if (versionInfoSize > 0) # { # // First allocate some memory for the information # glbMem = WinAPI::globalAlloc(#GMEM_MOVEABLE, versionInfoSize); # if (!glbMem) # { # return ""; # } # # // Lock the memory before we can use it # versionInfoHandle = WinAPI::globalLock(glbMem); # if (!versionInfoHandle) # { # WinAPI::globalFree(glbMem); # return ""; # } # # // Now read the version information from the file # if (!WinAPI::getFileVersionInfo(_filename, versionInfoSize, versionInfoHandle)) # { # WinAPI::globalUnLock(glbMem); # WinAPI::globalFree(glbMem); # return ""; # } # # for (i = 1; i <= numOfCodePages; i++) # { # // Construct a string specifying the version info # // to query from the memory block # versionInfoRequest = '\\StringFileInfo\\' + codePage[i] + '\\' + _versionInfo; # # // Query the version info # versionInfoRead = WinAPI::verQueryValue(versionInfoHandle, versionInfoRequest); # if (strLen(versionInfoRead)) # { # // version info found # break; # } # } # # WinAPI::globalUnLock(glbMem); # WinAPI::globalFree(glbMem); # } # # return versionInfoRead; #} # ENDSOURCE SOURCE #getFileVersionInfoSize #/* MAN #The GetFileVersionInfoSize function determines whether the operating system can retrieve #version information for a specified file. If version information is available, #GetFileVersionInfoSize returns the size, in bytes, of that information. # #Return Values #If the function succeeds, the return value is the size, in bytes, of the file's version information. #If the function fails, the return value is zero. To get extended error information, call GetLastError. # #Windows 95/98: The short path form of the specified file name must be less than 126 characters. #*/ # #client server static int getFileVersionInfoSize(str fileName) #{ # DLL _winApiDLL = new DLL('Version'); # DLLFunction _getFileVersionInfoSize = new DLLFunction(_winApiDLL, 'GetFileVersionInfoSizeA'); # Binary _handle = new Binary(4); # # _getFileVersionInfoSize.returns(ExtTypes::DWord); # _getFileVersionInfoSize.arg(ExtTypes::String); # _getFileVersionInfoSize.arg(ExtTypes::Pointer); # # return _getFileVersionInfoSize.call(fileName, _handle); #} ENDSOURCE SOURCE #getFolderPath #client static str getFolderPath(int whatFolderCLSID) #{ # #WinAPI # DLL SHFolderDLL = new DLL('SHFOLDER.DLL'); # DLLFunction shGetFolderPath = new DLLFunction(SHFolderDLL, 'SHGetFolderPathA'); # int hr; # Binary path = new Binary(260); // MAX_PATH # # shGetFolderPath.returns(ExtTypes::DWord); # shGetFolderPath.arg(ExtTypes::DWord, // hwndOwner # ExtTypes::DWord, // nFolder # ExtTypes::DWord, // hToken # ExtTypes::DWord, // dwFlags # ExtTypes::Pointer); // pszPath # # hr = shGetFolderPath.call(NULL, whatFolderCLSID, NULL, 0, path); # # if ( hr >= 0 && path.string(0)) # { # // We got the path for the requested CLSID # return path.string(0); # } # else # { # // Operation failed. # if (whatFolderCLSID != #CSIDL_PERSONAL) # { # return WinAPI::getFolderPath(#CSIDL_PERSONAL); # } # } # return ''; #} # ENDSOURCE SOURCE #getFolderPathServer #server static str getFolderPathServer(int whatFolderCLSID) #{ # #WinAPI # DLL SHFolderDLL = new DLL('SHFOLDER.DLL'); # DLLFunction shGetFolderPath = new DLLFunction(SHFolderDLL, 'SHGetFolderPathA'); # int hr; # Binary path = new Binary(260); // MAX_PATH # # shGetFolderPath.returns(ExtTypes::DWord); # shGetFolderPath.arg(ExtTypes::DWord, // hwndOwner # ExtTypes::DWord, // nFolder # ExtTypes::DWord, // hToken # ExtTypes::DWord, // dwFlags # ExtTypes::Pointer); // pszPath # # hr = shGetFolderPath.call(NULL, whatFolderCLSID, NULL, 0, path); # # if ( hr >= 0 && path.string(0)) # { # // We got the path for the requested CLSID # return path.string(0); # } # else # { # // Operation failed. # if (whatFolderCLSID != #CSIDL_PERSONAL) # { # return WinAPI::getFolderPath(#CSIDL_PERSONAL); # } # } # return ''; #} # ENDSOURCE SOURCE #getLastError #client server static int getLastError() #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getLastError = new DLLFunction(_winApiDLL, 'GetLastError'); # # _getLastError.returns(ExtTypes::DWord); # # return _getLastError.call(); #} ENDSOURCE SOURCE #getLocaleInfo ##define.structSize(256) #client server static str getLocaleInfo(int Locale, int LCType) #{ # DLL _winApiDLL = new DLL(#KernelDLL); # DLLFunction _getLocaleInfo = new DLLFunction(_winApiDLL, 'GetLocaleInfoA'); # Binary struct = new Binary(#structSize); # ; # struct.dWord(#Offset0,#structSize); # # _getLocaleInfo.returns(EXTTYPES::DWORD); # _getLocaleinfo.arg(EXTTYPES::DWORD, EXTTYPES::DWORD, EXTTYPES::POINTER, EXTTYPES::DWORD); # # if (_getLocaleInfo.call(Locale, LCType, struct, #structSize) == 0) # return ''; # else # return struct.string(#Offset0); #} ENDSOURCE SOURCE #getMemoryStatus #static container getMemoryStatus() #{ # // dwLength # // dwMemoryLoad # // dwTotalPhys # // dwAwailPhys # // dwTotalPageFile # // dwAvailPageFile # // dwTotalVirtual # // dwAvailVirtual # #define.structSize(4*8) # DLLFunction _globalMemoryStatus ; # Binary struct = new Binary(#structSize); # DLL _DLL = new DLL(#kernelDLL); # _globalMemoryStatus = new DLLFunction(_DLL, 'GlobalMemoryStatus'); # # _globalMemoryStatus.returns(ExtTypes::DWord); # _globalMemoryStatus.arg(ExtTypes::Pointer); # # struct.dWord (#offset0, 0 ); // dwLength # struct.dWord (#offset4, 0 ); // dwMemoryLoad # struct.dWord (#offset8, 0 ); // dwTotalPhys # struct.dWord (#offset12, 0 ); // dwAwailPhys # struct.dWord (#offset16, 0 ); // dwTotalPageFile # struct.dWord (#offset20, 0 ); // dwAvailPageFile # struct.dWord (#offset24, 0 ); // dwTotalVirtual # struct.dWord (#offset28, 0 ); // dwAvailVirtual # # # # if (_globalMemoryStatus.call(struct)) # { # return [struct.dWord(#offset0), # struct.dWord(#offset4), # struct.dWord(#offset8), # struct.dWord(#offset12), # struct.dWord(#offset16), # struct.dWord(#offset20), # struct.dWord(#offset24), # struct.dWord(#offset28)]; # } # # return conNull(); # #} # ENDSOURCE SOURCE #getMenuItemCount #client static int getMenuItemCount(HWND popupHandle) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getMenuItemCount = new DLLFunction(_winApiDLL, 'GetMenuItemCount'); # _getMenuItemCount.returns(ExtTypes::DWord); # _getMenuItemCount.arg(ExtTypes::DWord); # # return _getMenuItemCount.call(popupHandle); #} ENDSOURCE SOURCE #getMenuItemId #client static int getMenuItemId(HWND popupHandle, int pos) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getMenuItemId = new DLLFunction(_winApiDLL, 'GetMenuItemID'); # _getMenuItemId.returns(ExtTypes::DWord); # _getMenuItemId.arg(ExtTypes::DWord); # _getMenuItemId.arg(ExtTypes::DWord); # # return _getMenuItemId.call(popupHandle, pos); #} ENDSOURCE SOURCE #getMenuItemInfo #client static Binary getMenuItemInfo(int hMenu, # int uItem) #{ # DLL _winApiDLL = new DLL('USER32'); # Binary mii = new Binary(#offset44); # DLLFunction _getMenuItemInfo = new DLLFunction(_winApiDLL, 'GetMenuItemInfoA'); # # _getMenuItemInfo.returns(ExtTypes::DWord); # _getMenuItemInfo.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer); # # # _getMenuItemInfo.call(hMenu, uItem, 0, mii); # return mii; #} ENDSOURCE SOURCE #getMenuItemString #client static str getMenuItemString(HWND popupHandle, int id) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getMenuString = new DLLFunction(_winApiDLL, 'GetMenuStringA'); # # Binary b = new Binary(81); # # _getMenuString.returns(ExtTypes::DWord); # _getMenuString.arg(ExtTypes::DWord); # _getMenuString.arg(ExtTypes::DWord); # _getMenuString.arg(ExtTypes::Pointer); # _getMenuString.arg(ExtTypes::DWord); # _getMenuString.arg(ExtTypes::DWord); # # if (_getMenuString.call(popupHandle, id, b, 80, 0)) # return b.string(0); # return ''; #} ENDSOURCE SOURCE #getObject #static client server binary getObject(int hwnd) #{ # DLL _winApiDLL = new DLL(#GDIDLL); # DLLFunction _getObject = new DLLFunction(_winApiDLL, 'GetObjectA'); # Binary _struct = new Binary(60); # # if (hwnd) # { # _getObject.returns(ExtTypes::DWord); # _getObject.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer); # # if (_getObject.call(hwnd, 60, _struct)) # { # return _struct; # } # } # return null; #} ENDSOURCE SOURCE #getOpenFileName ##define.OFN_READONLY (0x00000001) ##define.OFN_OVERWRITEPROMPT (0x00000002) ##define.OFN_HIDEREADONLY (0x00000004) ##define.OFN_NOCHANGEDIR (0x00000008) ##define.OFN_SHOWHELP (0x00000010) ##define.OFN_ENABLEHOOK (0x00000020) ##define.OFN_ENABLETEMPLATE (0x00000040) ##define.OFN_ENABLETEMPLATEHANDLE(0x00000080) ##define.OFN_NOVALIDATE (0x00000100) ##define.OFN_ALLOWMULTISELECT (0x00000200) ##define.OFN_EXTENSIONDIFFERENT (0x00000400) ##define.OFN_PATHMUSTEXIST (0x00000800) ##define.OFN_FILEMUSTEXIST (0x00001000) ##define.OFN_CREATEPROMPT (0x00002000) ##define.OFN_SHAREAWARE (0x00004000) ##define.OFN_NOREADONLYRETURN (0x00008000) ##define.OFN_NOTESTFILECREATE (0x00010000) ##define.OFN_NONETWORKBUTTON (0x00020000) ##define.OFN_NOLONGNAMES (0x00040000) ##define.OFN_EXPLORER (0x00080000) ##define.OFN_NODEREFERENCELINKS (0x00100000) ##define.OFN_LONGNAMES (0x00200000) ##define.fileNamelength(260) ##define.structSize(76) # #client static str #fileNamelength getOpenFileName(int _hwnd, # FilenameFilter _conFilter, # str _strInitialPath, # str _dialogTitle, # str _strDefaultExtension='', # str _strDefaultFileName='', # int _flags = #OFN_FILEMUSTEXIST) #{ # Binary oFN, bFileName, bStrFilter, bStrInitialPath, bDialogTitle, bstrDefaultExtension; # str tmpstr; # str #fileNamelength sFileName; # int strOffset, i; # Info info; # # DLL _DLL = new DLL('COMDLG32'); # DLLFunction _getOpenFileName = new DLLFunction(_DLL, 'GetOpenFileNameA'); # _getOpenFileName.returns(ExtTypes::DWord); # _getOpenFileName.arg(ExtTypes::Pointer); # # strOffset = 0; # strOffset = 0; # for (i=1; i<=conLen(_conFilter); i++) # { # tmpstr = conPeek(_conFilter, i); # if (i mod 2) # tmpstr += ' ('+conPeek(_conFilter, i+1)+')'; # strOffset += 1 + strLen(tmpstr); # } # # info = new Info(); # bFileName = new Binary(#fileNamelength); # oFN = new Binary(#structSize); # bStrFilter = new Binary(strOffset + 2); # bstrDefaultExtension = new Binary(#fileNamelength); # bStrInitialPath = new Binary(_strInitialPath); # bDialogTitle = new Binary(_dialogTitle); # # bFileName.string(#Offset0, _strDefaultFileName); # # strOffset = 0; # for (i=1; i<=conLen(_conFilter); i++) # { # tmpstr = conPeek(_conFilter, i); # if (i mod 2) # tmpstr += ' ('+conPeek(_conFilter, i+1)+')'; # bStrFilter.string(strOffset, tmpstr); # strOffset += 1 + strLen(tmpstr); # } # # oFN.dWord( #Offset0 , #structSize); # oFN.dWord( #offset4 , _hwnd); # oFN.dWord( #offset8 , info.instance()); # oFN.binary(#offset12 , bStrFilter); # oFN.dWord( #offset16 , 0); # oFN.dWord( #offset20 , 0); # oFN.dWord( #offset24 , 1); # oFN.binary(#offset28 , bFileName); # oFN.dWord( #offset32 , #fileNamelength); # oFN.dWord( #offset36 , 0); # oFN.dWord( #offset40 , 0); # oFN.binary(#offset44 , bStrInitialPath); # oFN.binary(#offset48 , bDialogTitle); # oFN.dWord( #offset52 , #OFN_HIDEREADONLY | # #OFN_PATHMUSTEXIST | # #OFN_SHAREAWARE | # #OFN_NOCHANGEDIR | # _flags | # #OFN_EXPLORER); # oFN.word( #offset56 , 0); # oFN.word( #offset58 , 0); # oFN.binary(#offset60 , bstrDefaultExtension); # oFN.dWord( #offset64 , 0); # oFN.dWord( #offset68 , 0); # oFN.dWord( #offset72 , 0); # # if(_getOpenFileName.call(oFN)) # sFileName = bFileName.string(#Offset0); # else # sFileName = ''; # # i = strLen(sfilename); # return sFileName; #} ENDSOURCE SOURCE #getOSVersion #/* # * Returns a container containing : # * # * Major windows version # * Minor windows version # * Platform id # * # */ #client server static public container getOSVersion() #{ # #define.OSVERSIONINFOSIZE(148) # # DLL dll; # DLLFunction dllFunction; # Binary binary; # ; # # dll = new DLL('KERNEL32'); # dllFunction = new DLLFunction(dll,'GetVersionExA'); # # binary = new Binary(#OSVERSIONINFOSIZE); # binary.dWord(0,#OSVERSIONINFOSIZE); # # dllFunction.arg(ExtTypes::Pointer); # dllFunction.returns(ExtTypes::Byte); # # dllFunction.call(binary); # # return [binary.dWord(4),binary.dWord(8),binary.dWord(16)]; #} ENDSOURCE SOURCE #getSaveFileName ##define.OFN_READONLY (0x00000001) ##define.OFN_OVERWRITEPROMPT (0x00000002) ##define.OFN_HIDEREADONLY (0x00000004) ##define.OFN_NOCHANGEDIR (0x00000008) ##define.OFN_SHOWHELP (0x00000010) ##define.OFN_ENABLEHOOK (0x00000020) ##define.OFN_ENABLETEMPLATE (0x00000040) ##define.OFN_ENABLETEMPLATEHANDLE(0x00000080) ##define.OFN_NOVALIDATE (0x00000100) ##define.OFN_ALLOWMULTISELECT (0x00000200) ##define.OFN_EXTENSIONDIFFERENT (0x00000400) ##define.OFN_PATHMUSTEXIST (0x00000800) ##define.OFN_FILEMUSTEXIST (0x00001000) ##define.OFN_CREATEPROMPT (0x00002000) ##define.OFN_SHAREAWARE (0x00004000) ##define.OFN_NOREADONLYRETURN (0x00008000) ##define.OFN_NOTESTFILECREATE (0x00010000) ##define.OFN_NONETWORKBUTTON (0x00020000) ##define.OFN_NOLONGNAMES (0x00040000) ##define.OFN_EXPLORER (0x00080000) ##define.OFN_NODEREFERENCELINKS (0x00100000) ##define.OFN_LONGNAMES (0x00200000) ##define.fileNamelength(260) ##define.structSize(76) # #client static str getSaveFileName(int _hwnd, # container _conFilter, # str _strInitialPath, # str _dialogTitle, # str _strDefaultExtension='', # str _strDefaultFileName='', # int _flags = #OFN_OVERWRITEPROMPT) #{ # Binary oFN, bFileName, bStrFilter, bStrInitialPath, bDialogTitle, bstrDefaultExtension; # str tmpstr; # str sFileName; # int strOffset, i; # Info info; # # DLL _DLL = new DLL('COMDLG32'); # DLLFunction _getSaveFileName = new DLLFunction(_DLL, 'GetSaveFileNameA'); # _getSaveFileName.returns(ExtTypes::DWord); # _getSaveFileName.arg(ExtTypes::Pointer); # # strOffset = 0; # for (i=1; i<=conLen(_conFilter); i++) # strOffset += 9 + strLen(conPeek(_confilter, i)); //" (*.xxx)/0" # # info = new Info(); # bFileName = new Binary(#fileNamelength); # oFN = new Binary(#structSize); # bStrFilter = new Binary(strOffset + 2); # bstrDefaultExtension = new Binary(#fileNamelength); # bStrInitialPath = new Binary(_strInitialPath); # bDialogTitle = new Binary(_dialogTitle); # # bFileName.string(#Offset0, _strDefaultFileName); # # strOffset = 0; # for (i=1; i<=conLen(_conFilter); i++) # { # tmpstr = conPeek(_confilter, i); # if (i mod 2) # tmpstr += ' ('+conPeek(_confilter, i+1)+')'; # bStrFilter.string(strOffset, tmpstr); # strOffset += 1 + strLen(tmpstr); # } # # oFN.dWord(#Offset0 , #structSize); # oFN.dWord(#offset4 , _hwnd); # oFN.dWord(#offset8 , info.instance()); # oFN.binary(#offset12 , bStrFilter); # oFN.dWord(#offset16 , 0); # oFN.dWord(#offset20 , 0); # oFN.dWord(#offset24 , 1); # oFN.binary(#offset28 , bFileName); # oFN.dWord(#offset32 , 260); # oFN.dWord(#offset36 , 0); # oFN.dWord(#offset40 , 0); # oFN.binary(#offset44 , bStrInitialPath); # oFN.binary(#offset48 , bDialogTitle); # oFN.dWord(#offset52 , _flags | # #OFN_HIDEREADONLY | # #OFN_PATHMUSTEXIST | # #OFN_SHAREAWARE | # #OFN_NOCHANGEDIR | # #OFN_FILEMUSTEXIST | # #OFN_EXPLORER); # oFN.word(#offset56 , 0); # oFN.word(#offset58 , 0); # oFN.binary(#offset60 , bstrDefaultExtension); # oFN.dWord(#offset64 , 0); # oFN.dWord(#offset68 , 0); # oFN.dWord(#offset72 , 0); # # if(_getSaveFileName.call(oFN)) # { # sFileName = bFileName.string(#Offset0); # } # else # sFileName = ''; # # if (sFileName) # { # sFileName = fileNameTrim(sFileName); # } # # return sFileName; #} ENDSOURCE SOURCE #getScrollInfo ##define.structSize(28) ##WinApi #client static container getScrollInfo(int hwnd, # int flag) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getScrollInfo = new DLLFunction(_winApiDLL, 'GetScrollInfo'); # Binary _scrollInfo = new Binary(#structSize); # # _scrollInfo.dWord( #offset0, #structSize); # _scrollInfo.dWord( #offset4, #SIF_ALL); # # _getScrollInfo.returns(ExtTypes::DWord); # _getScrollInfo.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer); # # if (_getScrollInfo.call(hwnd, flag, _scrollInfo)) # return [_scrollInfo.dWord(#offset8), // minValue # _scrollInfo.dWord(#offset12), // maxValue # _scrollInfo.dWord(#offset16), // pageSize # _scrollInfo.dWord(#offset20)]; // pos # return [WinAPI::getLastError()]; #} ENDSOURCE SOURCE #getScrollPos #client static int getScrollPos(int hwnd, int flags) #{ # DLL _winApiDLL = new DLL('USER32'); # int i; # DLLFunction _getScrollPos = new DLLFunction(_winApiDLL, 'GetScrollPos'); # # _getScrollPos.returns(ExtTypes::DWord); # _getScrollPos.arg(ExtTypes::DWord, ExtTypes::DWord); # # i = _getScrollPos.call(hwnd, flags); # # return i; #} ENDSOURCE SOURCE #getScrollRange #static client container getScrollRange(int hwnd, int flags) #{ # DLL _winApiDLL = new DLL('USER32'); # Binary Bmin = new Binary(#SizeOfInt); # Binary Bmax = new Binary(#SizeOfInt); # DLLFunction _getScrollRange = new DLLFunction(_winApiDLL, 'GetScrollRange'); # # _getScrollRange.returns(ExtTypes::DWord); # _getScrollRange.arg(ExtTypes::DWord, ExtTypes::DWord, ExtTypes::Pointer, ExtTypes::Pointer); # # if (_getScrollRange.call(hwnd, flags, Bmin, Bmax)) # return [WinAPI::getLastError()]; # else # return [Bmin.dWord(#Offset0), Bmax.dWord(#Offset0)]; #} ENDSOURCE SOURCE #getShortPathName #client static str getShortPathName(filename filename) #{ # #WinAPI # DLL DLL = new DLL(#KERNELDLL); # DLLFunction method = new DLLFunction(DLL, 'GetShortPathNameA'); # Binary path = new Binary(#Max_Path); # # method.returns(ExtTypes::DWord); # method.arg(ExtTypes::String, // filename # ExtTypes::Pointer, // nFolder # ExtTypes::DWord); // size # # method.call(filename, path, #Max_Path); # # return path.string(0); #} # ENDSOURCE SOURCE #getStockObject #static int getStockObject(int stockObject) #{ # DLL _winApiDLL = new DLL('GDI32'); # DLLFunction _getStockObject = new DLLFunction(_winApiDLL, 'GetStockObject'); # # _getStockObject.returns(ExtTypes::DWord); # _getStockObject.arg(ExtTypes::DWord); # # return _getStockObject.call(stockObject); #} ENDSOURCE SOURCE #getSubMenu #client static int getSubMenu(HWND popupHandle, int pos) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getSubMenu = new DLLFunction(_winApiDLL, 'GetSubMenu'); # _getSubMenu.returns(ExtTypes::DWord); # _getSubMenu.arg(ExtTypes::DWord); # _getSubMenu.arg(ExtTypes::DWord); # # return _getSubMenu.call(popupHandle, pos); #} ENDSOURCE SOURCE #getSysColor #client static Container getSysColor(int hColor) #{ # int RGB; # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getSysColor = new DLLFunction(_winApiDLL, 'GetSysColor'); # _getSysColor.returns(ExtTypes::DWord); # _getSysColor.arg(ExtTypes::DWord); # # RGB = _getSysColor.call(hColor); # # return [RGB & 0xff, (RGB & 0xff00)>>#offset8 , (RGB & 0xff0000)>>#offset16]; # #} ENDSOURCE SOURCE #getSystemDirectory ##define.structSize(256) #client server static str getSystemDirectory() #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getSystemDirectory = new DLLFunction(_winApiDLL, 'GetSystemDirectoryA'); # Binary struct = new Binary(#structSize); # ; # struct.dWord(#Offset0,#structSize); # # _getSystemDirectory.returns(ExtTypes::DWord); # _getSystemDirectory.arg(ExtTypes::Pointer, # ExtTypes::DWord); # # if (_getSystemDirectory.call(struct, #structSize) == 0) # return ''; # else # return struct.string(#Offset0); #} ENDSOURCE SOURCE #getSystemInfo #static container getSystemInfo() #// dwOEMID #//dwPageSize #//lpMinimumAppplicationAddress #//lpMaximumApplicationAddress #//dwActiveProcessorMask #//dwNumberOfProcessors #//dwProcessorType #//dwAllocationGranularity #//wProcessorLevel #//wProcessorRevision #{ # #define.structSize(4+4*9) # DLLFunction _getSystemInfo ; # Binary struct = new Binary(#structSize); # DLL _DLL = new DLL(#kernelDLL); # _getSystemInfo = new DLLFunction(_DLL, 'GetSystemInfo'); # # _getSystemInfo.returns(ExtTypes::DWord); # _getSystemInfo.arg(ExtTypes::Pointer); # #// struct.dword (#offset0, #structSize); # struct.word (#offset0, 0 ); // wProcessorArchitecture # struct.word(#offset2, 0); // wreserved # struct.dWord (#offset4, 0 ); //dwPageSize # struct.dWord (#offset8, 0 ); //lpMinimumAppplicationAddress # struct.dWord (#offset12, 0 ); //lpMaximumApplicationAddress # struct.dWord (#offset16, 0 ); //dwActiveProcessorMask # struct.dWord (#offset20, 0 ); //dwNumberOfProcessors # struct.dWord (#offset24, 0 ); //dwProcessorType # struct.dWord (#offset28, 0 ); //dwAllocationGranularity # struct.word (#offset32, 0 ); //wProcessorLevel # struct.word (#offset34, 0 ); //wProcessorREvision # # # # if (_getSystemInfo.call(struct)) # { # return [struct.dWord(#offset0), # struct.dWord(#offset4), # struct.dWord(#offset8), # struct.dWord(#offset12),struct.dWord(#offset16),struct.dWord(#offset20), # struct.dWord(#offset24),struct.dWord(#offset28), # struct.word(#offset32), struct.word(#offset34)]; # } # # return conNull(); # #} ENDSOURCE SOURCE #getSystemLocaleDateStr #static str getSystemLocaleDateStr() #{ # DLL DLL; # DLLFunction DLLFunction; # Binary strDate; # ; # # #WinAPI # # DLL = new DLL('kernel32.dll'); # DLLFunction = new DLLFunction(DLL,'GetLocaleInfoA'); # strDate = new Binary(80); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::Pointer, ExtTypes::DWord); # DLLFunction.returns(ExtTypes::DWord); # # DLLFunction.call(#LOCALE_SYSTEM_DEFAULT,#LOCALE_SSHORTDATE,strDate,80); # return strDate.string(0); #} ENDSOURCE SOURCE #getSystemLocaleTimeStr #static str getSystemLocaleTimeStr() #{ # DLL DLL; # DLLFunction DLLFunction; # Binary strDate; # ; # # #WinAPI # # DLL = new DLL('kernel32.dll'); # DLLFunction = new DLLFunction(DLL,'GetLocaleInfoA'); # strDate = new Binary(80); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::Pointer, ExtTypes::DWord); # DLLFunction.returns(ExtTypes::DWord); # # DLLFunction.call(#LOCALE_SYSTEM_DEFAULT,#LOCALE_STIMEFORMAT,strDate,80); # return strDate.string(0); #} ENDSOURCE SOURCE #getSystemMetrics #client server static int getSystemMetrics(int entry) #{ # DLL _winApiDLL = new DLL(#UserDLL); # DLLFunction _getSystemMetrics = new DLLFunction(_winApiDLL, 'GetSystemMetrics'); # # _getSystemMetrics.returns(ExtTypes::DWord); # _getSystemMetrics.arg(ExtTypes::DWord); # # return _getSystemMetrics.call(entry); #} ENDSOURCE SOURCE #getTempFilename #client server static str getTempFilename(str dirname, str prefix) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getTempFilename = new DLLFunction(_winApiDLL, 'GetTempFileNameA'); # Binary retval = new Binary(1000); # ; # # _getTempFilename.returns(ExtTypes::DWord); # _getTempFilename.arg(ExtTypes::String, ExtTypes::String, ExtTypes::DWord, ExtTypes::Pointer); # # if (_getTempFilename.call(dirname, prefix, 0, retval) == 0) # return ''; // Failure. # else # return retval.string(0); #} ENDSOURCE SOURCE #getTempPath ##define.structSize(256) #client server static str getTempPath() #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getTempPath = new DLLFunction(_winApiDLL, 'GetTempPathA'); # Binary struct = new Binary(#structSize); # ; # struct.dWord(#Offset0,#structSize); # # _getTempPath.returns(ExtTypes::DWord); # _getTempPath.arg(ExtTypes::DWord, # ExtTypes::Pointer); # # if (_getTempPath.call(#structSize, struct) == 0) # return ''; # return struct.string(#Offset0); #} ENDSOURCE SOURCE #getTickCount #client server static int getTickCount() #{ # DLL _DLL = new DLL('KERNEL32'); # DLLFunction _getTickCount = new DLLFunction(_DLL, 'GetTickCount'); # # _getTickCount.returns(ExtTypes::DWord); # # return _getTickCount.call(); #} ENDSOURCE SOURCE #getUNCPath ##define.structSize(256) ##define.sizeOfInt(4) ##define.Offset0(0) #// The dirName must be in "d:" format i.e. including the colon #client static str getUNCPath(str dirName) #{ # DLL _winApiDLL = new DLL('mpr'); # DLLFunction _getNetPath = new DLLFunction(_winApiDLL, 'WNetGetConnectionA'); # Binary _returnValue = new Binary(#structSize); # Binary size = new Binary(#SizeOfInt); # # int NO_ERROR = 0; # int functionResult; # ; # size.dWord(#Offset0,#structSize); # # _getNetPath.returns(ExtTypes::DWord); # _getNetPath.arg(ExtTypes::String, ExtTypes::Pointer, ExtTypes::Pointer); # # functionResult = _getNetPath.call(dirName, _returnValue, size); # if (functionResult == NO_ERROR) # return _returnValue.string(0); # else # { # return ''; # } # return ''; #} ENDSOURCE SOURCE #getUserLocaleDateStr #static str getUserLocaleDateStr() #{ # DLL DLL; # DLLFunction DLLFunction; # Binary strDate; # ; # # #WinAPI # # DLL = new DLL('kernel32.dll'); # DLLFunction = new DLLFunction(DLL,'GetLocaleInfoA'); # strDate = new Binary(80); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::Pointer, ExtTypes::DWord); # DLLFunction.returns(ExtTypes::DWord); # # DLLFunction.call(#LOCALE_USER_DEFAULT,#LOCALE_SSHORTDATE,strDate,80); # return strDate.string(0); #} ENDSOURCE SOURCE #getUserLocaleFirstDayOfWeekInt #static int getUserLocaleFirstDayOfWeekInt() #{ # DLL DLL; # DLLFunction DLLFunction; # Binary dayOfWeek; # ; # # #WinAPI # # DLL = new DLL('kernel32.dll'); # DLLFunction = new DLLFunction(DLL,'GetLocaleInfoA'); # dayOfWeek = new Binary(4); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::Pointer, ExtTypes::DWord); # DLLFunction.returns(ExtTypes::DWord); # # DLLFunction.call(#LOCALE_USER_DEFAULT,#LOCALE_RETURN_NUMBER | #LOCALE_IFIRSTDAYOFWEEK,dayOfWeek,1); # return dayOfWeek.dWord(0); #} ENDSOURCE SOURCE #getUserLocaleTimeStr #static str getUserLocaleTimeStr() #{ # DLL DLL; # DLLFunction DLLFunction; # Binary strDate; # ; # # #WinAPI # # DLL = new DLL('kernel32.dll'); # DLLFunction = new DLLFunction(DLL,'GetLocaleInfoA'); # strDate = new Binary(80); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord,ExtTypes::Pointer, ExtTypes::DWord); # DLLFunction.returns(ExtTypes::DWord); # # DLLFunction.call(#LOCALE_USER_DEFAULT,#LOCALE_STIMEFORMAT,strDate,80); # return strDate.string(0); #} ENDSOURCE SOURCE #getUserName ##define.structSize(255) #client static str getUserName () #{ # DLLFunction _getUserNameA ; # Binary bSize = new Binary(#SizeOfInt); # Binary bStr = new Binary(#structSize); # DLL _DLL = new DLL('ADVAPI32'); # # bSize.dWord(#Offset0,#structSize); # # _getUserNameA = new DLLFunction(_DLL, 'GetUserNameA'); # _getUserNameA .returns(ExtTypes::DWord); # _getUserNameA .arg(ExtTypes::Pointer, # ExtTypes::Pointer); # # if (_getUserNameA .call(bStr,bSize)) # { # return bStr.string(#Offset0); # } # else # return ""; #} ENDSOURCE SOURCE #getVersion ##define.structSize(20+128) #client server static container getVersion() #{ # DLLFunction _getVersionExA ; # Binary struct = new Binary(#structSize); # DLL _DLL = new DLL('KERNEL32'); # _getVersionExA = new DLLFunction(_DLL, 'GetVersionExA'); # # _getVersionExA.returns(ExtTypes::DWord); # _getVersionExA.arg(ExtTypes::Pointer); # # struct.dWord (#offset0, #structSize); # struct.dWord (#offset4, 0 ); //dwMajorVersion # struct.dWord (#offset8, 0 ); //dwMinorVersion # struct.dWord (#offset12, 0 ); //dwBuildNumber # struct.dWord (#offset16, 0 ); //dwPlatformID 0=Win 3.x, 1=95/98, 2=WinNT, 3=... # struct.dWord (#offset20, 0 ); //szCSDVersion add. info # # if (_getVersionExA.call(struct)) # { # return [struct.dWord(#offset4),struct.dWord(#offset8),struct.dWord(#offset12),struct.dWord(#offset16),struct.string(#offset20)]; # } # # return conNull(); #} ENDSOURCE SOURCE #getWindow #client static public HWND getWindow(HWND _hWnd, int _cmd) #{ # DLL DLL; # DLLFunction DLLFunction; # HWND hWnd; # ; # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'GetWindow'); # DLLFunction.returns(ExtTypes::DWord); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::DWord); # hWnd = DLLFunction.call(_hWnd,_cmd); # # return hWnd; #} ENDSOURCE SOURCE #getWindowDC #client static int getWindowDC(int hWnd) #{ # DLL _winApiDLL = new DLL(#UserDLL); # DLLFunction _getWindowDC = new DLLFunction(_winApiDLL, 'GetWindowDC'); # int hDC; # # _getWindowDC.returns(ExtTypes::DWORD); # _getWindowDC.arg(ExtTypes::DWORD); # hDC = _getWindowDC.call(hWnd); # # return hDC; #} ENDSOURCE SOURCE #getWindowLong #static int getWindowLong(HWND _HWND, int _nIndex) #{ # DLL DLL; # DLLFunction DLLFunction; # ; # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'GetWindowLongA'); # DLLFunction.arg(ExtTypes::DWord, ExtTypes::DWord); # DLLFunction.returns(ExtTypes::DWord); # # return DLLFunction.call(_HWND, _nIndex); #} ENDSOURCE SOURCE #getWindowsDirectory ##define.structSize(256) #client server static str getWindowsDirectory() #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _getWindowsDirectory = new DLLFunction(_winApiDLL, 'GetWindowsDirectoryA'); # Binary struct = new Binary(#structSize); # ; # struct.dWord(#Offset0,#structSize); # # _getWindowsDirectory.returns(ExtTypes::DWord); # _getWindowsDirectory.arg(ExtTypes::Pointer, # ExtTypes::DWord); # # if (_getWindowsDirectory.call(struct, #structSize) == 0) # return ''; # else # return struct.string(#Offset0); #} ENDSOURCE SOURCE #getWindowText #/* # * Retrives the caption of a window, the string size is set to max MAXSTRINGSIZE. #*/ #client static public str getWindowText(HWND _hWnd) #{ # #define.MAXSTRINGSIZE(255) # DLL DLL; # DLLFunction DLLFunction; # binary buffer; # ; # # buffer = new Binary(#MAXSTRINGSIZE); # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'GetWindowTextA'); # DLLFunction.returns(ExtTypes::DWord); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::Pointer,ExtTypes::DWord); # DLLFunction.call(_hWnd, buffer, #MAXSTRINGSIZE); # # return buffer.string(0); #} ENDSOURCE SOURCE #globalAlloc #client server static int globalAlloc(int flags, int size) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _globalAlloc = new DLLFunction(_winApiDLL, 'GlobalAlloc'); # # _globalAlloc.returns(ExtTypes::DWord); # _globalAlloc.arg(ExtTypes::DWord, ExtTypes::DWord); # # return _globalAlloc.call(flags, size); #} ENDSOURCE SOURCE #globalFree #client server static int globalFree(int handle) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _globalFree = new DLLFunction(_winApiDLL, 'GlobalFree'); # _globalFree.returns(ExtTypes::DWord); # _globalFree.arg(ExtTypes::DWord); # # return _globalFree.call(handle); #} ENDSOURCE SOURCE #globalLock #client server static int globalLock(int handle) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _globalLock = new DLLFunction(_winApiDLL, 'GlobalLock'); # _globalLock.returns(ExtTypes::DWord); # _globalLock.arg(ExtTypes::DWord); # # return _globalLock.call(handle); #} ENDSOURCE SOURCE #globalUnLock #client server static boolean globalUnLock(int handle) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _globalUnlock = new DLLFunction(_winApiDLL, 'GlobalUnlock'); # _globalUnlock.returns(ExtTypes::DWord); # _globalUnlock.arg(ExtTypes::DWord); # # return _globalUnlock.call(handle); #} ENDSOURCE SOURCE #htmlHelp ##WinApi # #client static int htmlHelp( # Filename _helpFile, # int _data = 0, # str _topic = '' # ) #{ # int _command = #HH_DISPLAY_TOPIC; # DLL HHDLL = new DLL('HHCTRL.OCX'); # DLLFunction _htmlHelpA = new DLLFunction(HHDLL, 'HtmlHelpA'); # # if (_data) # _command = #HH_HELP_CONTEXT; # # if (_topic) # { # _command = #HH_DISPLAY_TOPIC; # _helpFile += '::\\'+_topic+'>mainwin'; # } # _htmlHelpA.returns(ExtTypes::DWord); # _htmlHelpA.arg(ExtTypes::DWord, // Hwnd # ExtTypes::String, // HelpFile # ExtTypes::DWord, // Command # ExtTypes::DWord); // Data # # return _htmlHelpA.call(0,_helpFile,_command,_data); #} ENDSOURCE SOURCE #imageTransparentColor #static int imageTransparentColor() #{ # return WinAPI::RGB2int(127,255,127); #} ENDSOURCE SOURCE #InternetCanonicalizeUrl ##define.maxLen(250) #client server static str InternetCanonicalizeUrl(url url) #{ # DLL _winApiDLL = new DLL('WinInet'); # DLLFunction _function = new DLLFunction(_winApiDLL, 'InternetCanonicalizeUrlA'); # Binary binary = new binary(#maxLen); # Binary lengthbinary = new binary(#offset4); # # lengthBinary.dWord(0, #maxLen); # # _function.returns(ExtTypes::DWord); # _function.arg(ExtTypes::String, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::DWord); # # if (_function.call(url, binary, lengthBinary, 0 ) == 0) # return ''; # return binary.string(0); #} ENDSOURCE SOURCE #invalidateRect #client static boolean invalidateRect(int _handle) #{ # DLL _DLL = new DLL('USER32'); # DLLFunction _shwwind = new DLLFunction(_DLL, 'InvalidateRect'); # int _dllret; #; # _shwwind.returns(ExtTypes::DWord); // BOOL # _shwwind.arg(ExtTypes::DWord); // handle window # _shwwind.arg(ExtTypes::DWord); // const RECT *lpRect # _shwwind.arg(ExtTypes::DWord); // BOOL bErase # # return _shwwind.call(_handle, 0, 1); #} ENDSOURCE SOURCE #IsControlButtonDown # // returns true if the shift button is pressed at the time of invocation ##define.VK_CONTROL(0x11) #static boolean isControlButtonDown() #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getKeyState = new DLLFunction(_winApiDLL, 'GetKeyState'); # int retval; # # _getKeyState.returns(ExtTypes::Word); # _getKeyState.arg(ExtTypes::DWord); # # retval = _getKeyState.call(#VK_CONTROL); # # return retval > 0x7FFF; #} ENDSOURCE SOURCE #isNTPlatform #/* # * Returns true if this is a WindowsNT, Windows2000, WindowsXP, or similar operating system. #*/ #client server static public boolean isNTPlatform() #{ # #WinAPI # #define.OSVERSIONINFOSIZE(148) # container conVersion; # # conVersion = WinAPI::getOSVersion(); # # return conpeek(conVersion,3) == #VER_PLATFORM_WIN32_NT ? true : false; #} ENDSOURCE SOURCE #IsShiftButtonDown # // returns true if the shift button is pressed at the time of invocation ##define.VK_SHIFT(0x10) #static boolean isShiftButtonDown() #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _getKeyState = new DLLFunction(_winApiDLL, 'GetKeyState'); # int retval; # # _getKeyState.returns(ExtTypes::Word); # _getKeyState.arg(ExtTypes::DWord); # # retval = _getKeyState.call(#VK_SHIFT); # # return retval > 0x7FFF; #} ENDSOURCE SOURCE #isWindow #client static boolean isWindow(int _handle) #{ # DLL _DLL = new DLL('USER32'); # DLLFunction _isWindow = new DLLFunction(_DLL, 'IsWindow'); # int _dllRet; # # _isWindow.returns(ExtTypes::DWord); # _isWindow.arg(ExtTypes::DWord); # # _dllRet = _isWindow.call(_handle); # # if (_dllRet) # return TRUE; # # return FALSE; #} ENDSOURCE SOURCE #loadBitmap #client server static int loadBitmap(int resource) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _loadBitmapA = new DLLFunction(_winApiDLL, 'LoadBitmapA'); # Info info = new Info(); # # _loadBitmapA.returns(ExtTypes::DWord); # _loadBitmapA.arg(ExtTypes::DWord, # ExtTypes::DWord); # # return _loadBitmapA.call(info.instance(), resource); #} ENDSOURCE SOURCE #loadImage #client server static int loadImage(int _hInst, str _name, int _type, int _xDesired, int _yDesired, int _load) #{ # #WinAPI # # DLL DLL; # DLLFunction DLLFunction; # ; # # DLL = new DLL(#UserDLL); # DLLFunction = new DLLFunction(DLL,'LoadImageA'); # # DLLFunction.arg(ExtTypes::DWord,ExtTypes::String,ExtTypes::DWord,ExtTypes::DWord,ExtTypes::DWord,ExtTypes::DWord); # DLLFunction.returns(ExtTypes::DWord); # # return DLLFunction.call(_hInst, _name, _type, _xDesired, _yDesired, _load); #} ENDSOURCE SOURCE #loadStdCursor #client server static int loadStdCursor(int hCursor) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _loadStdCursor = new DLLFunction(_winApiDLL, 'LoadCursorA'); # # _loadStdCursor.returns(ExtTypes::DWord); # _loadStdCursor.arg(ExtTypes::DWord, # ExtTypes::DWord); # # return _loadStdCursor.call(#Offset0, hCursor); #} ENDSOURCE SOURCE #lookupPrivilegeValue ##winapi #client server static Binary lookupPrivilegeValue(str _systemName, str _name) #{ # DLL winApiDLL = new DLL(#ADVAPI32DLL); # DLLFunction lookupPrivilegeValue; # Binary value = new Binary(#SizeOfInt + #SizeOfInt); # container con = WinAPI::getVersion(); # # // OpenProcessToken is not supported on Windows 9x # if (conPeek(con, 4) != #VER_PLATFORM_WIN32_NT) # return NULL; # # lookupPrivilegeValue = new DLLFunction(winApiDLL, 'LookupPrivilegeValueA'); # # lookupPrivilegeValue.returns(ExtTypes::DWord); # lookupPrivilegeValue.arg(ExtTypes::String, # ExtTypes::String, # ExtTypes::Pointer); # # if (!lookupPrivilegeValue.call(_systemName, _name, value)) # return NULL; # # return value; #} ENDSOURCE SOURCE #lstrcpy #client server static void lstrcpy(int dest, str src) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # Binary b = new Binary(src); # DLLFunction _lstrcpy = new DLLFunction(_winApiDLL, 'lstrcpy'); # _lstrcpy.returns(ExtTypes::DWord); # _lstrcpy.arg(ExtTypes::Pointer); # _lstrcpy.arg(ExtTypes::String); # # _lstrcpy.call(dest, b); #} ENDSOURCE SOURCE #MaximizeWindow #client static int maximizeWindow(int _handle) #{ # ; # return WinAPI::sendMessageEx(_handle, #WM_SYSCOMMAND, #SC_MAXIMIZE, 0); #} ENDSOURCE SOURCE #MinimizeWindow #client static int minimizeWindow(int _handle) #{ # ; # return WinAPI::DefWindowProc(_handle, #SC_MINIMIZE); #} # ENDSOURCE SOURCE #moveFile #client server static int moveFile(str fileName, str newFileName) #{ # DLL _winApiDLL = new DLL(#KERNELDLL); # DLLFunction _moveFile = new DLLFunction(_winApiDLL, 'MoveFileA'); # # _moveFile.returns(ExtTypes::DWord); # _moveFile.arg(ExtTypes::String, # ExtTypes::String); # # if (_moveFile.call(fileName, newFileName) == 0) # return WinAPI::getLastError(); # return 0; #} ENDSOURCE SOURCE #moveFileEx #client server static int moveFileEx(str fileName, str newFileName, int flags = 0) #{ # DLL _winApiDLL = new DLL(#KERNELDLL); # DLLFunction _moveFile = new DLLFunction(_winApiDLL, 'MoveFileExA'); # # _moveFile.returns(ExtTypes::DWord); # _moveFile.arg(ExtTypes::String, # ExtTypes::String, # ExtTypes::DWord); # # if (!_moveFile.call(fileName, newFileName, flags) == 0) # return WinAPI::getLastError(); # return 0; #} ENDSOURCE SOURCE #MoveMemory #client server static void moveMemory(Binary dest, int source, int len) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _moveMemory = new DLLFunction(_winApiDLL, 'RtlMoveMemory'); # # _moveMemory.returns(ExtTypes::void); # _moveMemory.arg(ExtTypes::Pointer); # _moveMemory.arg(ExtTypes::DWord); # _moveMemory.arg(ExtTypes::DWord); # # _moveMemory.call(dest, source, len); #} #// client server static binary verQueryValue(binary info, str query) ENDSOURCE SOURCE #NavisionColorBeige #client server static int navisionColorBeige() #{ # return WinAPI::RGB2int(0x0cb,0x0b9,0x09c); #} ENDSOURCE SOURCE #NavisionColorBlue #client server static int navisionColorBlue() #{ # return WinAPI::RGB2int(0x099,0x0cc,0x0ff); #} ENDSOURCE SOURCE #NavisionColorRed #client server static int navisionColorRed() #{ # return WinAPI::RGB2int(0x0dd,0x000,0x000); #} ENDSOURCE SOURCE #olapRootDir #static client FilePath olapRootDir() #{ # #winAPI # container reg = conNull(); # FilePath filePath; # int handle; # # handle = WinAPI::regOpenKey(#HKEY_LOCAL_MACHINE, 'Software\\Microsoft\\Olap Server\\Uninstall info', #KEY_READ); # reg = WinAPI::regGetValue(handle, 'RootDir'); # WinAPI::regCloseKey(handle); # # if (reg) # { # [filePath] = reg; # } # # return filePath; #} ENDSOURCE SOURCE #openClipboard #client static boolean openClipboard(int hwnd) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _openClipboard = new DLLFunction(_winApiDLL, 'OpenClipboard'); # # _openClipboard.returns(ExtTypes::DWord); # _openClipboard.arg(ExtTypes::DWord); # # return _openClipboard.call(hwnd); #} ENDSOURCE SOURCE #openProcessToken ##winapi #client server static int openProcessToken(int _processHandle, int _access) #{ # DLL winApiDLL = new DLL(#ADVAPI32DLL); # DLLFunction openProcessToken; # Binary value = new Binary(#SizeOfInt); # container con = WinAPI::getVersion(); # # // OpenProcessToken is not supported on Windows 9x # if (conPeek(con, 4) != #VER_PLATFORM_WIN32_NT) # return 0; # # openProcessToken = new DLLFunction(winApiDLL, 'OpenProcessToken'); # # openProcessToken.returns(ExtTypes::DWord); # openProcessToken.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer); # # if (!openProcessToken.call(_processHandle, _access, value)) # return 0; # # return value.dWord(#offset0); #} ENDSOURCE SOURCE #pathExists ##define.fileNameSize(255) #client server static boolean pathExists(str fileName) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # Binary dname = new Binary(fileName); # Binary currentName = new Binary(#fileNameSize); # DLLFunction _setCurrentDirectory = new DLLFunction(_winApiDLL, 'SetCurrentDirectoryA'); # DLLFunction _getCurrentDirectory = new DLLFunction(_winApiDLL, 'GetCurrentDirectoryA'); # boolean pathExist,setPath; # int dirLength; # ; # # _getCurrentDirectory.returns(ExtTypes::DWord); # _getCurrentDirectory.arg(ExtTypes::DWord,ExtTypes::Pointer); # # dirLength = _getCurrentDirectory.call(#fileNameSize,currentName); # # _setCurrentDirectory.returns(ExtTypes::DWord); # _setCurrentDirectory.arg(ExtTypes::Pointer); # # pathExist = _setCurrentDirectory.call(dname); # # setPath = _setCurrentDirectory.call(currentName); # # return pathExist; #} ENDSOURCE SOURCE #regCloseKey #client server static void regCloseKey(int keyHandle) #{ # DLL _winApiDLL = new DLL('AdvApi32'); # DLLFunction _regCloseKey = new DLLFunction(_winApiDLL, 'RegCloseKey'); # # _regCloseKey.returns(ExtTypes::DWord); # _regCloseKey.arg(ExtTypes::DWord); # # _regCloseKey.call(keyHandle); #} ENDSOURCE SOURCE #regCreateKeyEx #/* # Returns container with [keyHandle, isNewKey] # int keyHandle - handle to new or opened key # boolean isNewKey - indicates if the key was created or existed and just opened. #*/ # ##winapi ##define.SizeOfInt(4) #client static container regCreateKeyEx( # int hKey, // handle to open key # str subKeyName // subkey name #) #{ #/* #LONG RegCreateKeyEx( # HKEY hKey, // handle to open key # LPCTSTR lpSubKey, // subkey name # DWORD Reserved, // reserved - always 0 # LPTSTR lpClass, // class string # DWORD dwOptions, // special options # REGSAM samDesired, // desired security access # LPSECURITY_ATTRIBUTES lpSecurityAttributes, // inheritance # PHKEY phkResult, // key handle # LPDWORD lpdwDisposition // disposition value buffer #); # #*/ # DLL _DLL = new DLL('ADVAPI32'); # DLLFunction _regCreateKeyEx = new DLLFunction(_DLL, 'RegCreateKeyExA'); # Binary handle = new Binary(#SizeOfInt); # Binary disposition = new Binary(#SizeOfInt); # container keyAndIndicator; # ; # # _regCreateKeyEx.returns(ExtTypes::DWord); // LONG # _regCreateKeyEx.arg(ExtTypes::DWord, // handle to open key # ExtTypes::String, // subkey name # ExtTypes::DWord, // resereved # ExtTypes::String, // class string # ExtTypes::DWord, // special options # ExtTypes::DWord, // desired security access # ExtTypes::DWORD, // inheritance # ExtTypes::Pointer, // key handle # ExtTypes::Pointer); // create or get flag # # if (_regCreateKeyEx.call(hKey, subKeyName, 0,'', #REG_OPTION_NON_VOLATILE, #KEY_ALL_ACCESS, 0, handle, disposition) == #Error_success) # return [handle.dWord(0), disposition.dWord(0)]; # return keyAndIndicator; #} ENDSOURCE SOURCE #regEnumKey ##define.buffersize(2048) # #client server static str regEnumKey(int keyHandle, int subKey) #{ # DLL _winApiDLL = new DLL('ADVAPI32'); # DLLFunction _regEnumKey = new DLLFunction(_winApiDLL, 'RegEnumKeyExA'); # Binary _buffer = new Binary(#buffersize); # Binary _size = new Binary(#SizeOfInt); # Binary _time = new Binary(#offset8); # # _size.dWord(#Offset0, #buffersize); # # _regEnumKey.returns(ExtTypes::DWord); # _regEnumKey.arg( ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer); # # if (!_regEnumKey.call(keyHandle, subkey, _buffer, _size, 0, 0, 0, _time)) # { # return _buffer.string(#Offset0); # } # return ''; #} ENDSOURCE SOURCE #regEnumValue ##WinApi ##define.namesize(256) ##define.buffersize(2048) # #client server static container regEnumValue(int keyHandle, int subKey ) #{ # DLL _winApiDLL = new DLL('AdvApi32'); # DLLFunction _regEnumValue = new DLLFunction(_winApiDLL, 'RegEnumValueA'); # Binary _type = new Binary(#SizeOfInt); # Binary _name = new Binary(#namesize); # Binary _buffer = new Binary(#buffersize); # Binary _namesize = new Binary(#SizeOfInt); # Binary _size = new Binary(#SizeOfInt); # container c = conNull(); # container c2 = conNull(); # int i; # # _namesize.dWord(#Offset0, #namesize); # _size.dWord(#Offset0, #buffersize); # # _regEnumValue.returns( ExtTypes::DWord); # # _regEnumValue.arg( ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::DWord, # ExtTypes::Pointer, # ExtTypes::Pointer, # ExtTypes::Pointer); # # if (!_regEnumValue.call(keyHandle, subKey, _name, _namesize, 0, _type, _buffer, _size)) # { # c += _type.dWord(#Offset0); # c += _size.dWord(#Offset0); # c += _name.string(#Offset0); # # switch (_type.dWord(#Offset0)) # { # case #REG_BINARY: # c += [_buffer]; # break; # case #REG_DWORD: # case #REG_DWORD_LITTLE_ENDIAN: # case #REG_DWORD_BIG_ENDIAN: # c += _buffer.dWord(#Offset0); # break; # case #REG_EXPAND_SZ: # case #REG_SZ: # c += _buffer.string(#Offset0); # break; # case #REG_MULTI_SZ: # while (_buffer.byte(i)) # { # c2 += _buffer.string(i); # i += strLen(_buffer.string(i))+1; # } # c += c2; # break; # } # return c; # } # else # return [0,0,0,0]; #} ENDSOURCE SOURCE #regGetValue #static client server container regGetValue(int key, str keyValue) #{ # #winapi # # DLL advApiDll = new DLL('advapi32'); # DLLFunction regQueryValueEx = new DLLFunction(advApiDll, 'RegQueryValueExA'); # DLLFunction regQueryValueEx1 = new DLLFunction(advApiDll, 'RegQueryValueExA'); # Binary typeRef = new Binary(#SizeOfInt); # Binary sizeRef = new Binary(#SizeOfInt); # Binary resultRef; # int i, status; # container temp = conNull(); # container c = conNull(); # # regQueryValueEx.returns(ExtTypes::DWord); # regQueryValueEx.arg(ExtTypes::DWord, // HKEY # ExtTypes::String, // Name of value to query # ExtTypes::DWord, // Reserved # ExtTypes::Pointer, // pointer to DWORD. Address of buffer for value type # ExtTypes::DWord, // pointer to BYTE. Address of data buffer. 0 = fetch size # ExtTypes::Pointer); // pointer to DWORD. Address of data buffer size # # // Calculate the size of the return data... # status = regQueryValueEx.call(key, keyValue, 0, typeRef, 0, sizeRef); # # // Allocate a buffer large enough for the result # resultRef = new Binary(sizeRef.dWord(0)); # # regQueryValueEx1.returns(ExtTypes::DWord); # regQueryValueEx1.arg(ExtTypes::DWord, // HKEY # ExtTypes::String, // Name of value to query # ExtTypes::DWord, // Reserved # ExtTypes::Pointer, // pointer to DWORD. Address of buffer for value type # ExtTypes::Pointer, // pointer to BYTE. Address of data buffer # ExtTypes::Pointer); // pointer to DWORD. Address of data buffer size # # status = regQueryValueEx1.call(key, keyValue, 0, typeRef, resultRef, sizeRef); # # if (status == 0) // ERROR_SUCCESS # { # switch (typeRef.dWord(#Offset0)) # { # case #REG_BINARY: # c = [ resultRef ]; # break; # case #REG_DWORD: # case #REG_DWORD_LITTLE_ENDIAN: # case #REG_DWORD_BIG_ENDIAN: # c = [ resultRef.dWord(#Offset0) ]; # break; # case #REG_EXPAND_SZ: # case #REG_SZ: # c = [ resultRef.string(#Offset0) ]; # break; # case #REG_MULTI_SZ: # i = 0; # while (resultRef.byte(i)) # { # temp += resultRef.string(i); # i += strLen(resultRef.string(i))+1; # } # c += temp; # break; # } # } # # return c; #} # ENDSOURCE SOURCE #regOpenKey #static client server int regOpenKey(int hKey, str subKey, int regSam) #{ # DLL _winApiDLL = new DLL('ADVAPI32'); # DLLFunction _regOpenKey = new DLLFunction(_winApiDLL, 'RegOpenKeyExA'); # Binary b = new Binary(#SizeOfInt); # # _regOpenKey.returns(ExtTypes::DWord); # _regOpenKey.arg( ExtTypes::DWord, # ExtTypes::String, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer); # # _regOpenKey.call(hkey, subkey, 0, regSam, b); # return b.dWord(#Offset0); #} ENDSOURCE SOURCE #RegSetValueEx #client static boolean regSetValueEx( # int _hKey, # str _valuename, # int _dwType, # anytype _valuedata ) #{ # // LONG RegSetValueEx( # // HKEY hKey, - handle of key to set value for # // LPCTSTR lpValueName, - address of value to set # // DWORD Reserved, - reserved # // DWORD dwType, - flag for value type # // CONST BYTE *lpData, - address of value data # // DWORD cbData - size of value data # // ); # int ret = -1; # DLL _DLL = new DLL('ADVAPI32'); # DLLFunction _setvalueEx = new DLLFunction(_DLL, 'RegSetValueExA'); # Binary _data; # int _dllret; # int _iLen = 0; # int _t; # int _itype; # int _iData; # str _sData; # ; # # _setvalueEx.returns(ExtTypes::DWord); // LONG # _setvalueEx.arg(ExtTypes::DWord); // HKEY # _setvalueEx.arg(ExtTypes::String); // pChar to value # _setvalueEx.arg(ExtTypes::DWord); // reserved must be zero # _setvalueEx.arg(ExtTypes::DWord); // flag of value type # _setvalueEx.arg(ExtTypes::Pointer); // pChar to data # _setvalueEx.arg(ExtTypes::DWord); // length of data # # _iType = 0; # _t = typeof(_valuedata); # # switch (_dwType) { # case #REG_DWORD: # switch (_t) { # case Types::Enum, Types::Integer: # _iType = 1; # if (_t==Types::Enum) { # _iData = _valueData; # } # else { # _iData = _valuedata; # } # _data = new Binary(4); # _data.dWord(0, _iData); # _iLen = 4; # break; # } # break; # case #REG_SZ, #REG_EXPAND_SZ: # switch (_t) { # case Types::Enum, Types::Integer: # _iType = 2; # if (_t==Types::Enum) { # _iData = _valueData; # _sData = int2str(_iData); # } # else { # _iData = _valuedata; # _sData = int2str(_iData); # } # _iLen = strLen(_sData); # _data = new Binary(_iLen+1); # _data.string(0, _sData); # _iLen = 4; # break; # case Types::Real, Types::Date, Types::String, Types::RString, Types::VarString: # _iType = 2; # _sData = ''; # switch (_t) { # case Types::Real: # _sData = num2str(_valueData,0,16,1,0); # break; # case Types::Date: # _sData = date2str(_valuedata,123,2,2,2,2,4); # break; # default: # _sData = _valueData; # break; # } # _iLen = strLen(_sData); # _data = new Binary(_iLen+1); # _data.string(0, _sData); # break; # } # break; # } # _dllret = _setvalueEx.call(_hKey, _valuename, 0, _dwType, _data, _iLen ); # return _dllRet; #} ENDSOURCE SOURCE #releaseDC #client static void releaseDC(int hWnd, int hDC) #{ # DLL _winApiDLL = new DLL(#UserDLL); # DLLFunction _releaseDC = new DLLFunction(_winApiDLL, 'ReleaseDC'); # # _releaseDC.returns(ExtTypes::DWORD); # _releaseDC.arg(ExtTypes::DWORD,ExtTypes::DWORD); # _releaseDC.call(hWnd, hDC); #} ENDSOURCE SOURCE #releaseSemaphore #static boolean releaseSemaphore(int semHdl) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _releaseSemaphore = new DLLFunction(_winApiDLL, 'ReleaseSemaphore'); # ; # _releaseSemaphore.returns(ExtTypes::Byte); # _releaseSemaphore.arg(ExtTypes::DWord); # _releaseSemaphore.arg(ExtTypes::DWord); # _releaseSemaphore.arg(ExtTypes::DWord); # # return _releaseSemaphore.call(semHdl,1,0); #} ENDSOURCE SOURCE #removeDirectory #client server static int removeDirectory(str name) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _removeDirectory = new DLLFunction(_winApiDLL, 'RemoveDirectoryA'); # # _removeDirectory.returns(ExtTypes::DWord); # _removeDirectory.arg(ExtTypes::String); # # if (_removeDirectory.call(name) == 0) # return WinAPI::getLastError(); # else # return 0; #} ENDSOURCE SOURCE #renameFile #client server static int renameFile(str fileName, str newFileName) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # ; # # WinApi::copyFile(fileName, newFileName); # sleep(300); # WinApi::deleteFile(fileName); # sleep(300); # return 0; #} ENDSOURCE SOURCE #RGB2int #client server static int RGB2int(RGBint r, RGBint g, RGBint b) #{ # return r + g<<#offset8 + b<<#offset16; #} ENDSOURCE SOURCE #RGBCon2int #client server static int RGBCon2int(container RGB) #{ # int r,g,b; # [r, g, b] = RGB; # return r + g<<#offset8 + b<<#offset16; #} ENDSOURCE SOURCE #RGBint2Con #client server static container RGBint2Con(int RGB) #{ # return [RGB & 0xff, (RGB & 0xff00)>>8 , (RGB & 0xff0000)>>16]; #} ENDSOURCE SOURCE #screenToClient #client static container screenToClient(int hwnd, int x, int y) #{ # Binary point = new Binary(#offset8); # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _screenToClient = new DLLFunction(_winApiDLL, 'ScreenToClient'); # # _screenToClient.returns(ExtTypes::DWord); # _screenToClient.arg(ExtTypes::DWord, # ExtTypes::Pointer); # # point.dWord(#Offset0, x); # point.dWord(#SizeOfInt, y); # # _screenToClient.call(hwnd, point); # # x = point.dWord(#Offset0); # y = point.dWord(#SizeOfInt); # # return [x, y]; #} ENDSOURCE SOURCE #sendMessage #client static int sendMessage(int hWnd, # int msg, # int wParam, # str lParam) #{ # DLL _winApiDLL = new DLL('USER32'); # Binary b4 = new Binary(lParam); # DLLFunction _sendMessage = new DLLFunction(_winApiDLL, 'SendMessageA'); # # _sendMessage.returns(ExtTypes::DWord); # _sendMessage.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::String); # # return _sendMessage.call(hWnd, msg, wParam, b4); #} ENDSOURCE SOURCE #sendMessageEx #client static int sendMessageEx(int hWnd, # int msg, # int wParam, # int lParam) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _sendMessage = new DLLFunction(_winApiDLL, 'SendMessageA'); # # _sendMessage.returns(ExtTypes::DWord); # _sendMessage.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord); # # return _sendMessage.call(hWnd, msg, wParam, lParam); #} # # ENDSOURCE SOURCE #setClipboardData #client static int setClipboardData(int uFormat, # Binary b) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _setClipboardData = new DLLFunction(_winApiDLL, 'SetClipboardData'); # # _setClipboardData.returns(ExtTypes::DWord); # _setClipboardData.arg(ExtTypes::DWord, # ExtTypes::String); # # return _setClipboardData.call(uformat, b); #} ENDSOURCE SOURCE #setCurrentDirectory #client server static int setCurrentDirectory(str dirname) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _setCurrentDirectory = new DLLFunction(_winApiDLL, 'SetCurrentDirectoryA'); # # _setCurrentDirectory.returns(ExtTypes::DWord); # _setCurrentDirectory.arg(ExtTypes::String); # # if (_setCurrentDirectory.call(dirname) == 0) # return WinAPI::getLastError(); # else # return 0; #} ENDSOURCE SOURCE #setCursor #client static void setCursor(int hCursor) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _setCursor = new DLLFunction(_winApiDLL, 'SetCursor'); # # _setCursor.returns(ExtTypes::DWord); # _setCursor.arg(ExtTypes::DWord); # # _setCursor.call(hCursor); #} ENDSOURCE SOURCE #setCursorPos #client static int setCursorPos(int x, # int y) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _setCursorPos = new DLLFunction(_winApiDLL, 'SetCursorPos'); # # _setCursorPos.returns(ExtTypes::DWord); # _setCursorPos.arg(ExtTypes::DWord, # ExtTypes::DWord); # # return _setCursorPos.call(x, y); #} ENDSOURCE SOURCE #setFileAttributes #client server static int setFileAttributes(Filename name, int attr) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _setFileAttributes = new DLLFunction(_winApiDLL, 'SetFileAttributesA'); # # _setFileAttributes.returns(ExtTypes::DWord); # _setFileAttributes.arg(ExtTypes::String, # ExtTypes::DWord ); # # if (_setFileAttributes.call(name, attr) == 0) # return WinAPI::getLastError(); # else # return 0; #} ENDSOURCE SOURCE #setFileTime #/* MAN #The SetFileTime function sets the date and time that a file was created, last accessed, or last modified. #*/ #client server static boolean setFileTime(int hFile, Binary create, Binary access, Binary modified) #{ # DLL _winApiDLL = new DLL('KERNEL32'); # DLLFunction _setFileTime = new DLLFunction(_winApiDLL, 'SetFileTime'); # # _setFileTime.returns(ExtTypes::DWord); # _setFileTime.arg(ExtTypes::DWord); # _setFileTime.arg(ExtTypes::Pointer); # _setFileTime.arg(ExtTypes::Pointer); # _setFileTime.arg(ExtTypes::Pointer); # # if (_setFileTime.call(hFile, create, access, modified)) # { # return true; # } # return false; #} ENDSOURCE SOURCE #setFileTimeServer2Client #/* MAN #Sets the created and modified date and time for a clientfile to the same as a servertime #*/ ##winapi #client static boolean setFileTimeServer2Client(Filename serverFile, Filename clientFile) #{ # int serverhFile = WinAPI::createFileServer(serverFile, #OPEN_EXISTING); # int clienthFile; # Binary createdServer, accessedServer, modifiedServer; # Binary createdClient = new Binary(#Offset8); # Binary accessedClient = new Binary(#Offset8); # Binary modifiedClient = new Binary(#Offset8); # boolean ret = false; # # if (serverhFile) # { # createdServer = WinAPI::getFileTimeServer(serverhFile, 0); # accessedServer = WinAPI::getFileTimeServer(serverhFile, 1); # modifiedServer = WinAPI::getFileTimeServer(serverhFile, 2); # WinAPI::closeHandle(serverhfile); # # if (createdServer && accessedServer && modifiedServer) # { # createdClient.dWord(#offset0, createdServer.dWord(#offset0)); # createdClient.dWord(#offset4, createdServer.dWord(#offset4)); # accessedClient.dWord(#offset0, accessedServer.dWord(#offset0)); # accessedClient.dWord(#offset4, accessedServer.dWord(#offset4)); # modifiedClient.dWord(#offset0, modifiedServer.dWord(#offset0)); # modifiedClient.dWord(#offset4, modifiedServer.dWord(#offset4)); # # clienthFile = WinAPI::createFile(clientFile, #OPEN_EXISTING, #GENERIC_WRITE); # if (clientHFile) # { # ret = WinAPI::setFileTime(clientHFile, createdClient, accessedClient, modifiedClient); # WinAPI::closeHandle(clienthfile); # } # } # } # return ret; #} ENDSOURCE SOURCE #setForegroundWindow #static boolean setForegroundWindow(HWND _hWnd) #{ # DLL dll; # DLLFunction dllFunction; # ; # # dll = new DLL('user32.dll'); # dllFunction = new DLLFunction(dll,'SetForegroundWindow'); # # dllFunction.arg(ExtTypes::DWord); # dllFunction.returns(ExtTypes::Byte); # # return dllFunction.call(_hWnd); #} ENDSOURCE SOURCE #setMenuItemBitmaps #client static void setMenuItemBitmaps(int hMenu, # int uItem, # int checkedbitmap, # int uncheckedbitmap) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _setMenuItemBitmap = new DLLFunction(_winApiDLL, 'SetMenuItemBitmaps'); # int bitmapHdl1 = WinAPI::loadBitmap(checkedbitmap); # int bitmapHdl2 = WinAPI::loadBitmap(uncheckedbitmap); # # # _setMenuItemBitmap.returns(ExtTypes::DWord); # _setMenuItemBitmap.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord); # # _setMenuItemBitmap.call(hMenu, uItem, 0, bitmapHdl1, bitmapHdl2); #} ENDSOURCE SOURCE #setMenuItemInfo #client static int setMenuItemInfo(int hMenu, # int uItem, # Binary lpmii) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _setMenuItemInfo = new DLLFunction(_winApiDLL, 'SetMenuItemInfoA'); # # _setMenuItemInfo.returns(ExtTypes::DWord); # _setMenuItemInfo.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer); # # return _setMenuItemInfo.call(hMenu, uItem, 0, lpmii); #} ENDSOURCE SOURCE #setScrollInfo ##WinApi ##define.structSize(28) #client static int setScrollInfo(int hwnd, # int pos, # int pageSize, # int minValue, # int maxValue, # boolean redraw) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _setScrollInfo = new DLLFunction(_winApiDLL, 'SetScrollInfo'); # Binary _scrollInfo = new Binary(#structSize); # # _scrollInfo.dWord(#offset0, #structSize); # _scrollInfo.dWord(#offset4, #SIF_ALL); # _scrollInfo.dWord(#offset8, minValue); # _scrollInfo.dWord(#offset12, maxValue); # _scrollInfo.dWord(#offset16, pageSize); # _scrollInfo.dWord(#offset20, pos); # # _setScrollInfo.returns(ExtTypes::DWord); # _setScrollInfo.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord); # # return _setScrollInfo.call(hwnd, #SB_CTL, _scrollInfo, (redraw?1:0)); #} ENDSOURCE SOURCE #setScrollPos #client static int setScrollPos(int hwnd, int flags, int value, boolean redraw = true) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _setScrollPos = new DLLFunction(_winApiDLL, 'SetScrollPos'); # # _setScrollPos.returns(ExtTypes::DWord); # _setScrollPos.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord); # # # if (_setScrollPos.call(hwnd, flags, value, redraw) == 0) # return WinAPI::getLastError(); # else # return 0; #} ENDSOURCE SOURCE #SetWindowPos #client static boolean setWindowPos( # int _handle, # int _left, # int _top, # int _width, # int _height, # boolean _sizeOnly = FALSE, # boolean _moveOnly = FALSE, # int _flags = 0 ) # #{ # boolean ret; # DLL _DLL = new DLL('USER32'); # DLLFunction _setwPos = new DLLFunction(_DLL, 'SetWindowPos'); # int _dllret; # ; # ret = FALSE; # # if (_flags==0) { # // no flags specified # if (_sizeOnly) # _flags = _flags | #SWP_NOMOVE; # if (_moveOnly) # _flags = _flags | #SWP_NOSIZE; # _flags = _flags | #SWP_NOZORDER; # } # else # { # // use flags # // but do not change Z order handling # _flags = _flags | #SWP_NOZORDER; # } # # _setwPos.returns(ExtTypes::DWord); // BOOL # _setwPos.arg(ExtTypes::DWord); // handle window # _setwPos.arg(ExtTypes::DWord); // handle to Z Order window # _setwPos.arg(ExtTypes::DWord); // x # _setwPos.arg(ExtTypes::DWord); // y # _setwPos.arg(ExtTypes::DWord); // cx # _setwPos.arg(ExtTypes::DWord); // cy # _setwPos.arg(ExtTypes::DWord); // flags; # # _dllRet = _setwPos.call(_handle, 0, _left, _top, _width, _height, _flags ); # if (_dllRet) { # ret = TRUE; # } # # return ret; #} ENDSOURCE SOURCE #SetWindowText #client static boolean setWindowText( # int _handle, # str _txt ) # #{ # boolean ret; # DLL _DLL = new DLL('USER32'); # DLLFunction _setwTxt = new DLLFunction(_DLL, 'SetWindowTextA'); # int _dllret; # ; # ret = FALSE; # # # _setwTxt.returns(ExtTypes::DWord); // BOOL # _setwTxt.arg(ExtTypes::DWord); // handle window # _setwTxt.arg(ExtTypes::String); // handle to Z Order window # # _dllRet = _setwTxt.call(_handle, _txt); # if (_dllRet) # { # ret = TRUE; # } # # return ret; #} # ENDSOURCE SOURCE #shellExecute ##WinAPI #client server static int shellExecute( # Filename _lpFile, # str _lpParameters = '', # str _lpDirectory = '', # str _lpOperation = #ShellExeOpen, # int _show = #SW_SHOWNORMAL # ) #{ # int sizeofSHELLEXECUTEINFO = 60; # # DLL _winShellDLL = new DLL('SHELL32'); # DLLFunction _shellExecuteEx = new DLLFunction(_winShellDLL, 'ShellExecuteExA'); # # int hwndAxapta = infolog.hWnd(); # Binary b = new Binary(sizeOfSHELLEXECUTEINFO); # Binary verb = new Binary(_lpOperation); # Binary file = new Binary(_lpFile); # Binary parameters = new Binary(_lpParameters); # Binary defaultDirectory = new Binary(_lpDirectory); # # // Initialize the shellExecuteInfo structure # b.dWord( 0, sizeofSHELLEXECUTEINFO); // cbSize # b.dWord( 4, 0); // fMask # b.dWord( 8, hwndAxapta); // hwnd # b.binary( 12, verb); // Verb: What to do # b.binary( 16, file); // File to run # b.binary( 20, parameters); // Parameters # b.binary( 24, defaultDirectory); // Starting working directory # b.dWord( 28, _show); // nShow: How to open # # _shellExecuteEx.returns(ExtTypes::DWord); // BOOL # _shellExecuteEx.arg(ExtTypes::Pointer); // Address of ShellExecuteInfo parm block # # return _shellExecuteEx.call(b); #} # ENDSOURCE SOURCE #showMruAllowed #static client boolean showMruAllowed() #{ # #winAPI # container reg = conNull(); # int value; # int handle; # # handle = WinAPI::regOpenKey(#HKEY_CURRENT_USER, 'Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Comdlg32', #KEY_READ); # reg = WinAPI::regGetValue(handle, 'NoFileMru'); # WinAPI::regCloseKey(handle); # # if (reg == conNull()) # { # // The item is not found, so Most Recently Used menus are allowed # return true; # } # else # { # // If the value is true, MRUs are not allowed # [ value ] = reg; # return (value != true); # } #} # ENDSOURCE SOURCE #showScrollbar ##WinApi #client static boolean showScrollbar(int hwnd, # int bar = #SB_BOTH, # boolean show = false) #{ # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _showScrollbar = new DLLFunction(_winApiDLL, 'ShowScrollBar'); # # _showScrollbar.returns(ExtTypes::DWord); # _showScrollbar.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Byte); # # return _showScrollbar.call(hwnd, bar, show); #} ENDSOURCE SOURCE #showWindow #client static boolean showWindow( # int _handle, # int _stat ) # #{ # boolean ret; # DLL _DLL = new DLL('USER32'); # DLLFunction _shwwind = new DLLFunction(_DLL, 'ShowWindow'); # int _dllret; # ; # ret = FALSE; # # # _shwwind.returns(ExtTypes::DWord); // BOOL # _shwwind.arg(ExtTypes::DWord); // handle window # _shwwind.arg(ExtTypes::DWord); // cmdShow # # _dllRet = _shwwind.call(_handle, _stat); # if (_dllRet) # { # ret = TRUE; # } # # return ret; #} ENDSOURCE SOURCE #sndPlaySound # ##Define.SND_SYNC(0x0) ##Define.SND_ASYNC(0x1) ##Define.SND_NODEFAULT(0x2) ##Define.SND_LOOP(0x8) ##Define.SND_NOSTOP(0x10) # #client static boolean sndPlaySound(str lpszSoundName, # int uFlags = #SND_ASYNC) #{ # DLL _DLL = new DLL('WINMM.DLL'); # DLLFunction _sndPlaySound = new DLLFunction(_DLL, 'sndPlaySoundA'); # # _sndPlaySound.returns(ExtTypes::DWord); # _sndPlaySound.arg(ExtTypes::String, # ExtTypes::DWord); # # lpszSoundName = xInfo::directory(DirectoryType::Include)+lpszSoundName; # return _sndPlaySound.call(lpszSoundName, uFlags); #} ENDSOURCE SOURCE #SystemTimeToDate #/* MAN #SystemTimeToDate returns an Axapta time. # #The SYSTEMTIME structure represents a date and time using individual members #for the month, day, year, weekday, hour, minute, second, and millisecond. # #*/ #client server static date systemTimeToDate(Binary systemTime) #{ # int yr = systemTime.word(#Offset0); # int month = systemTime.word(#Offset2); # int day = systemTime.word(#Offset6); # # return mkDate(day,month,yr); #} ENDSOURCE SOURCE #SystemTimeToTimeOfDay #/* MAN #SystemTimeToTimeOfDay returns an Axapta time. # #The SYSTEMTIME structure represents a date and time using individual members #for the month, day, year, weekday, hour, minute, second, and millisecond. # #*/ #client server static timeOfDay systemTimeToTimeOfDay(Binary systemTime) #{ # #TimeConstants # int hour = systemTime.word(#Offset8) mod #HoursPerDay; # int minute = systemTime.word(#Offset10); # int second = systemTime.word(#Offset12); # # return (hour * #SecondsPerHour) + (minute * #SecondsPerMinute) + second; #} ENDSOURCE SOURCE #trackPopupMenu #client static int trackPopupMenu(int hMenu, # int uFlags, # int x, # int y, # int hWnd) #{ # Binary b = new Binary(#Offset0); # DLL _winApiDLL = new DLL('USER32'); # DLLFunction _trackPopupMenu = new DLLFunction(_winApiDLL, 'TrackPopupMenu'); # # _trackPopupMenu.returns(ExtTypes::DWord); # _trackPopupMenu.arg(ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::DWord, # ExtTypes::Pointer); # # return _trackPopupMenu.call(hMenu, uFlags, x, y, 0, hwnd, b ); #} ENDSOURCE SOURCE #updateWindow #client static int updateWindow(int hWnd) #{ # DLL _winApiDLL = new DLL(#UserDLL); # DLLFunction _updateWindow = new DLLFunction(_winApiDLL, 'UpdateWindow'); # # _updateWindow.returns(ExtTypes::DWord); # _updateWindow.arg(ExtTypes::DWord); # # return _updateWindow.call(hWnd); #} ENDSOURCE SOURCE #verQueryValue #/* MAN #*/ #client server static str verQueryValue(int _handle, str _query) #{ # DLL _winApiDLL = new DLL('Version'); # DLLFunction _verQueryValue = new DLLFunction(_winApiDLL, 'VerQueryValueA'); # Binary _buf = new Binary(4); # Binary _size = new Binary(4); # int size; # Binary _data; # # _verQueryValue.returns(ExtTypes::DWord); # # _verQueryValue.arg(ExtTypes::DWord); # _verQueryValue.arg(ExtTypes::String); # _verQueryValue.arg(ExtTypes::Pointer); # _verQueryValue.arg(ExtTypes::Pointer); # # if (!_verQueryValue.call(_handle, _query, _buf, _size)) # return ""; # # size = _size.dWord(0); # if (size <= 0) # return ""; # # _data = new Binary(size); # _data.attach(_buf.dWord(0), size); # # return _data.string(0); #} ENDSOURCE SOURCE #waitForSingleObject #client static int waitForSingleObject( # int _w32objhandle, # int _milliseconds = #INFINITE) # #{ # DLL _DLL = new DLL('KERNEL32'); # DLLFunction _wt4snglobj = new DLLFunction(_DLL, 'WaitForSingleObject'); # ; # # _wt4snglobj.returns(ExtTypes::DWord); // DWORD # _wt4snglobj.arg(ExtTypes::DWord); // DWORD ObjectHandle # _wt4snglobj.arg(ExtTypes::DWord); // DWORD milliseconds # # return _wt4snglobj.call( _w32objhandle, _milliseconds ); #} ENDSOURCE SOURCE #WideCharToMultiByte #client server static str wideCharToMultiByte(Binary binPtr = NULL) #{ # # //int WideCharToMultiByte( # // # // UINT CodePage, // code page # // DWORD dwFlags, // performance and mapping flags # // LPCWSTR lpWideCharStr, // address of wide-character string # // int cchWideChar, // number of characters in string # // LPSTR lpMultiByteStr, // address of buffer for new string # // int cchMultiByte, // size of buffer # // LPCSTR lpDefaultChar, // address of default for unmappable characters # // LPBOOL lpUsedDefaultChar // address of flag set when default char. used # // ); # #define.MAXRETBUF (8192) # #define.WIDESTRING_ZEROTERMED(-1) # #define.CP_ACP (0) # #define.CP_OEMCP (1) # #define.CP_MACCP (2) # # # int _dllret; # str _ret = ''; # Binary _retbuf; # DLL _winApiDLL = new DLL(#KERNELDLL); # DLLFunction _getWideToAnsi = new DLLFunction(_winApiDLL, 'WideCharToMultiByte') ; # # _getWideToAnsi.returns(ExtTypes::DWord); // DWORD ret # _getWideToAnsi.arg(ExtTypes::DWord); // UINT CodePage # _getWideToAnsi.arg(ExtTypes::DWord); // DWORD Flags # _getWideToAnsi.arg(ExtTypes::Pointer); // Pointer to Wide String # _getWideToAnsi.arg(ExtTypes::DWord); // Length of Wide string / -1 = zero terminated # _getWideToAnsi.arg(ExtTypes::Pointer); // Pointer to ret buffer # _getWideToAnsi.arg(ExtTypes::DWord); // Length of ret buffer # _getWideToAnsi.arg(ExtTypes::DWord); // pointer to map table - will be set to NULL # _getWideToAnsi.arg(ExtTypes::DWord); // pointer to boolean - will be set to NULL # # _retbuf = new Binary(#MAXRETBUF); # # _dllret = _getWideToAnsi.call( # #CP_ACP, # 0, # binPtr, # #WIDESTRING_ZEROTERMED, # _retbuf, # #MAXRETBUF-1, # 0, // represents NULL pointer # 0 // represents NULL pointer # ); # // # return _retbuf.string(0); #} ENDSOURCE SOURCE #winHelp ##WinApi #client static int winHelp( # Filename _helpFile, # int _data, # int _command = #HELP_CONTEXT # ) #{ # # DLL _winUser32DLL = new DLL('USER32.DLL'); # DLLFunction _winHelpA = new DLLFunction(_winUser32DLL, 'WinHelpA'); # # _winHelpA.returns(ExtTypes::DWord); # _winHelpA.arg(ExtTypes::DWord, // Hwnd # ExtTypes::String, // HelpFile # ExtTypes::DWord, // Command # ExtTypes::DWord); // Data # # return _winHelpA.call(#Offset0,_helpFile,_command,_data); #} ENDSOURCE SOURCE #writePrivateProfileString #client static int writePrivateProfileString(str section, str key, str value, str file) #{ # #WinAPI # DLL DLL = new DLL(#KERNELDLL); # DLLFunction method = new DLLFunction(DLL, 'WritePrivateProfileStringA'); # # method.returns(ExtTypes::DWord); # method.arg(ExtTypes::String, //section # ExtTypes::String, //key # ExtTypes::String, //value # ExtTypes::String); //file # # return method.call(section, key, value, file); #} # ENDSOURCE ENDMETHODS ENDCLASS ***Element: MCR ; Navision Axapta Macro: Keymac descargados en Miércoles 16/01/2008 ; -------------------------------------------------------------------------------- JOBVERSION 1 SOURCE #Keymac #container tab_key =['VK_LBUTTON', # 'VK_RBUTTON', # 'VK_CANCEL' , # 'VK_MBUTTON', # '', # '', # '', # 'VK_BACK', # 'VK_TAB', # '', // 10 # '', # 'VK_CLEAR', # 'VK_RETURN', # '', # '', # 'VK_SHIFT', # 'VK_CONTROL', # 'VK_MENU', # 'VK_PAUSE', # 'VK_CAPITAL', //20 # '', # '', # '', # '', # '', # '', # 'VK_ESCAPE', # '', # '', # '', //30 # '', # 'VK_SPACE', # 'VK_PRIOR', # 'VK_NEXT', # 'VK_END', # 'VK_HOME', # 'VK_LEFT', # 'VK_UP', # 'VK_RIGHT', # 'VK_DOWN', //40 # 'VK_SELECT', # '', # 'VK_EXECUTE', # 'VK_SNAPSHOT', # 'VK_INSERT', # 'VK_DELETE', # 'VK_HELP', # '0', # '1', # '2', //50 # '3', # '4', # '5', # '6', # '7', # '8', # '9', # '', # '', # '', //60 # '', # '', # '', # '', # 'A', # 'B', # 'C', # 'D', # 'E', # 'F', // 70 # 'G', # 'H', # 'I', # 'J', # 'K', # 'L', # 'M', # 'N', # 'O', # 'P', //80 # 'Q', # 'R', # 'S', # 'T', # 'U', # 'V', # 'W', # 'X', # 'Y', # 'Z', //90 # '', # '', # '', # '', # '', # 'VK_NUMPAD0', # 'VK_NUMPAD1', # 'VK_NUMPAD2', # 'VK_NUMPAD3', # 'VK_NUMPAD4', // 100 # 'VK_NUMPAD5', # 'VK_NUMPAD6', # 'VK_NUMPAD7', # 'VK_NUMPAD8', # 'VK_NUMPAD9', # 'VK_MULTIPLY', # 'VK_ADD', # 'VK_SEPARATOR', # 'VK_SUBTRACT', # 'VK_DECIMAL', //110 # 'VK_DIVIDE', # 'VK_F1', # 'VK_F2', # 'VK_F3', # 'VK_F4', # 'VK_F5', # 'VK_F6', # 'VK_F7', # 'VK_F8', # 'VK_F9', //120 # 'VK_F10', # 'VK_F11', # 'VK_F12', # 'VK_F13', # 'VK_F14', # 'VK_F15', # 'VK_F16', # 'VK_F17', # 'VK_F18', # 'VK_F19', //130 # 'VK_F20', # 'VK_F21', # 'VK_F22', # 'VK_F23', # 'VK_F24' # ]; #/* #VK_LBUTTON 01 Left mouse button #VK_RBUTTON 02 Right mouse button #VK_CANCEL 03 Used for control-break processing #VK_MBUTTON 04 Middle mouse button (three-button mouse) #VK_BACK 08 BACKSPACE key #VK_TAB 09 TAB key #VK_CLEAR 12 CLEAR key #VK_RETURN 13 ENTER key #VK_SHIFT 16 SHIFT key #VK_CONTROL 17 CTRL key #VK_MENU 18 ALT key #VK_PAUSE 19 PAUSE key #VK_CAPITAL 20 CAPS LOCK key #VK_ESCAPE 27 ESC key #VK_SPACE 32 SPACEBAR #VK_PRIOR 33 PAGE UP key #VK_NEXT 34 PAGE DOWN key #VK_END 35 END key #VK_HOME 36 HOME key #VK_LEFT 37 LEFT ARROW key #VK_UP 38 UP ARROW key #VK_RIGHT 39 RIGHT ARROW key #VK_DOWN 40 DOWN ARROW key #VK_SELECT 41 SELECT key #VK_EXECUTE 43 EXECUTE key #VK_SNAPSHOT 44 PRINT SCREEN key for Windows 3.0 and later #VK_INSERT 45 INS key #VK_DELETE 46 DEL key #VK_HELP 47 HELP key # #VK_0 48 0 key #VK_1 49 1 key #VK_2 50 2 key #VK_3 51 3 key #VK_4 52 4 key #VK_5 53 5 key #VK_6 54 6 key #VK_7 55 7 key #VK_8 56 8 key #VK_9 57 9 key #VK_A 65 A key #VK_B 66 B key #VK_C 67 C key #VK_D 68 D key #VK_E 69 E key #VK_F 70 F key #VK_G 71 G key #VK_H 72 H key #VK_I 73 I key #VK_J 74 J key #VK_K 75 K key #VK_L 76 L key #VK_M 77 M key #VK_N 78 N key #VK_O 79 O key #VK_P 80 P key #VK_Q 81 Q key #VK_R 82 R key #VK_S 83 S key #VK_T 84 T key #VK_U 85 U key #VK_V 86 V key #VK_W 87 W key #VK_X 88 X key #VK_Y 89 Y key #VK_Z 90 Z key # #VK_NUMPAD0 96 Numeric keypad 0 key #VK_NUMPAD1 97 Numeric keypad 1 key #VK_NUMPAD2 98 Numeric keypad 2 key #VK_NUMPAD3 99 Numeric keypad 3 key #VK_NUMPAD4 100 Numeric keypad 4 key #VK_NUMPAD5 101 Numeric keypad 5 key #VK_NUMPAD6 102 Numeric keypad 6 key #VK_NUMPAD7 103 Numeric keypad 7 key #VK_NUMPAD8 104 Numeric keypad 8 key #VK_NUMPAD9 105 Numeric keypad 9 key #VK_MULTIPLY 106 Multiply key #VK_ADD 107 Add key #VK_SEPARATOR 108 Separator key #VK_SUBTRACT 109 Subtract key #VK_DECIMAL 110 Decimal key #VK_DIVIDE 111 Divide key # #VK_F1 112 F1 key #VK_F2 113 F2 key #VK_F3 114 F3 key #VK_F4 115 F4 key #VK_F5 116 F5 key #VK_F6 117 F6 key #VK_F7 118 F7 key #VK_F8 119 F8 key #VK_F9 120 F9 key #VK_F10 121 F10 key #VK_F11 122 F11 key #VK_F12 123 F12 key #VK_F13 124 F13 key #VK_F14 125 F14 key #VK_F15 126 F15 key #VK_F16 127 F16 key #VK_F17 128 F17 key #VK_F18 129 F18 key #VK_F19 130 F19 key #VK_F20 131 F20 key #VK_F21 132 F21 key #VK_F22 133 F22 key #VK_F23 134 F23 key #VK_F24 135 F24 key # #VK_NUMLOCK 144 NUM LOCK key #VK_SCROLL 145 SCROLL LOCK key #*/ ENDSOURCE ***Element: FRM ; Navision Axapta Forms unloaded at Miércoles 16/01/2008 ; -------------------------------------------------------------------------------- FRMVERSION 5 FORM #SKtutorial_Timer PROPERTIES Name #SKtutorial_Timer ENDPROPERTIES METHODS Version: 3 SOURCE #ClassDeclaration #class FormRun extends ObjectRun #{ # FormTimeControl _idleTime; # FormTimeControl _realTime; # int _idleTimer; # int _realTimer; # # #keypressed # # //Axl temporal... # int cont; # str texto; # str anterior; #} ENDSOURCE SOURCE #task #public int task(int _taskId) #{ # int ret; # # ret = super(_taskId); # # if (_taskid == 769) # { # element.close(); # } # # return ret; #} ENDSOURCE SOURCE #int2key #str int2key(int _key) #{ # # container tab_key =['VK_LBUTTON','VK_RBUTTON','VK_CANCEL' ,'VK_MBUTTON','','','','VK_BACK','VK_TAB','' ]+ //10 # ['','VK_CLEAR','VK_RETURN','','','VK_SHIFT','VK_CONTROL','VK_MENU','VK_PAUSE','VK_CAPITAL' ]+ //20 # ['','','','','','','VK_ESCAPE','','','' ]+ //30 # ['',' ','VK_PRIOR','VK_NEXT','VK_END','VK_HOME','VK_LEFT','VK_UP','VK_RIGHT','VK_DOWN' ]+ //40 # ['VK_SELECT','','VK_EXECUTE','VK_SNAPSHOT','VK_INSERT','VK_DELETE','VK_HELP','0','1','2' ]+ //50 # ['3','4','5','6','7','8','9','','','' ]+ //60 # ['', '', '','','A','B','C','D','E','F' ]+ //70 # ['G','H','I','J','K','L','M','N','O','P' ]+ //80 # ['Q','R','S','T','U','V','W','X','Y','Z' ]+ //90 # ['','','','','','VK_NUMPAD0','VK_NUMPAD1','VK_NUMPAD2','VK_NUMPAD3','VK_NUMPAD4' ]+ //100 # ['VK_NUMPAD5','VK_NUMPAD6','VK_NUMPAD7','VK_NUMPAD8','VK_NUMPAD9','VK_MULTIPLY','VK_ADD','VK_SEPARATOR','VK_SUBTRACT','VK_DECIMAL']+ //110 # ['VK_DIVIDE','VK_F1','VK_F2','VK_F3','VK_F4','VK_F5','VK_F6','VK_F7','VK_F8','VK_F9' ]+ //120 # ['VK_F10','VK_F11','VK_F12','VK_F13','VK_F14','VK_F15','VK_F16','VK_F17','VK_F18','VK_F19' ]+ //130 # ['VK_F20','VK_F21','VK_F22','VK_F23','VK_F24']; # # ; # # return conpeek(tab_key,_key); #} # # ENDSOURCE SOURCE #updatekey #void updatekey() #{ # //return values # //0, not pressed # //1, pressed before function call # //>1, key is down # int i =0; # int ret; # ; # for (i = 20; i < 130; i++) # { # ret = winapi::getAsyncKeyState(i); # # //if (ret != 1 && ret != 0) # //{ # //info(strfmt('%1 %2', ret,this.int2key(i))); # //} # # if (ret == 32769 ) # { # texto = texto + this.int2key(i); # cont ++; # # anterior = this.int2key(i); # # if (cont >= 25 ) # { # info(texto); # cont = 0; # texto = ''; # } # # # } # } # sleep(10); # _realTimer = this.setTimeOut("updatekey",1,false); #} ENDSOURCE SOURCE #Run #void run() #{ # _idleTime = element.control(control::Idle); # _realTime = element.control(control::RealTime); # # super(); # # //this.updateIdleTime(); # //this.updateRealTime(); # this.updatekey(); #} ENDSOURCE SOURCE #Close #void close() #{ # super(); #} ENDSOURCE SOURCE #updateRealTime #void updateRealTime() #{ # _realTime.value(timeNow()); # _realTimer = this.setTimeOut("updateRealTime",1000,FALSE); #} ENDSOURCE SOURCE #updateIdleTime #void updateIdleTime() #{ # _idletime.value(timeNow()); # _idletimer = this.setTimeOut("updateIdleTime",1000,TRUE); #} ENDSOURCE ENDMETHODS OBJECTBANK ENDOBJECTBANK JOINS ENDJOINS DESIGN PROPERTIES Left #Auto (left) Top #Auto Width #Auto Height #Auto Visible #Yes Caption # TitleDatasource # Frame #Standard WindowResize #Auto WindowType #Standard SaveSize #No AlwaysOnTop #No HideToolbar #No SetCompany #Yes ColorScheme #Default CssClass # ShowWebHelp #Default BackgroundColor #Button face (3D) ImageName # ImageResource #0 Imagemode #Normal (preserve pict. attributes) Mode #Watch SubmitMethod #Auto SupportReload #No LocalWebMenu # AllowDocking #No Font # FontSize #0 Italic #No Underline #No Bold #Default CharacterSet #0 LabelFont # LabelFontSize #0 LabelItalic #No LabelUnderline #No LabelBold #Default LabelCharacterSet #0 DataSource # TopMargin #Auto BottomMargin #Auto LeftMargin #Auto RightMargin #Auto ArrangeWhen #Default ArrangeMethod #Vertical Columns #2 Columnspace #Auto ArrangeGuide ARRAY INDEX Columns #0 #0 ENDARRAY HideIfEmpty #No AlignChildren #Yes AlignChild #Yes AllowUserSetup #Yes NeededAccessLevel #NoAccess ENDPROPERTIES CONTAINER CONTROL TIMEEDIT ;==== controlId:12289, containerId: 0, containerdata: 1 ;---------------------------------------------------------- PROPERTIES Name #Realtime AutoDeclaration #No Visible #Yes AllowEdit #No Left #Auto (left) Top #Auto Width #Auto Height #Auto VerticalSpacing #Auto Enabled #Yes Skip #Yes AlignControl #Yes HelpText # ConfigurationKey # SecurityKey # DragDrop #None LookupButton #Auto ReplaceOnLookup #Yes LimitText #Auto DisplayLength #Auto DisplayHeight #Auto Border #Auto Value #0 Alignment #Auto TimeFormat #24-hour TimeHours #Auto TimeMinute #Auto TimeSeconds #Auto TimeSeparator #Auto ColorScheme #Default BackStyle #Opaque BackgroundColor #Window background ForegroundColor #Window text Font # FontSize #0 Italic #No Underline #No Bold #Default CharacterSet #0 LabelForegroundColor #Window text ShowLabel #Yes Label #Realtime timer LabelFont # LabelFontSize #0 LabelItalic #No LabelUnderline #No LabelBold #Default LabelCharacterSet #0 LabelWidth #Auto LabelHeight #Auto LabelPosition #Left LabelAlignment #Right DataSource # DataField # Mandatory #No ExtendedDataType ARRAY # # ENDARRAY ArrayIndex #0 DataMethod # SearchMode #None ENDPROPERTIES ENDCONTROL CONTROL TIMEEDIT ;==== controlId:12290, containerId: 0, containerdata:20 ;---------------------------------------------------------- PROPERTIES Name #Idle AutoDeclaration #No Visible #Yes AllowEdit #No Left #Auto (left) Top #Auto Width #Auto Height #Auto VerticalSpacing #Auto Enabled #Yes Skip #Yes AlignControl #Yes HelpText # ConfigurationKey # SecurityKey # DragDrop #None LookupButton #Auto ReplaceOnLookup #Yes LimitText #Auto DisplayLength #Auto DisplayHeight #Auto Border #Auto Value #0 Alignment #Auto TimeFormat #24-hour TimeHours #Auto TimeMinute #Auto TimeSeconds #Auto TimeSeparator #Auto ColorScheme #Default BackStyle #Opaque BackgroundColor #Window background ForegroundColor #Window text Font # FontSize #0 Italic #No Underline #No Bold #Default CharacterSet #0 LabelForegroundColor #Window text ShowLabel #Yes Label #Idletimer LabelFont # LabelFontSize #0 LabelItalic #No LabelUnderline #No LabelBold #Default LabelCharacterSet #0 LabelWidth #Auto LabelHeight #Auto LabelPosition #Left LabelAlignment #Right DataSource # DataField # Mandatory #No ExtendedDataType ARRAY # # ENDARRAY ArrayIndex #0 DataMethod # SearchMode #None ENDPROPERTIES ENDCONTROL CONTROL STRINGEDIT ;==== controlId:12291, containerId: 0, containerdata:20 ;---------------------------------------------------------- PROPERTIES Name #EditLine AutoDeclaration #No Visible #Yes AllowEdit #Yes Left #Auto (left) Top #Auto Width #Auto Height #Auto VerticalSpacing #Auto Enabled #Yes Skip #No AlignControl #Yes HelpText # ConfigurationKey # SecurityKey # DragDrop #None LookupButton #Auto ReplaceOnLookup #Yes LimitText #Auto DisplayLength #Auto DisplayHeight #Auto Border #Auto Text # PasswordStyle #No Alignment #Auto ChangeCase #Auto MultiLine #No ColorScheme #Default BackStyle #Opaque BackgroundColor #Window background ForegroundColor #Window text Font # FontSize #0 Italic #No Underline #No Bold #Default CharacterSet #0 LabelForegroundColor #Window text ShowLabel #Yes Label # LabelFont # LabelFontSize #0 LabelItalic #No LabelUnderline #No LabelBold #Default LabelCharacterSet #0 LabelWidth #Auto LabelHeight #Auto LabelPosition #Left LabelAlignment #Right DataSource # DataField # Mandatory #No ExtendedDataType ARRAY # # ENDARRAY ArrayIndex #0 DataMethod # SearchMode #None ENDPROPERTIES ENDCONTROL CONTROL STRINGEDIT ;==== controlId:12292, containerId: 0, containerdata: 0 ;---------------------------------------------------------- PROPERTIES Name #EditLine1 AutoDeclaration #No Visible #Yes AllowEdit #Yes Left #Auto (left) Top #Auto Width #Auto Height #Auto VerticalSpacing #Auto Enabled #Yes Skip #No AlignControl #Yes HelpText # ConfigurationKey # SecurityKey # DragDrop #None LookupButton #Auto ReplaceOnLookup #Yes LimitText #Auto DisplayLength #Auto DisplayHeight #Auto Border #Auto Text # PasswordStyle #No Alignment #Auto ChangeCase #Auto MultiLine #No ColorScheme #Default BackStyle #Opaque BackgroundColor #Window background ForegroundColor #Window text Font # FontSize #0 Italic #No Underline #No Bold #Default CharacterSet #0 LabelForegroundColor #Window text ShowLabel #Yes Label # LabelFont # LabelFontSize #0 LabelItalic #No LabelUnderline #No LabelBold #Default LabelCharacterSet #0 LabelWidth #Auto LabelHeight #Auto LabelPosition #Left LabelAlignment #Right DataSource # DataField # Mandatory #No ExtendedDataType ARRAY # # ENDARRAY ArrayIndex #0 DataMethod # SearchMode #None ENDPROPERTIES ENDCONTROL ENDCONTAINER ENDDESIGN ENDFORM ***Element: PRN ; Navision Axapta Project : keyloger unloaded at Miércoles 16/01/2008 ; -------------------------------------------------------------------------------- PROJECTVERSION 2 PROJECT #keyloger PRIVATE PROPERTIES Name # ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 45 UTILOBJECTID 636 NODETYPE 329 NAME #WinAPI ENDNODE BEGINNODE FILETYPE 0 UTILTYPE 4 UTILOBJECTID 0 NODETYPE 218 NAME #Keymac ENDNODE BEGINNODE FILETYPE 0 UTILTYPE 11 UTILOBJECTID 0 NODETYPE 201 NAME #SKtutorial_Timer ENDNODE ENDPROJECT ***Element: END