Announcement

Collapse
No announcement yet.

I need to pass a DISPATCH object as a dword to a thread

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I need to pass a DISPATCH object as a dword to a thread

    Any ideas how to do this?

    Thanks
    Sr. Software Development Engineer and Sr. Information Security Analyst,
    CEH, Digital Forensic Examiner

  • #2
    Use OBJPTR.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Thanks for responding!! However I pass the objptr but can not use the object

      What I did is this

      Code:
      THREAD FUNCTION TestThread(BYVAL OBJECTPTR AS DWORD) AS DWORD
          LOCAL tObject AS DISPATCH
          
          
          POKE DWORD,VARPTR(tObject), OBJECTPTR
          MSGBOX "Sending Message"
          OBJECT CALL tObject.Submit()
          MSGBOX HEX$(OBJRESULT) ' fails with disp member not found
      
      
      END FUNCTION
      Sr. Software Development Engineer and Sr. Information Security Analyst,
      CEH, Digital Forensic Examiner

      Comment


      • #4
        Thomas,
        If you can post how you access from JavaScript (and more importantly VbScript) I think I can find your answer.

        From our discussion in IDispatch expose methods to other languages I am sure that once I overcome what I do not know, I can patch it into what I do actually know.

        (GAWWWWD what a scarey thought that I know something )
        Engineer's Motto: If it aint broke take it apart and fix it

        "If at 1st you don't succeed... call it version 1.0"

        "Half of Programming is coding"....."The other 90% is DEBUGGING"

        "Document my code????" .... "WHYYY??? do you think they call it CODE? "

        Comment


        • #5
          According to M$ documentation you must initialize the COM library for the thread:

          CoInitializeEx must be called at least once, and is usually called only once, for each thread that uses the COM library. Multiple calls to CoInitializeEx by the same thread are allowed as long as they pass the same concurrency flag, but subsequent valid calls return S_FALSE. To close the COM library gracefully on a thread, each successful call to CoInitializeEx, including any call that returns S_FALSE, must be balanced by a corresponding call to CoUninitialize.
          Also

          Code:
          POKE DWORD,VARPTR(tObject), OBJECTPTR
          doesn't do any good to the reference count. You have to increase it using AddRef, or use

          Code:
          POKE DWORD,VARPTR(tObject), 0
          before the variable goes out of scope.
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment

          Working...
          X