Solved

OCX control & push button

Posted on 1998-06-09
7
375 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 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

19 Experts available now in Live!

Get 1:1 Help Now