AZJIO Posted April 7, 2019 Share Posted April 7, 2019 19 hours ago, ghost911 said: haha yes please excuse me it is with the copy paste of the translation QTranslate http://quest-app.appspot.com/home My other projects or all Link to comment Share on other sites More sharing options...
ghost911 Posted April 7, 2019 Author Share Posted April 7, 2019 @AZJIO thank my friend Link to comment Share on other sites More sharing options...
ghost911 Posted April 16, 2019 Author Share Posted April 16, 2019 Hello I updated the code Link to comment Share on other sites More sharing options...
AZJIO Posted April 18, 2019 Share Posted April 18, 2019 (edited) expandcollapse popupEnableExplicit Global Procedure_Error = 0 Global Procedure_Extended = 0 Procedure.s DriveGetType(Drive$) Procedure_Error = 0 Procedure_Extended = 0 Select GetDriveType_(Drive$) Case #DRIVE_UNKNOWN ProcedureReturn "UNKNOWN" Case #DRIVE_REMOVABLE ProcedureReturn "REMOVABLE" Case #DRIVE_FIXED ProcedureReturn "FIXED" Case #DRIVE_REMOTE ProcedureReturn "REMOTE" Case #DRIVE_CDROM ProcedureReturn "CDROM" Case #DRIVE_RAMDISK ProcedureReturn "RAMDISK" Default Procedure_Error = 1 ProcedureReturn "" EndSelect EndProcedure MessageRequester("Disc type", DriveGetType("C:\")) Procedure.s DriveGetLabel(Drive$) Protected Label$ Label$=Space(#MAX_PATH+1) If Not GetVolumeInformation_(Drive$,Label$,#MAX_PATH+1,0,0,0,0,0) Procedure_Error = 1 ProcedureReturn "" EndIf ProcedureReturn Label$ EndProcedure MessageRequester("Disk label", DriveGetLabel("C:\")) Procedure.s DriveGetSerial(Drive$) Protected Serial.l If Not GetVolumeInformation_(Drive$,0,0,@Serial,0,0,0,0) Procedure_Error = 1 ProcedureReturn "" EndIf ProcedureReturn Str(Serial & $FFFFFFFF) EndProcedure MessageRequester("Disk Serial", DriveGetSerial("C:\")) Procedure.s DriveSpaceFree(Drive$) Protected.q free_bytes If GetDiskFreeSpaceEx_(Drive$, 0, 0, @free_bytes) ; ProcedureReturn Str(free_bytes) ; Bytes ; ProcedureReturn Str(free_bytes/1024.0) ; Kb ProcedureReturn StrF(free_bytes/1048576.0, 4) ; Mb ; ProcedureReturn StrF(free_bytes/1073741824.0, 3) ; Gb Else Procedure_Error = 1 ProcedureReturn "0" EndIf EndProcedure MessageRequester("Free on drive", DriveSpaceFree("C:\")) Procedure.s DriveSpaceTotal(Drive$) Protected.q total_bytes If GetDiskFreeSpaceEx_(Drive$, 0, @total_bytes, 0) ; ProcedureReturn Str(total_bytes) ; Bytes ; ProcedureReturn Str(total_bytes/1024.0) ; Kb ProcedureReturn StrF(total_bytes/1048576.0, 4) ; Mb ; ProcedureReturn StrF(total_bytes/1073741824.0, 3) ; Gb Else Procedure_Error = 1 ProcedureReturn "0" EndIf EndProcedure MessageRequester("Disk size", DriveSpaceTotal("C:\")) Procedure.s DriveGetFileSystem(Drive$) Protected FileSystem$ FileSystem$=Space(#MAX_PATH+1) If GetVolumeInformation_(Drive$,0,0,0,0,0,@FileSystem$,#MAX_PATH+1) ProcedureReturn FileSystem$ Else Procedure_Error = 1 ProcedureReturn "1" EndIf EndProcedure MessageRequester("File system type", DriveGetFileSystem("C:\")) expandcollapse popupEnableExplicit Procedure.s GetLogicalDrives(Type, List Drives.s()) Protected i, Drive$, drives_avail = GetLogicalDrives_() ; Returns the bit flags of existing disks For i = 0 To 25 If ((drives_avail >> i) & 1) ; If the disc exists Drive$ = Chr(i + 65)+":\" If #True = Type Or GetDriveType_(Drive$) = Type AddElement(Drives()) Drives() = Drive$ EndIf EndIf Next EndProcedure Procedure.s DriveGetDrive(Type$, List Drives.s()) Select Type$ Case "UNKNOWN" GetLogicalDrives(#DRIVE_UNKNOWN, Drives()) Case "REMOVABLE" GetLogicalDrives(#DRIVE_REMOVABLE, Drives()) Case "FIXED" GetLogicalDrives(#DRIVE_FIXED, Drives()) Case "REMOTE" GetLogicalDrives(#DRIVE_REMOTE, Drives()) Case "CDROM" GetLogicalDrives(#DRIVE_CDROM, Drives()) Case "RAMDISK" GetLogicalDrives(#DRIVE_RAMDISK, Drives()) Case "ALL" GetLogicalDrives(#True, Drives()) Default ProcedureReturn "" EndSelect EndProcedure NewList Drives.s() DriveGetDrive("ALL", Drives()) Define List1.s ForEach Drives() List1 + Drives() + #CRLF$ Next MessageRequester("List", List1) Edited April 19, 2019 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
AZJIO Posted April 19, 2019 Share Posted April 19, 2019 (edited) expandcollapse popupEnableExplicit Define ini$ ini$ = GetPathPart(ProgramFilename()) + GetFilePart(ProgramFilename(), #PB_FileSystem_NoExtension) + ".ini" Procedure.s IniRead(filename$, section$, key$, def$ = "") Protected res$ If OpenPreferences(filename$) If PreferenceGroup(section$) res$ = ReadPreferenceString(key$, def$) EndIf ClosePreferences() EndIf ProcedureReturn res$ EndProcedure Procedure IniWrite(filename$, section$, key$, value$) Protected res If FileSize(filename$) < 0 ; CreateFile(0, filename$) ; WriteString(0, #CRLF$) ; CloseFile(0) CreatePreferences(filename$) ClosePreferences() EndIf If OpenPreferences(filename$) PreferenceGroup(section$) res = WritePreferenceString(key$, value$) ClosePreferences() EndIf ProcedureReturn res EndProcedure Procedure IniDelete(filename$, section$, key$ = "") If OpenPreferences(filename$) If key$ = "" RemovePreferenceGroup(section$) Else If PreferenceGroup(section$) RemovePreferenceKey(key$) EndIf EndIf ClosePreferences() EndIf EndProcedure IniWrite(ini$, "Set", "KeyWin", "new_value") MessageRequester("Here it is", IniRead(ini$, "Set", "KeyWin", "Default value")) IniDelete(ini$, "Set", "KeyWin") IniDelete(ini$, "Set") ; EnableExplicit ; Define ini$ ; ini$ = GetPathPart(ProgramFilename()) + GetFilePart(ProgramFilename(), #PB_FileSystem_NoExtension) + ".ini" ; Make the ini-file was not empty Procedure IniReadSectionNames(filename$, List Groups.s()) If OpenPreferences(filename$) ExaminePreferenceGroups() While NextPreferenceGroup() AddElement(Groups()) Groups() = PreferenceGroupName() Wend ClosePreferences() EndIf EndProcedure NewList Groups.s() IniReadSectionNames(ini$, Groups()) Define List1.s ForEach Groups() List1 + Groups() + #CRLF$ Next MessageRequester("List", List1) Procedure IniReadSection(filename$, section$, Map key_value.s()) If OpenPreferences(filename$) If PreferenceGroup(section$) ExaminePreferenceKeys() While NextPreferenceKey() AddMapElement(key_value(), PreferenceKeyName()) key_value() = PreferenceKeyValue() ; key_value(PreferenceKeyName()) = PreferenceKeyValue() Wend EndIf ClosePreferences() EndIf EndProcedure NewMap key_value.s() IniReadSection(ini$, "Set", key_value()) Define Map1.s ForEach key_value() Map1 + MapKey(key_value()) + " = " + key_value() + #CRLF$ Next MessageRequester("Map", Map1) Edited April 19, 2019 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
ghost911 Posted April 19, 2019 Author Share Posted April 19, 2019 (edited) @AZJIO Hello friend the first example requires a correction ( Line 83:Constant not found : #DRIVE_UNKNOWN ) thank you Edited April 19, 2019 by ghost911 Link to comment Share on other sites More sharing options...
AZJIO Posted April 19, 2019 Share Posted April 19, 2019 Internet search engine use https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-getdrivetypea DRIVE_UNKNOWN = 0 My other projects or all Link to comment Share on other sites More sharing options...
ghost911 Posted April 19, 2019 Author Share Posted April 19, 2019 good thank you Link to comment Share on other sites More sharing options...
ghost911 Posted April 19, 2019 Author Share Posted April 19, 2019 Updating the code I will try to simplify as much as possible the last functions Link to comment Share on other sites More sharing options...
AZJIO Posted April 19, 2019 Share Posted April 19, 2019 (edited) Macro BlockInput(bool) BlockInput_(bool) EndMacro BlockInput(1) Delay(3000) BlockInput(0) I fixed two functions. There it is not possible to get the size of the field to return data. Procedure.s DriveGetLabel(Drive$) Protected Label$ Label$=Space(#MAX_PATH+1) If Not GetVolumeInformation_(Drive$,Label$,#MAX_PATH+1,0,0,0,0,0) Procedure_Error = 1 ProcedureReturn "" EndIf ProcedureReturn Label$ EndProcedure MessageRequester("Disk label", DriveGetLabel("C:\")) Procedure.s DriveGetFileSystem(Drive$) Protected FileSystem$ FileSystem$=Space(#MAX_PATH+1) If GetVolumeInformation_(Drive$,0,0,0,0,0,@FileSystem$,#MAX_PATH+1) ProcedureReturn FileSystem$ Else Procedure_Error = 1 ProcedureReturn "1" EndIf EndProcedure MessageRequester("File system type", DriveGetFileSystem("C:\")) Edited April 23, 2019 by AZJIO ghost911 1 My other projects or all Link to comment Share on other sites More sharing options...
ghost911 Posted April 19, 2019 Author Share Posted April 19, 2019 thank you my friends i'll add this i'm happy with your help Link to comment Share on other sites More sharing options...
ghost911 Posted April 23, 2019 Author Share Posted April 23, 2019 @AZJIO Hello friend at home he does not return anything that does not work DriveGetLabel(Drive$) Link to comment Share on other sites More sharing options...
AZJIO Posted April 23, 2019 Share Posted April 23, 2019 (edited) Try to copy again. I changed the code, but did not find the reason. Manually rewrite this line: MessageRequester("Disk label", DriveGetLabel("C:\")) Delete the parenthesis at the end of the line and type on the keyboard Edited April 23, 2019 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
ghost911 Posted April 24, 2019 Author Share Posted April 24, 2019 everything works except this function Link to comment Share on other sites More sharing options...
AZJIO Posted April 24, 2019 Share Posted April 24, 2019 Because the forum changes the content, I can do nothing. Delete the bracket at the end of the line and enter it again. Is it hard to do? My other projects or all Link to comment Share on other sites More sharing options...
ghost911 Posted April 24, 2019 Author Share Posted April 24, 2019 it does not work Link to comment Share on other sites More sharing options...
ghost911 Posted April 30, 2019 Author Share Posted April 30, 2019 Maj 30/04/2019 Updating the code Link to comment Share on other sites More sharing options...
ghost911 Posted May 3, 2019 Author Share Posted May 3, 2019 expandcollapse popup#TH32CS_SNAPPROCESS = $2 #MAX_PATH = 999 Structure PROCESSENTRY32 dwSize.d cntUsage.d th32ProcessID.d th32DefaultHeapID.l th32ModuleID.d cntThreads.d th32ParentProcessID.d pcPriClassBase.l dwFlags.d szExeFile.b [#MAX_PATH] EndStructure Structure ProcInfo Name.s PID.l EndStructure Procedure ProcessList(List ProcList.ProcInfo()) Protected pe32.PROCESSENTRY32 Protected hthSnapshot pe32\dwSize = SizeOf(PROCESSENTRY32) ClearList(ProcList()) hthSnapshot = CreateToolhelp32Snapshot_(#TH32CS_SNAPPROCESS, 0) If hthSnapshot Process32First_(hthSnapshot, @pe32) While Process32Next_(hthSnapshot, @pe32) If AddElement(ProcList()) ProcList()\Name = LCase(PeekS(@pe32\szExeFile)) ProcList()\PID = pe32\th32ProcessID EndIf Wend CloseHandle_(hthSnapshot) EndIf EndProcedure NewList ProcList.ProcInfo() ProcessList(ProcList()) ForEach ProcList() Debug ProcList()\Name + " "+ProcList()\PID Next I do not understand it does not work to get processes via APIs Link to comment Share on other sites More sharing options...
ghost911 Posted May 23, 2019 Author Share Posted May 23, 2019 Hello @AZJIO IniReadSection() not work Link to comment Share on other sites More sharing options...
ghost911 Posted May 23, 2019 Author Share Posted May 23, 2019 big update available ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now