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
M

magicast

@magicast
About
Posts
4
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • serialize using stream. - binary
    M magicast

    hi~ I apologize being not good at English. I wanna serialize my own data for network/file/etc... I thought that stream of c++ standard library is suitable. but, there's no facilities exactly for my use. 1. I wanna store stream data into memory.(not file) 2. insertion and extraction must operate in binary mode. // example of usage // proc A omystream ms; // mystream is that I wanted.. int n = 1; short s = 2; ms << n << s; // or ms << int_b(n) << short_b(s); // int_b(), short_b() is custom manipulators ::send(ms.buf(),...); // send to network // proc B BYTE buf[4096]; ::revc(buf,...); // receive from network imystream ms(buf, dwSizeReceived); // dwSizeReceived = 6 int n; short s; ms >> n >> s; // n = 1, s = 2 // or ms >> int_b(n) >> short_b(s); // result data occupy 6 bytes memory. (4 for n(int), 2 for s(short)) send and receive 6 byte of memory. memory layout: 00 00 00 01 00 02 // 6 byte not "000000010002" // 12 byte this mean not string but binary. how can I achieve it? derive strstream or stream? derive stream_buf? I need your advice. :) thanks in advance.

    ATL / WTL / STL question c++ sysadmin performance tutorial

  • How can I define packed structure in IDL?
    M magicast

    How can I define packed structure in IDL? Most of compilers align structure in 4/8 bytes. IN VC++ 6.0, we can control this by using '#pragma pack' directive. But, how can we do the same thing in IDL? I tried to using '#pragma pack' directive in IDL like we do in c++. It looks successful only in COM-Server Project. Compiler-made Header file in server project has '#pragma pack' directives enclosing structure-definition. But, client project using '#import My.tlb' has failed. My.tlh file defines this (I expect to be packed) as unpacked structure(maybe 8byte-align). How can I define structure as packed? I want structure to be packed in Header files made by MIDL(includes tlh). And, Proxy/Stub code made automatically refelcts this. How can I solve it? thanks~

    COM com question c++ sysadmin

  • How can I get an array of datas from COM server?
    M magicast

    Thank you. You flew my trouble. now I'm happy ;) goodday~

    COM c++ question com sysadmin data-structures

  • How can I get an array of datas from COM server?
    M magicast

    hi~ Thanks for reading my problem. :) I'm not good at english. I hope for u to understand me. I make a DCOM service with Visual C++ 6.0. I want that COM Server returns an array of datas, ex 10 number of integers. I wrote idl like this. [id(2), helpstring("method B")] HRESULT B([out] long* plCount, [out, size_is(, *plCount)] long** pplData); and wrote implementation as follows, STDMETHODIMP CMyB::B(long *plCount, long **pplData) { *plCount = 10; *pplData = static_cast(::CoTaskMemAlloc(sizeof(long) * *plCount)); for (int nIndex = 0; nIndex < *plCount; nIndex++) *(*pplData + nIndex) = 5000 + nIndex; return S_OK; } when I call this method in client, I expect the result like {5000, 5001, 5002, 5003...}. but I get 5000 and gabarge. {5000, ....invalid data...} I debuged server program and I can identifed all the elements are set correctly. but client has only 1 data. Why this occur? How can I solve this? and... now, I treat 'long' type data. but, I want to treat custom type(struct etc...) in the future, also. I hope for u save me. :) goodday~

    COM c++ question com sysadmin data-structures
  • Login

  • Don't have an account? Register

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