Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 04/19/25 in Posts

  1. Remy Lebeau

    TButton: change font color

    You are catching the FORM'S paint event, not the BUTTON'S paint event. Every window receives its own painting messages (WM_PAINT, WM_DRAWITEM, etc). Your code can be simplified a little. If you use the button's WindowProc property, you won't need to call GetWindowLongPtr() directly (and even then, SetWindowSubclass() would have been a better choice). Also, since your DrawColoredTxt() function is completely erasing the button and drawing it yourself, there is no point in calling the default paint handler at all. Try this: ... procedure DrawColoredTxt(aBtn: TButton; aCaption: string); private FOriginalButtonProc: TWndMethod; procedure ButtonWndProc(var Message: TMessage); ... procedure TForm1.DrawColoredTxt(aBtn: TButton; aCaption: string); begin ... end; procedure TForm1.ButtonWndProc(var Message: TMessage); var PS: TPaintStruct; begin case Message.Msg of WM_PAINT: begin BeginPaint(Button2.Handle, PS); try FOriginalButtonProc(Message); DrawColoredTxt(Button2, 'Admin'); finally EndPaint(Button2.Handle, PS); end; end; // Forward all other messages to original handler else FOriginalButtonProc(Message); end; end; procedure TForm1.Button1Click(Sender: TObject); begin FOriginalButtonProc := Button2.WindowProc; Button2.WindowProc := ButtonWndProc; Button2.Repaint; end; procedure TForm1.Button3Click(Sender: TObject); begin if Assigned(FOriginalButtonProc) then begin Button2.WindowProc := FOriginalButtonProc; FOriginalButtonProc := nil; end; Button2.Caption := 'Admin'; Button2.Repaint; end; But, that being said, since you are drawing the entire button anyway, you may as well just use the BS_OWNERDRAW style and handle the WM_DRAWITEM message, as explained earlier in this discussion thread.
  2. FPiette

    Run as admin on unauthorized Windows username

    I the next step your app *has* the administrator privileges. Just run the external process as any user using only CreateProcess().
  3. Hi everyone, I wanted to share some practical benchmark results from testing Delphi 12.3 under Parallels Desktop (Windows 11 ARM) on my new Mac Studio M4 Max. I'm working on a large ERP project (around 1 million lines of code) using components from Fast Report, TMS Software, and DevExpress. Here’s a direct comparison between three systems I’ve tested: Build config Intel i5-12500 (Win11, 32 GB) Mac Mini M4 Pro (24 GB) Mac Studio M4 Max (36 GB) --------------------------------------------------------------------------------------------------------------- Win64 Clean + Build 32 sec 26 sec 24 sec Win64 Clean + Compile 21 sec 18 sec 17 sec Win32 Clean + Build 23 sec 19 sec 17 sec Win32 Clean + Compile 16 sec 14 sec 13 sec All tests were run in Parallels Desktop 19, with each Mac VM configured optimally (RAM and CPU cores adjusted per machine). The Intel system was running native Windows 11 Pro with 32 GB RAM. Windows 11 ARM inside Parallels ran Delphi 12.3 without any issues. Key impressions: Mac Studio M4 Max delivers excellent performance even under virtualization. Parallels Desktop is extremely stable — no issues with Firebird or IBExpert either. For large Delphi projects, it’s a very viable setup for professional development. Best regards, Bojan
  4. AI is just a tool. It has its uses. It's not going to do everything. Yes it's over hyped. But that does not mean it has no value. As usual the value lies somewhere in between what the hypers and the doubters say.
×