Jump to content

Ondrej Kelle

Members
  • Content Count

    35
  • Joined

  • Last visited

  • Days Won

    1

Ondrej Kelle last won the day on January 21

Ondrej Kelle had the most liked content!

Community Reputation

24 Excellent

Recent Profile Visitors

179 profile views
  1. Ondrej Kelle

    Project Configuration Manager

    If you chose the code-generating wizards route perhaps this might (still) be helpful: old article (web archive): OTA: Visual design of Wizards code: https://cc.embarcadero.com/Item/17106
  2. Ondrej Kelle

    Named pipe failure, multithreading and asynchronous I/O

    Couldn't reproduce here, Delphi 10.3 Update 1, Version 26.0.33219.4899 - seems to work as expected
  3. An easy way would be to create and use a data module, then you can put your Indy components on it and use the IDE designer to write your event handlers.
  4. Ondrej Kelle

    Right Process for Changing an Application's Icon?

    Looks like Anders' Resource Editor which you can download from his website: http://melander.dk/download/
  5. System.Atomic* routines (e.g. AtomicCmpExchange) TInterlocked in SyncObjs
  6. Not really when writing my own code, I try to avoid them if possible. Sometimes for interop with an API, e.g. when translating C headers where enums are already declared that way. Or when you need to support a binary format which uses some specific ordinal values, then it depends - you might still prefer to use an enum but avoid conversion.
  7. No reservations, I find it concise/elegant and prefer to use it whenever I can. My 2c. You might have to avoid enum types with explicitly assigned ordinal values, though.
  8. Ondrej Kelle

    Version Control System

    People have actually asked for blame as a feature, that's why I included it back then in delphisvn (before it became Version Insight). I find it useful myself to see who committed which lines and also when. This piece of metadata can be useful when trying to understand a code base and its evolution.
  9. Ondrej Kelle

    How to get position of Top-level TMenuItem of Main menu

    Just a thought... Sounds like the units in your uses clause are listed in a different order so the type declarations resolve differently.
  10. Ondrej Kelle

    How to get position of Top-level TMenuItem of Main menu

    Sorry, I've been vague. Here's the full code which works in Delphi XE, I hope it helps: GetWindowMenuItemRect example Cheers!
  11. Ondrej Kelle

    Measure Process Time

    On Windows, there's GetProcessTimes API if that's what you want...
  12. Ondrej Kelle

    How to get position of Top-level TMenuItem of Main menu

    I've checked it with Delphi XE. The declaration of TMenuBarInfo in Windows unit seems to be wrong (packed record, 29 bytes). Simply redeclare it in your unit: type {$A8} // default quadword-alignment PMenuBarInfo = ^TMenuBarInfo; tagMENUBARINFO = record cbSize: DWORD; rcBar: TRect; hMenu: HMENU; hwndMenu: HWND; { fBarFocused:1: BOOL;} { bar, popup has the focus } { fFocused:1: BOOL; } { item has the focus } FocusedBits: BYTE; end; TMenuBarInfo = tagMENUBARINFO; function GetMenuBarInfo(hend: HWND; idObject, idItem: Longint; var pmbi: TMenuBarInfo): BOOL; stdcall; external user32 name 'GetMenuBarInfo'; which makes the record size 32 bytes, then it works: BTW, it's already fixed in Rio.
  13. Ondrej Kelle

    How to get position of Top-level TMenuItem of Main menu

    Your fix looks fine to me. Apart from the var parameter declaration the rest should be the same. Pass it the form's Handle (like in my example, I'm passing it Self.Handle where Self is the instance of the form). Good luck with the Dentist! 😉
  14. Ondrej Kelle

    Node modules with Delphi and Free Pascal

    ...just came across this visualisation. 🙂
  15. Ondrej Kelle

    How to get position of Top-level TMenuItem of Main menu

    GetMenuBarInfo API should help. I have no Delphi at hand at the moment but the following quick test works in Lazarus: function GetWindowMenuItemRect(Handle: THandle; Index: Integer): TRect; var Info: MENUBARINFO; begin FillChar(Info, SizeOf(Info), 0); Info.cbSize := SizeOf(Info); Win32Check(GetMenuBarInfo(Handle, $FFFFFFFD, Index, @Info)); Result := Info.rcBar; end; function GetScreenCanvas: TCanvas; begin Result := TCanvas.Create; try Result.Handle := GetDC(0); Result.Pen.Style := psSolid; Result.Pen.Color := clRed; Result.Brush.Style := bsClear; except Result.Free; raise; end; end; procedure TForm1.Button1Click(Sender: TObject); var C: TCanvas; I: Integer; begin C := GetScreenCanvas; try for I := 0 to MainMenu1.Items.Count - 1 do C.Rectangle(GetWindowMenuItemRect(Handle, I + 1)); finally C.Free; end; end;
×