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. ATL / WTL / STL
  4. ATL Exe Server Passing array

ATL Exe Server Passing array

Scheduled Pinned Locked Moved ATL / WTL / STL
c++sysadmindata-structureshelpannouncement
1 Posts 1 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
    MANISH RASTOGI
    wrote on last edited by
    #1

    Hi, I have created an ATL exe server which contains one interface. That interface contains one method. I passed an array of short from client side and is printing value of that array in server side. First value of array is correct but other values are worng. I find myself unable to get the reason. Please Help. Server Side ----------- [ object, uuid(40290173-0658-4414-9379-106D912396C2), dual, helpstring("IExeServer1 Interface"), pointer_default(unique) ] interface IExeServer1 : IDispatch { [id(1), helpstring("method Display")]HRESULT Display([in]short nCount, [in, size_is(nCount)] short *pnValue); }; Server side Implementation -------------------------- STDMETHODIMP CExeServer1::Display(short nCount, short *pnValue) { char szBuffer[20] = {0}; short int nCounter; for(nCounter = 0; nCounter < nCount; nCounter++) { sprintf(szBuffer, "%d", pnValue[nCounter]); MessageBox(NULL, szBuffer, "Message", MB_OK); } return(S_OK); } Client Side Implementation -------------------------- HRESULT hResult; IExeServer1 *pIExeServer = NULL; int iCounter = 0; short *pnValue = NULL; ::CoInitialize(NULL); hResult = CoCreateInstance(CLSID_ExeServer1, NULL, CLSCTX_LOCAL_SERVER, __uuidof(IExeServer1), reinterpret_cast(&pIExeServer)); if(SUCCEEDED(hResult)) { pnValue = reinterpret_cast(CoTaskMemAlloc(5 * sizeof(short))); for(iCounter = 0; iCounter < 5; iCounter++) { pnValue[iCounter] = iCounter + 1; } pIExeServer->Display(5, pnValue); CoTaskMemFree(pnValue); pIExeServer->Release(); } ::CoUninitialize(); Thanks Manish Rastogi

    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