|
-
October 24th, 2002, 05:17 AM
#1
Console application with activex
Hello
I'm trying to combine VC6 console application with activex.
I have bought activex that work fine with VC6 dialog based application.
I add the activex to the dialog based application - and its work fine
I need an example code of how to do it.
Here is the code of the main CPP file:
// ApaxTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "ApaxTest.h"
// "apax.h" is the header file of the active x
#include "apax.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// CApax is the activex class
CApax Apax;
Apax.SetCommPort(1);
Apax.SetBaud(9600);
Apax.PutString("atdt266\r");
}
return nRetCode;
}
Best Regards
Nachum
-
October 24th, 2002, 03:47 PM
#2
Call CoInitialize[Ex] or OleInitialize at the beginning of your _tmain (and CoUninitialize or OleUninitialize at the end).
-
October 24th, 2002, 03:54 PM
#3
Is your object an ActiveX (COM object with all the IOLExxx interfaces), a COM control (i.e. COM object with UI), or a COM component ? If it is a component, the solution is very simple.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|