Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. How to:Let my application support automation like m$ word

How to:Let my application support automation like m$ word

Scheduled Pinned Locked Moved COM
testingtoolsjsonhelptutorial
5 Posts 3 Posters 0 Views 1 Watching
  • 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.
  • S Offline
    S Offline
    Simon W 0
    wrote on last edited by
    #1

    Hi: I know microsoft word support automation,I can use the fillow two method access word object: #import ..... IApplicationPtr pApp; (1) // Start up existing word, if available HRESULT hr = pApp.GetActiveObject(L"Word.Application"); (2) // Start up fresh instance of word HRESULT hr = pApp.CreateInstance("Word.Application", NULL,LSCTX_LOCAL_SERVER); I wonder how to implement it in my application. I use Windows API RegisterActiveObject to register my application interface,but it can only use the first method to access my object.Can someone help me? Thanks! I am seeking... For what? Why did you ask me for what? I don't know!

    S E 2 Replies Last reply
    0
    • S Simon W 0

      Hi: I know microsoft word support automation,I can use the fillow two method access word object: #import ..... IApplicationPtr pApp; (1) // Start up existing word, if available HRESULT hr = pApp.GetActiveObject(L"Word.Application"); (2) // Start up fresh instance of word HRESULT hr = pApp.CreateInstance("Word.Application", NULL,LSCTX_LOCAL_SERVER); I wonder how to implement it in my application. I use Windows API RegisterActiveObject to register my application interface,but it can only use the first method to access my object.Can someone help me? Thanks! I am seeking... For what? Why did you ask me for what? I don't know!

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      For CreateInstance() to work, you need to register your class factory with a CoRegisterClassObject() call. (RegisterActiveObject() is only for existing app instances).


      MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.

      S 1 Reply Last reply
      0
      • S Stephane Rodriguez

        For CreateInstance() to work, you need to register your class factory with a CoRegisterClassObject() call. (RegisterActiveObject() is only for existing app instances).


        MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.

        S Offline
        S Offline
        Simon W 0
        wrote on last edited by
        #3

        Thanks very much! BTW,if I want use build both method in my application,should I use both RegisterActiveObject and CoRegisterClassObject? I am seeking... For what? Why did you ask me for what? I don't know!

        1 Reply Last reply
        0
        • S Simon W 0

          Hi: I know microsoft word support automation,I can use the fillow two method access word object: #import ..... IApplicationPtr pApp; (1) // Start up existing word, if available HRESULT hr = pApp.GetActiveObject(L"Word.Application"); (2) // Start up fresh instance of word HRESULT hr = pApp.CreateInstance("Word.Application", NULL,LSCTX_LOCAL_SERVER); I wonder how to implement it in my application. I use Windows API RegisterActiveObject to register my application interface,but it can only use the first method to access my object.Can someone help me? Thanks! I am seeking... For what? Why did you ask me for what? I don't know!

          E Offline
          E Offline
          Ernest Laurentin
          wrote on last edited by
          #4

          Check this out: http://www.microsoft.com/mind/1097/extreme1097.asp[^] ÿVOTD:"The harvest is plentiful, but the workers are few. Ask the Lord of the harvest, therefore, to send out workers into his harvest field." - Luke 10:2

          S 1 Reply Last reply
          0
          • E Ernest Laurentin

            Check this out: http://www.microsoft.com/mind/1097/extreme1097.asp[^] ÿVOTD:"The harvest is plentiful, but the workers are few. Ask the Lord of the harvest, therefore, to send out workers into his harvest field." - Luke 10:2

            S Offline
            S Offline
            Simon W 0
            wrote on last edited by
            #5

            Thanks very much!!! I am seeking... For what? Why did you ask me for what? I don't know!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups