Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

OCX control & push button

Posted on 1998-06-09
7
Medium Priority
?
405 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 100 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

879 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