Click here to Skip to main content
14,599,002 members

C / C++ / MFC

 
AnswerRe: sql string format Pin
James R. Twine2-May-07 5:59
MemberJames R. Twine2-May-07 5:59 
AnswerRe: sql string format Pin
Hamid_RT2-May-07 7:29
MemberHamid_RT2-May-07 7:29 
QuestionAFX_MANAGE_STATE Usage? Pin
rajandpayal2-May-07 4:37
Memberrajandpayal2-May-07 4:37 
AnswerRe: AFX_MANAGE_STATE Usage? Pin
Mark Salsbery2-May-07 5:14
MemberMark Salsbery2-May-07 5:14 
QuestionSafly Remove USB Pin
VC_RYK2-May-07 2:44
MemberVC_RYK2-May-07 2:44 
AnswerRe: Safly Remove USB Pin
Arman S.2-May-07 3:07
MemberArman S.2-May-07 3:07 
GeneralRe: Safly Remove USB Pin
VC_RYK2-May-07 18:23
MemberVC_RYK2-May-07 18:23 
QuestionHow do I pass a byte array from VC++ to VB? Pin
prcarp2-May-07 2:20
Memberprcarp2-May-07 2:20 
First, my apologies for posting this again - it went unanswered in the VB forum so I am trying with a bigger audience here....

I have a VB.NET 2005 application that makes calls to a C/C++ (VC6) DLL and I have that part working fine. The C/C++ DLL makes use of callback functions to let the VB application know of unsolicited events and that works as well (the functions are at least being called). The problem is I don't know the proper parameters to use (either the C++ or VB side) to get a byte array from C++ back to VB.

I have tried the following:
<br />
C++ side:   <br />
BYTE bArray[] = { 11, 12, 13, 14, 15 };<br />
int len = 5;<br />
pfnCallback(bArray, len);<br />
<br />
VB side:<br />
CallbackHandler(ByVal data() as Byte, ByVal len as Integer)<br />


This resulted in the data array length of 1 and it only had the first value of the array no matter how big my array was.

Then I tried:
<br />
C++ side:<br />
SAFEARRAY *psa;  <br />
(then properly created psa, and data copied in)<br />
pfnCallback(psa);<br />
(then properly destroy psa)<br />
<br />
VB side:<br />
CallbackHandler(ByVal data() as Byte)


This resulted in the data array length of 1 and it had the first element of C's SAFEARRAY in it (cDim). I could not see my data.

Am I barking up the wrong tree? Is what I want to do possible? I tried ByRef and got exception errors as it jumped from native code to managed code. For the short term, I made a string showing the hexadecimal values of the byte array and passed the string from the C/C++ library back up to VB; that works fine for now....

Thanks in advance,
Paul
AnswerRe: How do I pass a byte array from VC++ to VB? Pin
Chris Losinger2-May-07 6:38
professionalChris Losinger2-May-07 6:38 
AnswerRe: How do I pass a byte array from VC++ to VB? Pin
lafleon2-May-07 10:20
Memberlafleon2-May-07 10:20 
GeneralRe: How do I pass a byte array from VC++ to VB? Pin
prcarp2-May-07 11:05
Memberprcarp2-May-07 11:05 
QuestionSerbian(cyrillic) language support to MFC in VC6.0 Pin
Y K Kishore Kumar2-May-07 2:20
MemberY K Kishore Kumar2-May-07 2:20 
AnswerRe: Serbian(cyrillic) language support to MFC in VC6.0 Pin
Nemanja Trifunovic2-May-07 2:47
MemberNemanja Trifunovic2-May-07 2:47 
GeneralRe: Serbian(cyrillic) language support to MFC in VC6.0 Pin
Y K Kishore Kumar2-May-07 18:46
MemberY K Kishore Kumar2-May-07 18:46 
QuestionNeed help Pin
yaminisridaran2-May-07 2:04
Memberyaminisridaran2-May-07 2:04 
AnswerRe: Need help Pin
Arman S.2-May-07 2:13
MemberArman S.2-May-07 2:13 
AnswerRe: Need help Pin
Mark Salsbery2-May-07 5:24
MemberMark Salsbery2-May-07 5:24 
QuestionSelect Data Source pops up Pin
Shiva Prasad2-May-07 1:54
MemberShiva Prasad2-May-07 1:54 
QuestionRe: Select Data Source pops up Pin
David Crow2-May-07 2:21
MemberDavid Crow2-May-07 2:21 
AnswerRe: Select Data Source pops up Pin
Mark Salsbery2-May-07 5:28
MemberMark Salsbery2-May-07 5:28 
QuestionWindows 2003 issue Pin
ruchi bansal2-May-07 1:53
Memberruchi bansal2-May-07 1:53 
Questionhow can i draw histogram without using class Pin
ndadashi2-May-07 1:40
Memberndadashi2-May-07 1:40 
AnswerRe: how can i draw histogram without using class Pin
Arman S.2-May-07 2:17
MemberArman S.2-May-07 2:17 
GeneralRe: how can i draw histogram without using class Pin
ndadashi2-May-07 2:39
Memberndadashi2-May-07 2:39 
GeneralRe: how can i draw histogram without using class Pin
Arman S.2-May-07 2:58
MemberArman S.2-May-07 2:58 

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.