Jump to content

JohnLM

Members
  • Content Count

    216
  • Joined

  • Last visited

Everything posted by JohnLM

  1. 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.
  2. 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.
  3. 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.
  4. JohnLM

    Delphi 12.1 is available

    EMB has just put out a video discussing 12.1
  5. 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;
  6. 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.
  7. 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
  8. 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. **
  9. 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:
  10. JohnLM

    WebUI4Delphi available at GitHub

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

    Toolbar + ToolButton + TitleBar flicking

    I was replying to @Clément.
  12. 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.
  13. 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;
  14. I was searching around bestbuy for a streaming device that I could hook up my phone to the device and connect it to my laptop. And after searching around I saw that there are other ways to stream using OBS software on the laptop and installing an app on the phone via an ipp address. Is there a way to do this with Delphi so I don't have to worry about installing someone's app and being on *their* server? I would rather do it the Delphi way if possible, TIA.
  15. My main laptop hdd crashed, will not boot into win7, only in basic safe mode. The one i mentioned is the same exact model, and i restored an old backup to it from few yrs ago. But it does not have the wifi chip in it and i dont want to mess with it at this time.
  16. I want to watch some youtube videos, but from my phone, streamed to my laptop, and maybe to my win10 tablet.
  17. I have the Galaxy s10+ I went to best buy and one guy said if my phone and laptop has mirror, then i can. I have a dell inspiron 5520 laptop, from 2010 or 2012 i believe, win 7 prem.
  18. I am just starting to use the TValueListEditor and found out that there is no wordwrap feature. I have text that are longer than I can see and there is no scroll feature. Actually, there is, but it does not do what I expect it to do as a scroll (left/right), but even so, it would be too cumbersome to utilize. I would much prefer to have the text wordwrapped. Is there a way I can easily add a custom wordwrap to it?
  19. JohnLM

    Edit features

    Here is another method: procedure TForm1.Button2Click(Sender: TObject); var nameStr: string; begin if inputquery('Name:', 'Enter Name:', nameStr) then edit.Text:=nameStr; end;
  20. JohnLM

    Edit features

    Yes, it's the InputBox() function. See: InputBox (Delphi) - RAD Studio Code Examples (embarcadero.com) (add the vcl.dialogs in the uses section if it is not already there.) Sample usage: procedure TForm1.Button3Click(Sender: TObject); var InputString: string; begin InputString:=InputBox( 'Input Box', 'Prompt', ''); if InputString<>'' then edit1.Text:=InputString; end;
  21. Are people backing up or imaging their system before doing these patch updates or re-installs? I mean, that should be Priority No 1 so that in the event something does go wrong then a simple restore of the backup/image will have you continuing on as if nothing happened until things do get fixed. I am using Macrium Reflect v8.0.7783, the FREE version. Note: the later versions are not free.
  22. Due to finance, I will have to wait to install the patch 1 for 12 since I cannot renew subscription at this time. But I don't seem to have any trouble with 11.2 and 12.0 since I installed both on my current tablet since Nov/2023.
  23. The purpose of using this API is for pulling just the "artist release date". I am not using the REST that comes with Delphi yet, but I probably should and will eventually. I just need the artist release date for now. And I can pull that info from the JSON. https://www.discogs.com/developers/#page:database,header:database-search-get But. . . I'm having trouble trying to test the demo. I have the two keys they sent, but the guide(s) I am reading do not include the whole API string, and its confusing. I've never had this much difficulty with API's. I need to format the "fetch" part (below) into a full one-line string that I can paste into the URL box in a webbrowser. fetch('https://api.discogs.com/releases/1', { headers: { 'Authorization': 'Discogs key=[YOUR_KEY],secret=[YOUR_SECRET]' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error(error));
  24. Update. . . Initially, I was trying to set up a TWebbrowser on a form (and a button/edit controls) but I was getting script errors. Well, not from javascript, but two pop-up download for the JSON file. If I select Open, it will open in notepad. But this was too cumbersome. But I finally did get it to work in a basic web browser window made in delph using the TEdgeBrowser component, using D12.0, and the API worked and displayed. Next, I will figure out how to build a crude JSON parser to just snip the {"Country" : "US", "Year" : value} for now. Note: I had to delete the app name/key because I posted that in the last image by mistake. I created a new app name/key.
  25. Okay. I finally figured it out and its working.
×