Click here to Skip to main content
15,914,071 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: shared memory and address? Pin
includeh105-Sep-03 7:21
includeh105-Sep-03 7:21 
GeneralStoring a file with an exe Pin
Ricky Koh4-Sep-03 21:07
Ricky Koh4-Sep-03 21:07 
GeneralRe: Storing a file with an exe Pin
includeh104-Sep-03 21:10
includeh104-Sep-03 21:10 
GeneralRe: Storing a file with an exe Pin
Ricky Koh4-Sep-03 21:15
Ricky Koh4-Sep-03 21:15 
GeneralRe: Storing a file with an exe Pin
Jagadeesh VN5-Sep-03 4:24
Jagadeesh VN5-Sep-03 4:24 
Generalneed some help - todo: Pin
cridaniel4-Sep-03 17:06
cridaniel4-Sep-03 17:06 
GeneralSelf extracting files Pin
Dor4-Sep-03 15:51
Dor4-Sep-03 15:51 
General**horribly stumped** passing a pointer to C++ from VB Pin
rajdawg4-Sep-03 15:51
rajdawg4-Sep-03 15:51 
When I pass this pointer from Vb to C++ the value is not recieved. The pAcct variable always has the same value (0x0012fadc). If I change the C++ function so that it merely asks for a long value, or int, or even a BSTR, as an argument, the same thing happens (0x0012fadc). But, if I create the Account object in C++ and pass a pointer OUT to VB, that works fine. Or, if I take the value printed by the message box (0x0014F9F0), and copy that into pAcct after control has entered the GetAccount routine, everything works (the value printed from VB is valid). Its very perplexing.
Thanks for whatever advise you can give!
VB Code
<br />
Private Declare Function GetAccount Lib "C:\...\DataAccess.dll" (ByVal ptr As Long)<br />
<br />
Private Sub Form_Load()<br />
Dim Account As clsAccount<br />
Dim ptr As Long<br />
<br />
Set Account = New clsAccount<br />
ptr = ObjPtr(Account)<br />
MsgBox Hex(ptr), vbInformation <-- Prints the following value - 0x0014F9F0<br />
GetAccount ptr<br />
Label1.Caption = "Account Name = " & CStr(Account.AccountName)<br />
End Sub<br />


C++ Code
<br />
extern "C" void __stdcall GetAccount(_clsAccount* pAcct) <-- recieves the value 0x0012fadc<br />
{<br />
HRESULT hr = CoInitialize(0); //initializes COM library<br />
if (SUCCEEDED(hr))<br />
{<br />
_bstr_t bstr1(_T("TestInfo")); //use constructor to enter string <br />
pAcct->put_AccountName(bstr1); <-- causes access violation error <br />
CoUninitialize(); <br />
}<br />
}<br />

ANY suggestions will be IMMENSELY appreciated!
Thanks
GeneralRe: **horribly stumped** passing a pointer to C++ from VB Pin
parths4-Sep-03 17:52
parths4-Sep-03 17:52 
GeneralRe: **horribly stumped** passing a pointer to C++ from VB Pin
rajdawg5-Sep-03 1:20
rajdawg5-Sep-03 1:20 
Questionhow to get the number of digits Pin
elmahdy4-Sep-03 13:44
elmahdy4-Sep-03 13:44 
AnswerRe: how to get the number of digits Pin
Dor4-Sep-03 15:47
Dor4-Sep-03 15:47 
AnswerRe: how to get the number of digits Pin
Larry J. Siddens5-Sep-03 10:17
Larry J. Siddens5-Sep-03 10:17 
GeneralEnvironment Vars... Pin
RobJones4-Sep-03 13:41
RobJones4-Sep-03 13:41 
GeneralRe: Environment Vars... Pin
Neville Franks5-Sep-03 0:15
Neville Franks5-Sep-03 0:15 
GeneralRe: Environment Vars... Pin
RobJones5-Sep-03 3:53
RobJones5-Sep-03 3:53 
GeneralError in adding submenu to the File Menu Pin
Binayak4-Sep-03 13:28
Binayak4-Sep-03 13:28 
GeneralExceptions Pin
Rickard Andersson204-Sep-03 13:03
Rickard Andersson204-Sep-03 13:03 
GeneralRe: Exceptions Pin
dog_spawn4-Sep-03 13:16
dog_spawn4-Sep-03 13:16 
GeneralRe: Exceptions Pin
Rickard Andersson204-Sep-03 22:34
Rickard Andersson204-Sep-03 22:34 
GeneralRe: Exceptions Pin
Alvaro Mendez4-Sep-03 17:40
Alvaro Mendez4-Sep-03 17:40 
GeneralRe: Exceptions Pin
Rickard Andersson204-Sep-03 22:41
Rickard Andersson204-Sep-03 22:41 
GeneralRe: Exceptions Pin
jhwurmbach5-Sep-03 1:18
jhwurmbach5-Sep-03 1:18 
GeneralRe: Exceptions Pin
Andrew Walker5-Sep-03 1:32
Andrew Walker5-Sep-03 1:32 
Questionhow to schedule a a thread to a specific CPU? Pin
Anonymous4-Sep-03 12:46
Anonymous4-Sep-03 12:46 

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.