sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Can Sketchup receive Window message?

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 202 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      Debbie
      last edited by

      This is what I've done so far: wrote a plugin using "Win32API" to send message to other program (e.g. tell ABC.exe to calculate sth..). But now I want to let SU knows the calculation is finished in ABC.exe (e.g. may be sending WM_COPYDATA message back to SU). Is there any callback function in SU can be used to check it?

      Thanks

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        OR.. you could create a hidden Win32 window (off screen,) with an edit control, and send the data to that control.
        When the control is populated, you read it with Win32API call from Ruby.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • D Offline
          Debbie
          last edited by

          Thank you so much!! The ABC.exe is written by me and I will take a look at Win32ole first. πŸ˜„
          By the way, I have been thinking about using DLL to receive message and then call a ruby function to collect the data. But it seems not easy to run ruby on Visual studio so I finally give up. 😒

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Maybe you can make a Ruby C Extension work for you?

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              No, sorry. The reason is the API tries to be cross-platform, and I believe OSX does not use inter-window messaging like MS Windows does.

              Did YOU write the program ABC.exe ???

              Or is ABC.exe a command line program, and does it output it's results to STDOUT ??

              If so, use "win32ole.so" (class WIN32OLE in Ruby,) instead of Win32API.
              http://msdn.microsoft.com/en-us/library/ateytk4a(v=vs.84)

              The Ruby version looks most like the Javascript example.

              Ref:
              http://www.ruby-doc.org/docs/ProgrammingRuby/html/lib_windows.html

              and "Windows Automation" on this page:
              http://www.ruby-doc.org/docs/ProgrammingRuby/html/win32.html

              Also.. search this forum for examples of using the Windows Scripting Host via class WIN32OLE in Ruby.

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • D Offline
                Debbie
                last edited by

                @thomthom said:

                Maybe you can make a Ruby C Extension work for you?

                Ruby C extension? seems useful! thanks.

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  @debbie said:

                  @thomthom said:

                  Maybe you can make a Ruby C Extension work for you?

                  Ruby C extension? seems useful! thanks.

                  I made a Hello World project for getting Ruby C Extensions to work under SketchUp:
                  https://bitbucket.org/thomthom/sketchup-ruby-c-extension

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement