Solved

Using ocx from a VC console application

Posted on 2002-03-05
9
677 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
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
 
LVL 6

Accepted Solution

by:
Triskelion earned 30 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

What Security Threats Are You Missing?

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.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

706 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

17 Experts available now in Live!

Get 1:1 Help Now