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. BSTR thru COM does not seem to be passed.....

BSTR thru COM does not seem to be passed.....

Scheduled Pinned Locked Moved COM
c++comsysadminhelpquestion
3 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
    morenz
    wrote on last edited by
    #1

    Hi everybody, I've got a strange thing using my DCOM application(s). I wrote both server and client, and one of the last issues I can't resolve is the following: On the server machine (EXE Server with MFC) I have the following class method (with implementation): STDMETHODIMP CAugVisionEngine::ReadText(BSTR CharSetName, int pTop, int pLeft, int pHeight, int pWidth, BSTR *OcrString) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) ...[code omitted here for brevity] ... char* strTemp = (char*) malloc(sizeof(OcrReport_tmp->readString)+1); strcpy(strTemp, OcrReport_tmp->readString); *OcrString = W2BSTR(A2W(strTemp)); return S_OK; } where the last parameter, the BSTR, is the return value of the function (just [out], not [out, retval]) When I call the function from the client (for now MFC application, just to test, but the release will be a console application), in a way like this: BSTR OCRBSTR; pIVE->ReadText ("C:\\Patterns\\3260\\05042800\\1235.abc",40, 249, 48, 83, &OCRBSTR); I get that the server constructs the BSTR correctly (at least, it seems to do it, since a logfile is populated correctly), but my client retrieves nothing... I'm stuck... Any ideas? Thanks in advance, Morenz.

    P 1 Reply Last reply
    0
    • M morenz

      Hi everybody, I've got a strange thing using my DCOM application(s). I wrote both server and client, and one of the last issues I can't resolve is the following: On the server machine (EXE Server with MFC) I have the following class method (with implementation): STDMETHODIMP CAugVisionEngine::ReadText(BSTR CharSetName, int pTop, int pLeft, int pHeight, int pWidth, BSTR *OcrString) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) ...[code omitted here for brevity] ... char* strTemp = (char*) malloc(sizeof(OcrReport_tmp->readString)+1); strcpy(strTemp, OcrReport_tmp->readString); *OcrString = W2BSTR(A2W(strTemp)); return S_OK; } where the last parameter, the BSTR, is the return value of the function (just [out], not [out, retval]) When I call the function from the client (for now MFC application, just to test, but the release will be a console application), in a way like this: BSTR OCRBSTR; pIVE->ReadText ("C:\\Patterns\\3260\\05042800\\1235.abc",40, 249, 48, 83, &OCRBSTR); I get that the server constructs the BSTR correctly (at least, it seems to do it, since a logfile is populated correctly), but my client retrieves nothing... I'm stuck... Any ideas? Thanks in advance, Morenz.

      P Offline
      P Offline
      prasad_som
      wrote on last edited by
      #2

      your code doesn't seem to have problem.

      morenz wrote:

      *OcrString = W2BSTR(A2W(strTemp));

      As you said, this value you are writing in log file, isn't it? -- modified at 4:56 Tuesday 14th November, 2006

      Prasad Notifier using ATL | Operator new[],delete[][^]

      M 1 Reply Last reply
      0
      • P prasad_som

        your code doesn't seem to have problem.

        morenz wrote:

        *OcrString = W2BSTR(A2W(strTemp));

        As you said, this value you are writing in log file, isn't it? -- modified at 4:56 Tuesday 14th November, 2006

        Prasad Notifier using ATL | Operator new[],delete[][^]

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

        yes, I'm writing it in a file as a string. When I debug it, I see that the BSTR has the correct value, too... For now I workarounded it, making the client open the file directly on the server and getting the string itself, but it's not elegant...

        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