Jump to content

CoMPi74

Members
  • Content Count

    43
  • Joined

  • Last visited

Community Reputation

3 Neutral

About CoMPi74

  • Birthday 11/02/1974

Technical Information

  • Delphi-Version
    Delphi Community Edition

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. CoMPi74

    TIdHL7.SynchronousSend does not respect timouts

    In fact, I managed to solve the problem by creating a new instance of the TIdHL7 object every time I try to send a HL7 message. In this case, everything works as it should. However, as I wrote earlier, when I tried to send a second message using the same instance of the component (with exactly the same settings), I received the srTimeout message. There's clearly something going on, but I can't find it myself. Especially since I use TIdHL7 component in a Windows service, which makes debugging very difficult... Anyway, thank you, @Remy Lebeau. PS. Is there any smart way to debugging windows services?
  2. CoMPi74

    TIdHL7.SynchronousSend does not respect timouts

    @Remy Lebeau The Indy components have been upgraded a month ago, or so, and now I use Indy ver. 10.6.2.0. Anyway, today's tests show that the app sends the messages every second time (I mean, the first call returns srOK and a valid reply, the second, srTimout and no reply, the third, as the first, srOK and the fourth, as the second, srTimeout, and so on). Looking into code I noticed that when the AsynchronousSend returns srTimeout the method DropClientConnection is called... I suppose that could be the cause of such a behavior... I also tried to use another approach. I changed the CommunicationMode to cmSingleThread, and then I was calling SendMessage and GetReply. Unfortunatelly, without success. GetReply returned srNone evere time. It is quite strange because, as one can read in comments, the state srNone is internally used and (should be) never returned 😕 Any idea?
  3. Hi there, I have a problem with TIdHL7 (Windows 8, Delphi XE4, Indy, ver. 10.6.2.0). Of course, I am trying to solve it by myself, but still without success. Anyway, here is a piece of code which makes me crazy... // stopping IdHL7 before configuration if IdHL7.Going then IdHL7.Stop; // setting timeouts and server address IdHL7.ReceiveTimeout := 1 * 60 * 1000; IdHL7.Timeout := 1 * 60 * 1000; IdHL7.IsListener := False; IdHL7.Address := SERVER_ADDRESS; IdHL7.Port := SERVER_PORT; // starting the connection IdHL7.Start; IdHL7.WaitForConnection(10000); // getting and sending some messages from DB while not AQuery.EOF do begin AMessage := AQuery.FieldByName('MessageToSend').AsString; AReturn := IdHL7.SynchronousSend(AMessage, AReply); // This is a problematic line ... AQuery.Next; end; As one can see I want to send some HL7 messages to SERVER. The server is online and it gets the messages send by SynchronousSend method and responds for them (confirmed). My logs show that the code works as expected but only for the very first call SynchronousSend (the method returns srOK and a valid reply sent byt the remote server). Unfortunatelly, every next call of SynchronousSend returns srTimouts, even if the result is returned just a few miliseconds after call, what is strange because, as you can see, the timeouts are set for 60 seconds 😕 What I am doing wrong? What I am missing? @Remy Lebeau as everyone knows, You are the undisputed Guru on this topic, so I am sure it is a piece of cake for you. Could you be so nice to help?
  4. CoMPi74

    Messageloop in Omnithread task

    @Primož Gabrijelčič Trying to compile following code: fController := CreateTask(TWorker.Create).MsgWait.Run; I got an error with a message: [dcc32 Error] Unit1.pas(269): E2250 There is no overloaded version of 'CreateTask' that can be called with these arguments. Any clue?
  5. CoMPi74

    Passive, non interactive custom form

    @Uwe Raabe I can not believe it. Is it really so simple? No way 🙂
  6. CoMPi74

    Passive, non interactive custom form

    @KodeZwerg I did not test it but I am afraid such a form can be activated (gets focus) when clicked. I want to avoid such behaviour.
  7. CoMPi74

    Passive, non interactive custom form

    Is there a way to create a kind of custom form (or custom form descendant) which would be completely transparent for all mouse and keyboard activities. More precisely, I need a custom form (or other control) to show a message which will disappear after a certain amount of time.
  8. CoMPi74

    Delphi SQL Formatter

    @dummzeuch That is exactly what I need :) Thank you
  9. CoMPi74

    Delphi SQL Formatter

    Is it possible to modify the templates? Or are they hardcoded? I mean I would like to paste my strings as '%s +', so without 'sLineBreak +' and similar.
  10. @PeterBelowIt does not work with @Self but works, perfectly, with @TMyForm. Nice catch! Thank you.
  11. @programmerdelphi2k Thank you :)
  12. Nice piece of code. But I can not compile it. I get 'E2036 Variable required' in SetEvent('OnClick', @DoOnClick). To be honest, I experienced similar problem - I was not able to get the address of the event handler method.
  13. Actually, there is. "DoOnClick" can not be a strict private method if you want to use GetMethodProp. That was I wanted to say. Anyway, thank you for you response, which shows me different point of view for my problem :)
  14. @Stefan Glienke you are genius, really. Now it works as expected. Thanks a million. But, by the way, I have another question. Because all these overloads shades the code, then, instead of function TMyForm.CreateControl(AClass: TControlClass): TControl; procedure SetEventHandler(const AControl: TControl; const AEventName: string; const AEventHandler: TNotifyEvent); overload; begin if IsPublishedProp(AControl, AEventName) then SetMethodProp(AControl, AEventName, TMethod(AEventHandler)); end; procedure SetEventHandler(const AControl: TControl; const AEventName: string; const AEventHandler: TKeyEvent); overload; begin if IsPublishedProp(AControl, AEventName) then SetMethodProp(AControl, AEventName, TMethod(AEventHandler)); end; [...] begin Result := AClass.Create(Self); Result.Parent := Self; SetEventHandler(Result, 'OnClick', DoOnClick); SetEventHandler(Result, 'OnKeyDown', DoOnKeyDown); SetEventHandler(Result, 'OnChange', DoOnChange); SetEventHandler(Result, 'OnSelect', DoOnSelect); end; I wanted to use something like this function TMyForm.CreateControl(AClass: TControlClass): TControl; begin Result := AClass.Create(Self); Result.Parent := Self; if IsPublishedProp(Result, 'OnClick') then SetMethodProp(Result, 'OnClick', TMethod(TNotifyEvent(DoOnClick))); if IsPublishedProp(Result, 'OnKeyDown') then SetMethodProp(Result, 'OnKeyDown', TMethod(TKeyEvent(DoOnKeyDown))); [...] end; But I get 'E2089 Invalid typecast' error. Is not it the same? Any suggestions?
  15. Can' t use GetMethodProp because I prefer all my event handlers to be strict private.
×