Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using ocx from a VC console application

Posted on 2002-03-05
9
Medium Priority
?
732 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
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!

 
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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…
Suggested Courses

610 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