Solved

OCX control & push button

Posted on 1998-06-09
7
393 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hibernate methods 2 88
tripleUp challenge 7 97
mapAB Challlenge 35 186
Message not shown 5 106
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

751 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