Ian Branch
Members-
Content Count
1360 -
Joined
-
Last visited
-
Days Won
3
Ian Branch last won the day on May 1 2023
Ian Branch had the most liked content!
Community Reputation
128 ExcellentTechnical Information
-
Delphi-Version
Delphi 12 Athens
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Doh! Well, isn't that counter intuitive... Speaks volumes about how we 'journalise' when we read.. Thank you. All sorted now. Regards, Ian
-
Hi Team, Delphi 12.2. I have the following line: ShowMessage('State: ' + System.TypeInfo.GetEnumName(TypeInfo(TDataSetState), Ord(APD.State)) + '. Job # = ' + IntToStr(APD.JobNo)); I tried adding System.TypeInfo to the uses clause but Delphi complains it can't compile it. The issue I have here with this line of code is that Delphi tells me it expects a '(' but found a ',' after the TypeInfo. I checked the code at https://docwiki.embarcadero.com/CodeExamples/Athens/en/TypInfoGetEnumName_(Delphi) and I am consistant with it. Have I missed something or is this a bug? Regards & TIA, Ian
-
Hi Team, Further issues/changes have been identified/adressed in PasZip as a follow on to my initial issue. The current PasZip can be downloaded from https://github.com/synopse/mORMot Regards, Ian
-
Hi Team, I recently started to play in 64 bit. Normally I was 32 bit exclusive. I ran up against an issue with paszip.pas, used in a couple of places in various 3rd Party libraries. I kept geting an error at line 4341 or thereabouts: file_ := INVALID_HANDLE_VALUE; Tracing, I found variable file_ was defined at line around 3963 as a DWORD: file_: dword; This is fine in 32bit but problematic in 64bit. The solution was to change the declaration to: file_: THandle; Now paszip.pas builds without issue in both 32 & 64 bit. HTH in some way.. Regards, Ian
-
Resolved. It turns out that Aqua Light Slate is the one that I needed/wanted all along.
-
Hi Gord, Thank you for your input. I see what you are suggesting with the Onyx Blue but regrettably it isn't practical. 31+ projects, hundreds of forms in the suite.... I had a play with the Delphi Style Designer but it seems the colors are defined in a bitmap or similar file and I couldn't figure out how to change them.
-
Hi Team, My Customer, and I, really like the Emerald Light Slate style, with the exception that shades of Blue would be better than the shades of Green. If you can, how do you change the colours of the Style? In this case in particular the buttons. Regards & TIA, Ian
-
How to get the version of Delphi that the App is built with?
Ian Branch replied to Ian Branch's topic in General Help
As could I, but I was hoping for something more informative from Delphi. That 'uniquely identifying number' is applicable to Delphi 12.0, 12.1, 12.2, 12.2 Patch 1 & 12.2 Patch 2. Never mind. I will stick with manual updates as required. -
How to get the version of Delphi that the App is built with?
Ian Branch replied to Ian Branch's topic in General Help
That will only return 36. Call it a personal preference, I like to have the information in the About dialog. Saying the Application was built with 'Delphi v 36' isn't as informative as 'Delphi Athens v 12.2 Patch 2'. -
How to get the version of Delphi that the App is built with?
Ian Branch posted a topic in General Help
Hi Team, At the moment I use a variable to indicate the Delphi version for an About box in Apps. This looks like this: Delphi Athens 12.2 Patch 2. Is there some meaans within Delphi to return this information, or a reasonable semblance, so I don't have to manually update the About box? Regards & TIA, Ian -
Putting Delphi Application inside web page
Ian Branch replied to Robert Gilland's topic in Delphi Third-Party
I agree with your comments. I suspect it is a visibility/awareness issue. I have spoken with many of my peers and they were not aware of it. I also think that developers are focussing on Apple & Android for Apps on thos devices rather than what can be done within the PC realm. -
Ah Ha! Tks. All good now. Never heard of the 'unblock' 'feature'...
-
Win 11, 4k monitor. Hmm. Downloaded OK, Opened OK. Left Pane works fine, nothing shows in the main pane. 😞
-
Thank you one and all. For the record, I have it working with the following code: unit Unit20; interface uses Winapi.Windows, Winapi.TlHelp32, System.SysUtils, System.Classes, Vcl.Controls, Vcl.Forms, Vcl.StdCtrls; type TForm20 = class(TForm) Button1: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form20: TForm20; implementation {$R *.dfm} type PTOKEN_USER = ^TOKEN_USER; // function IsFileOpen(const FileName: string): Boolean; var HFile: THandle; begin // Try to open the file with exclusive access (no sharing allowed) HFile := CreateFile(PChar(FileName), GENERIC_READ or GENERIC_WRITE, 0, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); // Check if the file handle is invalid, which indicates an error if HFile = INVALID_HANDLE_VALUE then // Check if the error is due to a sharing violation Result := GetLastError = ERROR_SHARING_VIOLATION else begin // If the file was successfully opened, it means there’s no sharing violation Result := False; CloseHandle(HFile); // Close the handle if we managed to open the file end; // end; function GetUserNameForProcess(ProcessID: DWORD): string; var hProcess: THandle; TokenHandle: THandle; //TokenUser: PTOKENUSER; ptiUser: PTOKEN_USER; ReturnLength: DWORD; Name: array[0..255] of Char; NameLength: DWORD; Domain: array[0..255] of Char; DomainLength: DWORD; Use: SID_NAME_USE; begin // Result := 'Unknown'; hProcess := OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessID); // if hProcess <> 0 then begin if OpenProcessToken(hProcess, TOKEN_QUERY, TokenHandle) then try GetTokenInformation(TokenHandle, TokenUser, nil, 0, ReturnLength); ptiUser := AllocMem(ReturnLength); try if GetTokenInformation(TokenHandle, TokenUser, ptiUser, ReturnLength, ReturnLength) then begin NameLength := SizeOf(Name); DomainLength := SizeOf(Domain); if LookupAccountSid(nil, ptiUser.User.Sid, Name, NameLength, Domain, DomainLength, Use) then Result := Format('%s\%s', [Domain, Name]); end; finally FreeMem(ptiUser); end; finally CloseHandle(TokenHandle); end; CloseHandle(hProcess); end; // end; procedure ScanForDBiFiles(const Directory: string; var Results: TStringList); var SearchRec: TSearchRec; ProcessEntry: TProcessEntry32; Snapshot: THandle; FileName: string; begin // Results.Clear; // if FindFirst(IncludeTrailingPathDelimiter(Directory) + 'DBi*.exe', faAnyFile, SearchRec) = 0 then begin try repeat FileName := IncludeTrailingPathDelimiter(Directory) + SearchRec.Name; // Check if the file is open if IsFileOpen(FileName) then begin // Enumerate processes to find the one using this file Snapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if Snapshot <> INVALID_HANDLE_VALUE then begin ProcessEntry.dwSize := SizeOf(TProcessEntry32); if Process32First(Snapshot, ProcessEntry) then begin repeat // Check if the process has the same file name as the one we're looking for if SameText(ExtractFileName(ProcessEntry.szExeFile), SearchRec.Name) then begin // Results.Add(Format('File: %s, User: %s', [FileName, GetUserNameForProcess(ProcessEntry.th32ProcessID)])); Results.Add(Format('File: %-17s User: %s', [ExtractFileName(FileName), GetUserNameForProcess(ProcessEntry.th32ProcessID)])); // Break; end; until not Process32Next(Snapshot, ProcessEntry); end; CloseHandle(Snapshot); end; end; until FindNext(SearchRec) <> 0; finally FindClose(SearchRec); end; end; // end; procedure TForm20.Button1Click(Sender: TObject); var Results: TStringList; begin // Results := TStringList.Create; try ScanForDBiFiles('E:\DBiWorkflow', Results); Memo1.Lines.Assign(Results); // This line adds the results to Memo1 finally Results.Free; end; // end; end. My thanks to all for your input. Appreciated. Ian