?
Solved

Using ocx from a VC console application

Posted on 2002-03-05
9
Medium Priority
?
715 Views
Last Modified: 2008-02-07
Hi,
I'm using a third party .ocx in a VB environment without problem. Now I aim to use it within a Win32 console application (Visual C++ 6). My .ocx has not to interact any way with the user (no windows).
Is there a sample for this?
Best regards
0
Comment
Question by:cbonjovi
[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
9 Comments
 
LVL 6

Expert Comment

by:Triskelion
ID: 6841617
How are you calling to the ocx?
Did you convert it to a class first?

You can create a fake (temporary) GUI just to get the ocx converted, then move it into your console app project.
0
 

Author Comment

by:cbonjovi
ID: 6841738
Ok, this is an idea.
The problem is temporary GUI and console app MUST BE the same .exe.
Could you provide a sample for this?
Thank you very much
Regards,
Christian
0
 

Expert Comment

by:wenderson
ID: 6843511
Win32 console applications are regular Windows applications, so if you want to create a window or a dialog, just call the correct functions, ex.:

#include <windows.h>

int main()
{
  MessageBox(0, "Hello there, GUI world!", "My Console Application", MB_OK);
  return 0;
}

The opposite is also true, you can create an GUI application which creates a console instead of a window.

Wenderson Teixeira
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.

 
LVL 6

Accepted Solution

by:
Triskelion earned 120 total points
ID: 6844476
I meant...
  You will only create the the temporary GUI app to make the class wizard allow you to import the ocx into your project.

Once the OCX has been converted to CPP/.h by the class wizard, you can copy the files over to your console app directory and add them to your project.

0
 

Author Comment

by:cbonjovi
ID: 6847257
I see Triskelion,
good idea, but I didn't understand how.
Could you provide an example?
Regards
0
 

Author Comment

by:cbonjovi
ID: 6847262
But at the end,
how to import an activex control in a VisualC++ console application?
0
 
LVL 6

Expert Comment

by:Triskelion
ID: 6848156
Yes, after you have created the class from the OCX, copy the .cpp and .h files into your console ap;p project directory.

Select
   project -> Add To Project -> Files
Browse and select the .h and .cpp files you just copied over.

You may need to change the header file name included in  the new .cpp file and remove the #include <stdafx.h>
0
 
LVL 11

Expert Comment

by:griessh
ID: 6955264
Dear cbonjovi

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "Triskelion"

comment(s) as an answer.

=========================================================
You have 20 open questions out of 41 that need your attention! Please take
some time and accept an answer if an expert was able to help you or
provide feedback if needed.
==========================================================

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 6979030
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

765 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