Jump to content

Tommi Prami

Members
  • Content Count

    511
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Tommi Prami

  1. Tommi Prami

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

    Could this be messed up with visual form inheritance. It works in clean demo app, basically your code, with those name changes I've made. Have to typecast the constant because otherwise I'll get an Constant violates subrange bounds error, but not even that matter/happen in a clean new App. -Tee-
  2. Tommi Prami

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

    type {$A8} // default quadword-alignment PSTMenuBarInfo = ^TSTMenuBarInfo; tagSTMENUBARINFO = 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; TSTMenuBarInfo = tagSTMENUBARINFO; function STGetMenuBarInfo(hend: HWND; idObject, idItem: Longint; var pmbi: TSTMenuBarInfo): BOOL; stdcall; external user32 name 'GetMenuBarInfo'; function GetWindowMenuItemRect(const AHandle: THandle; const AIndex: Integer): TRect; var LMenuBarInfo: TSTMenuBarInfo; begin FillChar(LMenuBarInfo, SizeOf(TSTMenuBarInfo), 0); LMenuBarInfo.cbSize := SizeOf(TSTMenuBarInfo); {$RANGECHECKS OFF} {$OVERFLOWCHECKS OFF} {$WARN SYMBOL_PLATFORM OFF} Win32Check(STGetMenuBarInfo(AHandle, Longint($FFFFFFFD), AIndex, LMenuBarInfo)); {$WARN SYMBOL_PLATFORM ON} {$OVERFLOWCHECKS ON} {$RANGECHECKS ON} Result := LMenuBarInfo.rcBar; end; Changed types and method name to make sure it uses different types, added some far fetched compiler defines. Same code works using rest of your code. But failed on app that woulöd actually need to use it :). Have an idea tough... Gives me System Error. Code: 1400. Invalid window handle LEt me see... btw... Thanks for help!
  3. Tommi Prami

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

    Thanks, Can't see any difference but if I copy record and external method declarations from github, it compiles. weirdest thing ever 😄
  4. Tommi Prami

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

    Thanks, I see nothing wrong in that, but I just can't see why Compiler does not like it. It might be something trivial, but I just can't figure it out. TMenuBarInfo = tagMENUBARINFO; // <- [dcc32 Error] : E2029 '=' expected but identifier 'TMenuBarInfo' found
  5. Tommi Prami

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

    Tried all combinations of different handles and indexes, I could think of... Damnation. Now have to go tortured by the Dentist, and not event the Delphi-coding one 😞
  6. Tommi Prami

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

    Thanks man, I'll check... Gort to make couple of changes to make it compile, weirdly it did not allow me to assign Returned rect to result. Type in Delphi seems to be TMenuBarInfom and last parameter of GetMenuBarInfo is defined as Var-parameter. So I think I'll have to pass the whole record, not just pointer. function GetWindowMenuItemRect(const AHandle: THandle; const AIndex: Integer): TRect; var LMenuBarInfo: TMenuBarInfo; begin FillChar(LMenuBarInfo, SizeOf(LMenuBarInfo), 0); LMenuBarInfo.cbSize := SizeOf(LMenuBarInfo); {$WARN SYMBOL_PLATFORM OFF} Win32Check(GetMenuBarInfo(AHandle, Integer($FFFFFFFD), AIndex, LMenuBarInfo)); {$WARN SYMBOL_PLATFORM ON} Result.Top := LMenuBarInfo.rcBar.Top; Result.Left := LMenuBarInfo.rcBar.Left; Result.Height := LMenuBarInfo.rcBar.Height; Result.Width := LMenuBarInfo.rcBar.Width; end; It just gives me System Error. Code: 1400. Invalid window handle Tried to pass Windows Handle, MenuITems handle, did not Accept it... 😞 Weird. -Tee-
  7. Tommi Prami

    Is there GIS library for delphi (Free or very cheap)

    Should have been little more clear. I would need to open vector maps, bitmap maps. And other geolocation data. do some drawing on the map etc. Preferably some code to make some analysis if needed. -tee-
  8. Tommi Prami

    Am I using IF correctly?

    I think this comes (also) down to how expensive is getting Default Value. If just Constant or some simple value, then it is not an problem, But if it's anything more complicated, then it could be pretty slow if there is significant instances of other than default.
  9. Don't need to be ready to run thingy, just something to make things little bit easier. So don't have to code all from Scratch. Would be good exercise, but not enough free time to tinker on it. Or some article on how to actually code one would also help. -Tee-
  10. I Remember stumbling upon one long time ago but my Google-Fu was weak today. If not mistaken the lib I try to remember was integrated to Delphi iDE... MAybe... All info appreciated... -Tee-
  11. Tommi Prami

    IDE Fix pack for Rio

    I believe Embarcadero acquired rights to Ide FIX pack and changes are added to IDE it self, embarcadero only knows which ones and how tough... Andy is now trying to make DDevExtensions for Rio, but had some problems with debugging Ide bpls, I think I saw tweet yesterday. -Tee-
  12. Tommi Prami

    What is the fastest way to check if a file exists?

    Does that work with UNC paths? (Just asking)
  13. Tommi Prami

    10.3 Consumes 45% of my CPU

    Report to Embarcadero Issuer tracker, and put link into here. So we can Vote on it.
  14. Wiki Article of the Change https://en.wikipedia.org/wiki/Unicode_in_Microsoft_Windows#cite_note-10 One of out customer had selected that and we started to experience very weird problems and took some time to find out why it misbehaves. None of the application could connect to Firebird SQL server (Ours or third party) successfully. So would be smart to go through all tooling and code with that setting, we never know what M$oft will do with that, will it ever be released or will it soon be default for all. One coder switched this on and started to get weird results, he could not specify what all symptoms, but said that lot of work to be done before that setting can be enabled. Could be smart to Check how your environment, tools and code will behave.
  15. Sure is, but in other hand, why not use "Unicode API" at first place. I would guess they use Ansi API just as proxy to and from Unicode UTF16 API. SomeWindowsApiA -> String Conversion to UTF16 -> SomeWindowsApiAW Have not checked, just my hunch... In other hand If they have UTF-8 enabled API that is not just proxy to Wide API, then it could provide speed improvement if App uses UTF-8 strings.
  16. Tommi Prami

    Aligned and atomic read/write

    Memspeed app by Primož, build with 10.2.3, Release mode, 32 and 64 bit versions, If any dares to download... MemSpeed.7z
  17. Tommi Prami

    Aligned and atomic read/write

    Check out this fabulous book about memory alignment and performance.
  18. Any idea where that saves the info, Registry maybe? Could be nice to make some syc-app that would sync all templates to all codes in the team. If needed... All would benefit and also properties would be unified also. without too much hassle. -Tee-
  19. Tommi Prami

    Set Tab Order expert

    Might be pretty difficult to make it but sometimes I've been pondering what would be quick way. Get screenshot of the Form Paint line(s) in order you'd like tabs go. Not best in all cases, but many it would be super fast. -Tee-
  20. OK, i'll rephrase 🙂 Any syntax chosen. Forgot abo8ut DelphiAST, that could be first stepping stone to look from. I've just been thinking that would be cool to study how it is done, and maybe do some small app in the process. -Tee-
  21. Tommi Prami

    Delphi SQL Formatter

    Pretty handy, also if it could remove the Delphi formattings so I could easily take SQL and paste it then to SQL tool to tinker with...
  22. Tommi Prami

    Change the background color of a TEdit

    Once tried to do something like this on FMX, 1. Could not get it to look right 2. Was so much work. Memory of the process is very vague, tried to make some style thingy and use that. My observation was so that some things on Fmx are very complicated. Easier to make style than totally new VCL component with similar support build in, maybe. it depends I guess. Should give fmx a new change, do simple project with it. -Tee-
×