Solved

OCX control & push button

Posted on 1998-06-09
7
379 Views
Last Modified: 2013-11-19

Hi,

I’ve created an OCX control with no need to click on it. Now, I want to trigger methods from that
control via clicking on an ordinary push button (I included OCX in my project so all classes and
their methods are available in my project). But, instead of my own code in imported OCX method
i got the following line:

       InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);

What I need is the way to trigger methods from an OCX without having to click on the control but
with clicking an ordinary push button.

Regards,
Gorg

0
Comment
Question by:gorgar
  • 4
  • 3
7 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1316285
That is generated by Component Gallery. You can just call the member function of the wrapper class. You cannot see your source code in the wrapper class. It uses the IDispatch interface to call the methods.
0
 

Author Comment

by:gorgar
ID: 1316286

I am calling the member function of the wrapper class.
Still the same error :(

gorg

0
 
LVL 23

Expert Comment

by:chensu
ID: 1316287
What error? Compiling error? Linking error? Run time error? Tell me the details please.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:gorgar
ID: 1316288

well, it's not actually an error, it's not what i want it to be!

Let me be more specific: my test OCX (it's supposed to be something more than 'test', but later) contains only one method
void Hello (void) which i inserted via class wizard -> automation tab -> add method and which's supposed to display constant string. Nothing much. I compile and link OCX with no error. Then i insert OCX in my project and get HelloOCX class.
Hello method is there, but when i call it (by clicking not the control but the simple push button) instead of my hello message i get assertion failed and my original line in Hello method (just an AfxMessageBox) is replaced with line:

InvokeHelper(0x1, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);

which cause assertion.


I cannot go on without having this fixed :(((

P.S. Thanx for your patience :))


regards,
gorg






0
 
LVL 23

Expert Comment

by:chensu
ID: 1316289
The InvokeHelper line is correct. It is not possible to see the source code of an OCX.

How do you create the OCX in your window? If you place the OCX in a dialog box, it is created automatically when the dialog box is created. If you want to place the OCX in your window, you need to create it first. For example, the generated wrapper class is CTest. Look at the header file, it has a member function Create. Define a member variable CTest m_test for your window class. In your window class OnCreate message handler, call m_test.Create(_T("test"), WS_VISIBLE | WS_CHILD, rect, this, 0) to create the OCX. Then, when the button is clicked, call m_test.Hello.
0
 

Author Comment

by:gorgar
ID: 1316290

   Neither one version works! :((

Is it ok to send you small piece of code for check out? I mean
considering your free time and will...

regards,
gorg


0
 
LVL 23

Expert Comment

by:chensu
ID: 1316291
chensu@hotmail.com
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Window placement 17 74
Use of condition with 'serial' in ansible 2 49
wordappend challenge 8 143
Change to event 1 99
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now