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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CreateFromFile of COleClientItem fail

CreateFromFile of COleClientItem fail

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialtoolsperformancehelpquestion
5 Posts 2 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.
  • M Offline
    M Offline
    MKC002
    wrote on last edited by
    #1

    I want to preview doc file using CreateFromFile of COleClientItem.Tis method takes COleDocument object as argument. Sometimes CreateFromFile success and i can see the preview but sometimes it's fail for same file. I did not understand the reason why. Can someone guide me? Is there any memory problem? Also if i have office 2003 installed at my system and to open ofice 2007 file i installed utility provided by microsoft. Using CreateFromFile if i want to preview office 2007 file then CreateFromFile failed. But in some cases it's succeed and i see the file name in preview contents.How to see the actual contents? Should i use any other function in this case.

    H 1 Reply Last reply
    0
    • M MKC002

      I want to preview doc file using CreateFromFile of COleClientItem.Tis method takes COleDocument object as argument. Sometimes CreateFromFile success and i can see the preview but sometimes it's fail for same file. I did not understand the reason why. Can someone guide me? Is there any memory problem? Also if i have office 2003 installed at my system and to open ofice 2007 file i installed utility provided by microsoft. Using CreateFromFile if i want to preview office 2007 file then CreateFromFile failed. But in some cases it's succeed and i see the file name in preview contents.How to see the actual contents? Should i use any other function in this case.

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      Are you initializing the OLE libraries?

      Best wishes, Hans


      [Hans Dietrich Software]

      M 1 Reply Last reply
      0
      • H Hans Dietrich

        Are you initializing the OLE libraries?

        Best wishes, Hans


        [Hans Dietrich Software]

        M Offline
        M Offline
        MKC002
        wrote on last edited by
        #3

        I used CoInitialize(NULL) and AfxEnableControlContainer(); in InitInstance. Is there something else which i sould do

        H 1 Reply Last reply
        0
        • M MKC002

          I used CoInitialize(NULL) and AfxEnableControlContainer(); in InitInstance. Is there something else which i sould do

          H Offline
          H Offline
          Hans Dietrich
          wrote on last edited by
          #4

          Try calling AfxOleInit() in InitInstance.

          Best wishes, Hans


          [Hans Dietrich Software]

          M 1 Reply Last reply
          0
          • H Hans Dietrich

            Try calling AfxOleInit() in InitInstance.

            Best wishes, Hans


            [Hans Dietrich Software]

            M Offline
            M Offline
            MKC002
            wrote on last edited by
            #5

            AfxOleInit did not solve the problem. Let me describe in details how i am doing i create a mfc dll.In this dll i create below classes class CDocData : public COleDocument class CEmbedWordCntrItem : public COleClientItem class CViewData : public CView Is there any example for createfromfile

            modified on Thursday, April 14, 2011 4:15 AM

            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