C++ Class Help!!!
-
Hello! I'm writing an activex control and I wondered how I could return a pointer to a class object back to a JavaScript Variable. I know that sounds really weird but I'll give you an example: Here's the java script: -------------------------------------------------------------------------------- 1: var testbox; 2: var variable = document.testcontrol; // this points to the active control <object idclass="blahblahblah" id="testcontrol"> 4: testbox = variable.CreateMsgBox(); 5: testbox.SetText("Hello Universe"); // im sick of "Hello World" lol <img src="images/smilies/smile.gif" border="0" alt=""> -------------------------------------------------------------------------------- Let me explain the above code. When the variable named "variable" calls the IDispatch method CreateMsgBox(), on line 4, I want it to return a pointer from the newly created class back to the variable "testbox". Then on line 5 I can access the class methods through the "testbox". Heres the pusedo code of the c++ code when one calls the CreateBox() function above. -------------------------------------------------------------------------------- CCreateBox CreateBox() { 1: CCreateBox newBox; // CCreateBox is the MsgBox class 2: return newBox; } -------------------------------------------------------------------------------- I hope anyone can understand this, and if anyone can help I’d greatly appreciate it!!!!!!!!!!!!! Thank You, Caleb </x-turndown>
-
Hello! I'm writing an activex control and I wondered how I could return a pointer to a class object back to a JavaScript Variable. I know that sounds really weird but I'll give you an example: Here's the java script: -------------------------------------------------------------------------------- 1: var testbox; 2: var variable = document.testcontrol; // this points to the active control <object idclass="blahblahblah" id="testcontrol"> 4: testbox = variable.CreateMsgBox(); 5: testbox.SetText("Hello Universe"); // im sick of "Hello World" lol <img src="images/smilies/smile.gif" border="0" alt=""> -------------------------------------------------------------------------------- Let me explain the above code. When the variable named "variable" calls the IDispatch method CreateMsgBox(), on line 4, I want it to return a pointer from the newly created class back to the variable "testbox". Then on line 5 I can access the class methods through the "testbox". Heres the pusedo code of the c++ code when one calls the CreateBox() function above. -------------------------------------------------------------------------------- CCreateBox CreateBox() { 1: CCreateBox newBox; // CCreateBox is the MsgBox class 2: return newBox; } -------------------------------------------------------------------------------- I hope anyone can understand this, and if anyone can help I’d greatly appreciate it!!!!!!!!!!!!! Thank You, Caleb </x-turndown>
Not a chance in hell. Your COM component runs in a different process, and could even run on a different machine. How is the system going to marshall a class pointer for you ? Both client and server need to know about the class, in fact, you're basically talking about another COM component. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002 Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
-
Hello! I'm writing an activex control and I wondered how I could return a pointer to a class object back to a JavaScript Variable. I know that sounds really weird but I'll give you an example: Here's the java script: -------------------------------------------------------------------------------- 1: var testbox; 2: var variable = document.testcontrol; // this points to the active control <object idclass="blahblahblah" id="testcontrol"> 4: testbox = variable.CreateMsgBox(); 5: testbox.SetText("Hello Universe"); // im sick of "Hello World" lol <img src="images/smilies/smile.gif" border="0" alt=""> -------------------------------------------------------------------------------- Let me explain the above code. When the variable named "variable" calls the IDispatch method CreateMsgBox(), on line 4, I want it to return a pointer from the newly created class back to the variable "testbox". Then on line 5 I can access the class methods through the "testbox". Heres the pusedo code of the c++ code when one calls the CreateBox() function above. -------------------------------------------------------------------------------- CCreateBox CreateBox() { 1: CCreateBox newBox; // CCreateBox is the MsgBox class 2: return newBox; } -------------------------------------------------------------------------------- I hope anyone can understand this, and if anyone can help I’d greatly appreciate it!!!!!!!!!!!!! Thank You, Caleb </x-turndown>
Dim Rs1 As New ADODB.Recordset Rs1 is a pointer to the Recordset interface of the ADODB object. I believe this is what you are asking for. If the control is already embedded in the document using an