Click here to Skip to main content
15,918,168 members
Home / Discussions / COM
   

COM

 
GeneralRe: Forward declaration of interfaces Pin
Rowan Seymour11-Sep-03 3:34
Rowan Seymour11-Sep-03 3:34 
GeneralRe: Forward declaration of interfaces Pin
arun140529-Oct-03 2:18
arun140529-Oct-03 2:18 
GeneralRe: Forward declaration of interfaces Pin
Rowan Seymour29-Oct-03 2:58
Rowan Seymour29-Oct-03 2:58 
GeneralIE Automation Pin
nikhilkhedkar8-Sep-03 21:08
nikhilkhedkar8-Sep-03 21:08 
GeneralRe: IE Automation Pin
nikhilkhedkar9-Sep-03 2:18
nikhilkhedkar9-Sep-03 2:18 
GeneralStack messed up upon function returned Pin
DionChen8-Sep-03 8:04
DionChen8-Sep-03 8:04 
QuestionHow to pass VBA Collection to COM DLL from .NET C#? Pin
ajkumar4-Sep-03 15:21
ajkumar4-Sep-03 15:21 
Generalpassing a pointer into C++ from VB Pin
rajdawg3-Sep-03 16:31
rajdawg3-Sep-03 16:31 
When I pass this pointer from Vb to C++, for some reason the value changes from when it is printed by the MsgBox in Vb, and when it is received in C++.
If I change the C++ function so that it merely asks for a long value as an argument, the same thing happens. 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, 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! Smile | :)
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 />
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 />

GeneralRe: passing a pointer into C++ from VB Pin
Lim Bio Liong18-Sep-03 7:51
Lim Bio Liong18-Sep-03 7:51 
GeneralThreading issue Pin
kkfromus2-Sep-03 11:16
kkfromus2-Sep-03 11:16 
GeneralRe: Threading issue Pin
valikac3-Sep-03 6:22
valikac3-Sep-03 6:22 
GeneralRe: Threading issue Pin
kkfromus3-Sep-03 11:35
kkfromus3-Sep-03 11:35 
GeneralRe: Threading issue Pin
valikac4-Sep-03 9:07
valikac4-Sep-03 9:07 
GeneralRe: Threading issue Pin
Anonymous12-Sep-03 12:16
Anonymous12-Sep-03 12:16 
GeneralRe: Threading issue Pin
kkfromus12-Sep-03 14:40
kkfromus12-Sep-03 14:40 
GeneralThread Id of client app Pin
In-At1-Sep-03 18:30
In-At1-Sep-03 18:30 
GeneralRe: Thread Id of client app Pin
igor19603-Sep-03 10:33
igor19603-Sep-03 10:33 
Generalwhy CoCreateInstance( ... IID_IShellLink, ..) failed Pin
nofeel1-Sep-03 16:41
nofeel1-Sep-03 16:41 
GeneralRe: why CoCreateInstance( ... IID_IShellLink, ..) failed Pin
PengFeidu7-Sep-03 20:08
PengFeidu7-Sep-03 20:08 
GeneralRe: why CoCreateInstance( ... IID_IShellLink, ..) failed Pin
Lim Bio Liong18-Sep-03 8:06
Lim Bio Liong18-Sep-03 8:06 
GeneralRe: why CoCreateInstance( ... IID_IShellLink, ..) failed Pin
Lim Bio Liong19-Sep-03 0:53
Lim Bio Liong19-Sep-03 0:53 
GeneralKeeping COM server active Pin
Gilrock1-Sep-03 14:00
Gilrock1-Sep-03 14:00 
GeneralRe: Keeping COM server active Pin
igor19603-Sep-03 10:43
igor19603-Sep-03 10:43 
GeneralRe: Keeping COM server active Pin
Gilrock3-Sep-03 11:20
Gilrock3-Sep-03 11:20 
GeneralRe: Keeping COM server active Pin
igor19603-Sep-03 11:36
igor19603-Sep-03 11:36 

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.