Jump to content

Tommi Prami

Members
  • Content Count

    511
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Tommi Prami

  1. I am bit lost on how I can handle user message and return value to the caller app, which is using SendMessage API. I've got following code UM_STATUS = WM_USER + 333; ... // On form procedure WmPrintPreviewStatus(var Msg: TMessage); message UM_PRINT_PREVIEW_STATUS; // and implementation procedure TMyForm.WmStatus(var Msg: TMessage); var LResult: NativeInt; begin LResult := 1; if Assigned(FStatusObject) then if FStatusObject.Status = statFinished then LResult := 2; Msg.Result := LResult; end; What I am now more than less confused that message structure in MSDN looks pretty different (below) and Will my code work, so that caller can use something like MyResult = SendMessage(HWND, UM_STATUS...) typedef struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; DWORD lPrivate; } MSG, *PMSG, *NPMSG, *LPMSG;
  2. Tommi Prami

    Handlin the message and returning value to the caller

    Thanks man! Some Windows messages in Delphi guru should write detailed blog post. There was examples but could not find any that would explain all the plumbing and returning values. 😄
  3. I would really love that crlt+click would behave same as on inherited keyword. so I could also jump to the palace it is overridden from in interface section as from in implementation (if inherited call is there), this would help even more if the implementation doesn't have inherited call. https://quality.embarcadero.com/browse/RSP-34573 -Tee-
  4. Tommi Prami

    Handlin the message and returning value to the caller

    We acquire HWND of window first then we try to poll window couple of seconds, when status is set, we close from . This is GUI testing AutoIT script which should poll that particular form.
  5. Would be interesting to see all kinds stupid code out there, possibly with some arguments/proof why some code is bad. For sure there are tons of different coding styles, but still. Sometimes you stumble upon something that is "pure genius" or something that hides the problem that like David Copperfield. Or what are just scary, code that has been working for ages in production but should not 🙂 I'll post some examples into the reply Hope someone all post their own and biggest WTF of all times 😄 -Tee- PS. Trey to stay civil and nice, there always are differences of opinion and some prefer the mother and other the daughter. If we can get this thread flöying there will be good information for many I am sure.
  6. We got hit by date/time string literals in the code. Someone was using different locale and app crashed and burned 🙂
  7. What is disadvantage and/or deal breaker not to use Attribute based library? Why it won't work for you? (Just genuinely curious) ?
  8. I'd do it some other way, ad begin end and comment in between or something that it is more clear. (Thee was better version by earlier, so skip this 🙂 )
  9. That seems to be correct, thousands separators are not accepted, so have to first handle them self.
  10. with MainForm, ButtonCancel do ... with MainForm do with ButtonCancel do ... Nested with clauses are pure evil to refactor out. If it is complex code and there are common properties (Like Caption in VCL on above) how to decode which is which. Made feature request of this one way way back. Hope they make refactorer that would cast the first stone, so can manually refactor rest. : https://quality.embarcadero.com/browse/RSP-18953
  11. StrToDate('2021/12/31'); Using StrToDate() etc with Date/Time literal in code, that most likely will fail in other locals than yours, Also the EncodeDate etc routines giving numbers is better IMHO.
  12. try .. except end; eating all exceptions without commenting why exactly, and why it isn't or can't be something more specific.
  13. IntToStr(LDataSet.AsInteger); Could use AsString directly.
  14. try ... finally end; Empty finally blocks, maybe .free call is missing or after refactoring it has become obsolete but left behind. Not sure can the compiler optimize that out, that seems to me unneeded code that should be removed or fixed other way.
  15. if A > B then; ... if A > B then A := B else; Semicolon right after the then or else is legal syntax, and can be used rightly, but I think those are possible point of errors and not easy to spot
  16. When Thousand separators come into play, it starts to get almost impossible, (At least in here). 1,006.66 or 1 006,66 or 1 006.66 etc... And if sometimes there are no decimals. How to fix US version without decimals 1,006 and Finnish ones with them 6,66. As far as I know there can't be universal routine to rule them all. US I think thousand separator is Comma, here it is decimal separator. THis is one of the places there would have been nice to have global standard, and only one 🙂 -Tee-
  17. Tommi Prami

    New Community Edition

    Seems that "Parnassus" plugins are not available for it on GetIt, Bookmarks make IDE so much better, would love to have it on home computer also, but I manage, if David Millington happens to read this, try to get those in GetIt for Community edition also. -Tee-
  18. Tommi Prami

    Test Insight not drawing correctly

    This happens sometimes
  19. Has anyone done any benchmarking lately on JSON libs? Ones I have seen are bit old I think. (I am not needing one right now, but would be good for the community if someone woulöd do something like that) .Tee.
  20. Please Update Ticket: https://quality.embarcadero.com/browse/RSP-34302 And/Or make new one, if you can pinpoint the exact cause of the slowdown. (If it is actually true performance regression between those Delphi versions) -tee-
  21. Tommi Prami

    Physically reduce jpeg image size??

    I bet that using JPEGImg.Scale:=js* Is really fast but not sure how good visual quality will it have. Bitmap32 library has good quality Resamplers but for sure it'll take way longer than that. -Tee-
  22. Tommi Prami

    TBCEditor text editor component

    Same person.
  23. I know it is quite simple thing to do, but still would preferably use some already tested implementation. Does any Delphi Lib have such a routine? -Tee-
×