Click here to Skip to main content
15,890,512 members
Home / Discussions / COM
   

COM

 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 0:54
K ARUN KUMAR18-May-10 0:54 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt18-May-10 5:25
Stephen Hewitt18-May-10 5:25 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 18:13
K ARUN KUMAR18-May-10 18:13 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt18-May-10 18:22
Stephen Hewitt18-May-10 18:22 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 18:46
K ARUN KUMAR18-May-10 18:46 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt18-May-10 18:53
Stephen Hewitt18-May-10 18:53 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 19:02
K ARUN KUMAR18-May-10 19:02 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt18-May-10 19:17
Stephen Hewitt18-May-10 19:17 
There's many problems here. Firstly you haven't escaped the post properly so it's hard to read. For example:
K ARUN KUMAR wrote:
reinterpret_cast(CoTaskMemAlloc(sSize * sizeof(BYTE)));

You didn't escape the < and > so some important code is missing.

You didn't bother to point out explicitly which code is in the client and which is in the server.

Surrounding code in <pre> and </pre> tags is generally considered polite, not to mention the fact that it makes the code more readable (uses a fixed width font).
You also didn't bother to ensure the code was properly indented.

In short, if you want help, put some effort in asking for it (at least as much as I do in replying!).

Now onto the code....


K ARUN KUMAR wrote:
BYTE byt[6];
int i=0;
for(;*bytArray!=0;i++)
{
byt[i]=*bytArray;

::MessageBox(NULL,(LPCTSTR)"he","Msg",MB_OK);
bytArray++;
}
byt[i]=0;


This doesn't make use of size. Ever heard of buffer overruns?
What's with the (LPCTSTR)"he"? Get rid of the cast. If the string is of the wrong type casting just turns what would have been a compiler error into a runtime error and solves nothing.


K ARUN KUMAR wrote:

//Allocate the shared Memory
pBytes = reinterpret_cast(CoTaskMemAlloc(sSize * sizeof(BYTE)));
if(pBytes == NULL)
return;


CoTaskMemAlloc does ***NOT*** allocate shared memory! You don't need to use it in this case (although there is no harm in using it).

Can you tell me more about what actually happens when you run it. Does the CDataProvider::SetData function get called? Does it display a MessageBox? How many times?
Steve

GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 20:03
K ARUN KUMAR18-May-10 20:03 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt18-May-10 20:19
Stephen Hewitt18-May-10 20:19 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 20:29
K ARUN KUMAR18-May-10 20:29 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt18-May-10 20:37
Stephen Hewitt18-May-10 20:37 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 21:01
K ARUN KUMAR18-May-10 21:01 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt18-May-10 21:16
Stephen Hewitt18-May-10 21:16 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 21:30
K ARUN KUMAR18-May-10 21:30 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
Stephen Hewitt18-May-10 21:40
Stephen Hewitt18-May-10 21:40 
GeneralRe: TROUBLE Passing BYTE Array from Client to COM OUTPROC Server Pin
K ARUN KUMAR18-May-10 22:51
K ARUN KUMAR18-May-10 22:51 
QuestionProblem with ActiveX control Pin
NarVish17-May-10 1:44
NarVish17-May-10 1:44 
AnswerRe: Problem with ActiveX control Pin
Cool_Dev18-May-10 1:59
Cool_Dev18-May-10 1:59 
GeneralRe: Problem with ActiveX control Pin
NarVish21-May-10 0:05
NarVish21-May-10 0:05 
QuestionCan we call dynamically COM exposed methods inhertied from IUnknow? Pin
glitteringsound14-May-10 2:07
glitteringsound14-May-10 2:07 
QuestionWhy Exception occured getting address of COM function ? [modified] Pin
glitteringsound12-May-10 21:21
glitteringsound12-May-10 21:21 
Questionlanguage localization using XML in VC++ Pin
punyah20108-May-10 9:03
punyah20108-May-10 9:03 
AnswerRe: language localization using XML in VC++ Pin
Cool_Dev18-May-10 2:04
Cool_Dev18-May-10 2:04 
QuestionHow to read Tyupe Libraries(TLBs) in C#? Pin
glitteringsound5-May-10 20:08
glitteringsound5-May-10 20:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.