Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

10 Good

Technical Information

  • Delphi-Version
    Delphi 11 Alexandria

Recent Profile Visitors

22785 profile views
  1. @Anders Melander and @Remy Lebeau - Thank you for the tips.
  2. This works for me in XE7. type FileSig = record Offset: Integer; text: string; arrSig: array of byte; arrStr: array of char; end; const sig1: FileSig = ( offset:10; text:'test'; arrsig:[65,66,67]; arrStr:['a','b','c'] ); var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin memo1.Lines.Add(sig1.Offset.ToString()); memo1.Lines.Add(sig1.text); memo1.Lines.Add( inttostr(sig1.arrSig[0]) ); memo1.Lines.Add('[' + ansistring(sig1.arrSig) + ']'); memo1.Lines.Add('[' + string(sig1.arrStr) +']'); end; Output Results: 10 test 65 [ABC] [abc]
  3. I have this routine that lists all running processes in a listbox under Windows 7. However, it is not a complete list as I thought, because when I load up the Task Manager, it has more entries (when I select '[y] show processes from all users'). Here is a complete project listing showing two working methods to obtain the running processes into a listbox. The only limitations with these are that they show less entries than what the Task Manager shows. Question: How do I obtain that same listing in delphi that the Task Manager shows? TIA. unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ComCtrls; type TForm1 = class(TForm) Panel1: TPanel; PageControl1: TPageControl; TabSheet1: TTabSheet; TabSheet2: TTabSheet; m1: TMemo; lb1: TListBox; btnGetProcesses1: TButton; Splitter1: TSplitter; btnPause: TButton; st1: TStaticText; btnGetProcesses2: TButton; procedure btnPauseClick(Sender: TObject); procedure btnGetProcesses2Click(Sender: TObject); procedure btnGetProcesses1Click(Sender: TObject); private { Private declarations } public { Public declarations } procedure GetProcesses_1; procedure GetProcesses_2; end; var Form1: TForm1; ts: tstrings; n: integer=0; // out counter for the listbox of items. implementation {$R *.dfm} uses tlHelp32; procedure tform1.GetProcesses_1; // #1 var handler: THandle; data: TProcessEntry32; PID: cardinal; function GetName: string; var i:byte; begin Result := ''; i := 0; while data.szExeFile[i] <> '' do begin Result := Result + data.szExeFile[i]; //PID := data.th32ProcessID; Inc(i); end; end; begin n:=0; ts:=tstringlist.Create; Data.dwSize := SizeOf(Data); form1.DoubleBuffered:=true; lb1.DoubleBuffered := true; lb1.Items.BeginUpdate; lb1.Items.Clear; lb1.Sorted:=true; handler := CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0); if Process32First(handler, data) then begin ts.Add(GetName()); //lb1.Items.Add({inttostr(data.th32ProcessID) + ': '+}GetName()); while Process32Next(handler, data) do begin ts.Add(GetName()); inc(n); //lb1.Items.Add({inttostr(data.th32ProcessID) + ': '+}GetName()); end; end else ShowMessage('Error'); lb1.Items.EndUpdate; lb1.Items.Assign(ts); st1.Caption := inttostr(n); ts.Free; end; procedure TForm1.btnGetProcesses1Click(Sender: TObject); begin GetProcesses_1; end; procedure tform1.getprocesses_2; // method #2, from https://www.vbforums.com/showthread.php?350779-Delphi-Getting-Running-processes-into-a-List-Box-and-Kill-Selected var MyHandle: THandle; Struct: TProcessEntry32; begin n:=0; try MyHandle:=CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0); Struct.dwSize:=Sizeof(TProcessEntry32); if Process32First(MyHandle, Struct) then form1.lb1.Items.Add(Struct.szExeFile); while Process32Next(MyHandle, Struct) do begin form1.lb1.Items.Add(Struct.szExeFile); inc(n); end; except on exception do ShowMessage('Error showing process list'); end end; procedure TForm1.btnGetProcesses2Click(Sender: TObject); // method #2 begin n:=0; getprocesses_2; st1.Caption := inttostr(n); end; end.
  4. I did not know that. I had downloaded an old Delphi project and was reading the readme.txt it came with and saw a link to the usernet newsgroup "https://groups.google.com/g/comp.lang.pascal.delphi.misc" The topic of the post in the newgroup was from Tim Robert's, from April 17, 1997, related to an Delphi project by efg (Early F. Glynn) and I was trying to see what he wrote about. When I entered that address in Chrome, I could only scroll via "<" and ">" icons and it took me about 4 hours to get to the date range of 4/1997, but I did not find the April 17, 1997 post mentioned in the readme.txt file. And, after retiring for the day, I left the tab open there and shut down the laptop in sleep mode, and the next day, the date had gone back up to 2023. Although I was looking in the newsgroup for that particular topic, I want to continue searching other newsgroup topics, so I would like a newsreader that works. Many topics will probably be from the days of old, for stuff you can't find on the internet anymore these days because those sites closed down for instance.
  5. Hi, I am trying to find my (NNTP) server name so that I use setup and use with XanaNews. My provider is Optimum Internet here in the States. It has been years since I used a newsreader. My last reader was with Netscape in Windows 98. It was pretty easy to use back then. When you phone Optimum they mainly have automated choices, so that is not an option. I've tried CMD and entered "hostname" but that gives me my computer name. Also tried ipconfig /all but that returns a bunch of details that I do not understand. Is there another way to obtain it through software or else the internet? TIA.
  6. JohnLM

    Delphi 12.1 is available

    EMB has just put out a video discussing 12.1
  7. JohnLM

    Check if selected row in DBGrid

    @Lainkes - this is probably what you are after. Put the if/then code snippet (below) into the OnColEnter event of the DBGrid. And every time you enter that field that you set .FieldName='myfieldname' to, will highlight your button bold or non-bold. procedure TForm1.dbgrid1ColEnter(Sender: TObject); begin if db1.SelectedField.FieldName='myfieldname' then button1.Font.Style := [fsBold] else button1.Font.Style := []; end;
  8. JohnLM

    My new project : WebView4Delphi

    Resolved - regarding the .dcu files. Under the: options -> Environment Options -> Delphi Options -> Library -> Library Path: I added the "\WebView4Delphi-main\source\" folder After this update, the SimpleBrowser compiled and ran.
  9. JohnLM

    My new project : WebView4Delphi

    Your suggestion to change the 'Package output directory' worked. The components have been added successfully. Thanks. However, when I try to compile a few of your demos, they fail. It seems none of the .dcu files are being created and Delphi can't find them at compile time. below are from your SimpleBroswer demo. They are in the Uses section with red underlines. uWVBrowser, uWVWinControl, uWVWindowParent, uWVTypes, uWVConstants, uWVTypeLibrary, uWVLibFunctions, uWVLoader, uWVInterfaces, uWVCoreWebView2Args, uWVBrowserBase
  10. JohnLM

    My new project : WebView4Delphi

    Unfortunately, I am still getting the same error message stated in my first post above. I've also downloaded the latest version, which are dated 3/9/2024. Please note, each file that I Build, I am first double-clicking on it to select it. WebView4DelphiVCLRTL.bpl, when I right-click it, I select Build, when it finishes, I get Done. WebView4DelphiFMXRTL.bpl, when I right-click it, I select Build, when it finishes, I get Warnings. WebView4DelphiVCL_designtime.bpl when I right-click it, I select Build, when it finishes, I get Done. ** this is the file that will not complete when I right-click and select Install. I get the error message stated earlier. ** WebView4DelphiFMX_designtime.bpl when I right-click, I select Build, when it finishes, I get Warnings. ** this file also will not complete when I right-click and select Install. I get the error message stated earlier. **
  11. JohnLM

    My new project : WebView4Delphi

    Hi, I'm having trouble installing webview4delphi under Delphi XE7. I am receiving the following error: "The program can't start because WebView4DelphiVCLRTL.bpl is missing from your computer. Try reinstalling the program to fix this problem." But the file is showing in the listing below:
  12. JohnLM

    WebUI4Delphi available at GitHub

    Oops, posted in the wrong topic. Will post in correct one shortly.
  13. JohnLM

    Toolbar + ToolButton + TitleBar flicking

    I was replying to @Clément.
  14. JohnLM

    Toolbar + ToolButton + TitleBar flicking

    okay, how about setting DoubBuffered:=true ? That is used to stop flicker in most controls and I've used this feature for many years, since Delphi 6. The following may work: form1.doublebuffered := true; toolbar1.doublebuffered := true; titlebarpanel1.doublebuffered := true; You can add that in the form's Create of Activate event. This should work.
  15. JohnLM

    GIF not playing in Delphi 10.3

    1. add a timage to the form. 2. load the a picture via Object Inspector window (or load via code) 3. use the following code snippet in a button event or other area of your source code. note: if the image is large and you shrink it, it may animate with image distortions. form1.DoubleBuffered := true; (image1.picture.graphic as TGifImage).Animate := true; (image1.picture.graphic as TFifImage).AnimationSpeed := 150;