Re: [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion] Re: getTextSizeScreen

Help
2014-06-02
2014-06-02
  • Paul Higgins
    Paul Higgins
    2014-06-02

    Mark,

    I think I have resolved both problems but when my program terminates, I get this message:

    Warning: orexxole.dll DLL process detach, instance count (1) not 0

    Is there something I should do to correct this?

    Thanks,

    Paul

    ---------- Original Message ----------
    To: [oorexx:discussion] (408478@discussion.oorexx.p.re.sf.net)
    From: Mark Miesfeld (miesfeld@users.sf.net)
    Subject: [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion] Re:
    [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion] Re:
    [oorexx:discussion] Re: [oorexx:discussion] Re: getTextSizeScreen
    Date: 2014-06-01 2:26:50p

    On Sun, Jun 1, 2014 at 5:05 AM, Paul Higgins phigginsph99@users.sf.net
    wrote:

    I have discovered two problems by moving the code from the Run method to
    the InitDialog method.

    Problem 1:
    In the Run code I set some of the fields:

    Paul, this problem is just the way automatic data detection works. It has
    always worked this way.

    You can turn it off altogether. Or, if you want to use it, then you need
    all the attributes set to what you want initially displayed.

    Personally, I think the whole mechanism is incredibly confusing and I
    always turn it off. I've added a whole section in the reference manual
    explaining how it works. That is in 3.1.4 Data Attributes, the first 3
    subsections.

    Problem 2:
    In the Run code I issue an ole connection to GE.

    ...

    BUT after the InitDialog code ends the ole connection is lost.

    The connection is not lost in a sense. Your logging discards some
    information that is needed to debug this:

    C:\GE2KAP\GE2KAP.V11.0.0.0>GE2KAP.rex
    LOGFILE=GE2KAP.log
    SetFirstMessage() enter
    returning from initDialog()
    - Compiled method UNKNOWN with scope "OLEObject"
    12847 - ICameraInfoGE = comm._geobj~GetCamera(0)
    1700 - data = self~Get_Camera() -- make sure north is up
    - Compiled method SEND with scope "Message"
    Error 92 running C:\GE2KAP\GE2KAP.V11.0.0.0\GE2KAP.rex line 12847: OLE
    error
    Error 92.901: An unknown OLE error occurred (HRESULT=800401F0).

    800401F0 is "CoInitialize has not been called." In OLE, actually in all
    COM, CoInitialize has to be called on every thread OLE is used on.

    This is a known problem with the OleObject. CoInitialize is only called on
    the first thread. All event notifications are callbacks from the window
    processing loop and so the cancel() method is running on a different
    thread than the original thread, than the one you created the OleObject
    on.

    I'm not sure of a good fix for this.

    You can work around it temporarily by doing this in the GetCamera()
    method:

    /****/
    ::method Get_Camera -- issues a GE GetCamera
    -- returns the latitude, longitude, range or -1 if ge is not up
    /
    ****/
    expose comm.

    numeric digits 16

    if comm._gewnd~state = 'Illegal Handle' then do
    self~logmsg('Get_Camera GE window has an Illegal Handle, returning -1')
    return -1 -- added in V10.0.6
    end

    --if comm._diag >= 0 then signal on any

    comm._geobj = .OleObject~New('GoogleEarth.ApplicationGE',"WITHEVENTS",0)
    -- Get current Camera information and correct if not north up and tilt =
    0 added in V10.0.0.y
    ICameraInfoGE = comm._geobj~GetCamera(0)

    I have a bug opened for this, but I haven't come up with a good solution
    to it.

    The above code was just a quick hack I did yesterday to determine if I was
    right about the cause.

    A better temporary work around for you would be to not use the stashed
    OleObject in you comm. stem, but just create a new OleObject and discard
    it when running from an event notification method.

    There is still a problem with that because the COM library will not be
    un-initialized correctly. But, I think it will not be a big problem.

    --
    Mark Miesfeld

    [Re: [oorexx:discussion] Re: [oorexx:discussion] Re: [oorexx:discussion]
    Re: [oorexx:discussion] Re: [oorexx:discussion] Re:
    [oorexx:discussion] Re: [oorexx:discussion] Re:
    getTextSizeScreen](http://sourceforge.net/p/oorexx/discussion/408478/threa
    d/2e9ceb03/?limit=100#8e9b/ffe6)

    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/oorexx/discussion/408478/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/


    This e-mail was delivered via satellite phone using GMN's XGate software.
    Please be kind and keep your replies short.

     
    • Mark Miesfeld
      Mark Miesfeld
      2014-06-02

      On Mon, Jun 2, 2014 at 9:41 AM, Paul Higgins phigginsph99@users.sf.net
      wrote:

      I think I have resolved both problems but when my program terminates, I
      get this message:

      Warning: orexxole.dll DLL process detach, instance count (1) not 0

      Is there something I should do to correct this?

      Paul,

      Unfortunately, there is nothing to do to correct that. It is a diagnostic
      message that comes about from COM being initialized on the second thread.

      In hindsight, I can see that it would have been better to print the message
      on a debug build only. But, without a new build there is no way to change
      it.

      You can just ignore it.

      --
      Mark Miesfeld