473,401 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Adding MSCOMM control to Visual C++ Application

Hi,

I am modifying a rather large and complex MFC application (written by someone else) written in Visual C++ 6.0 with service pack 6. I need to add serial communication functionality to the program, and since I am very familiar with the Microsoft Comm Control from Visual Basic I decided that I would use that in this application.

To make things easier on myself, I decided to make several test applications using the MS Comm control in VC++ prior to modifying the large program. My test applications have been successful in communicating over the serial port.

However, as soon as I attempt to add the MS Comm Control to the form of the larger, more complex application it fails to run. It compiles successfully with no errors or warnings, but when I run it it exits immediately. I've tried stepping through it, but the only way I can manage to catch anything is if I set a breakpoint on the constructor of the main form. It doesn't even get far enough to call OnInitDialog!

As soon as I remove the MS Comm Control from the form and comment out any references to it in code the program once again runs. I'm really at wit's end here. I would greatly appreciate any help.

The reason I haven't included any code in this post is because I'm not sure what would be helpful - as far as the MSComm control goes, the only code that references it in the complex application was automatically generated, such as adding a member variable to the form's class, including the CMSComm.h file, etc. If you'd like to see anything in particular let me know.

Thanks,
Ian
Sep 12 '07 #1
4 5491
Surely someone must have some idea what the problem is. Anyone?
Sep 14 '07 #2
I just had an epiphany!

Whenever I created a VC++ MFC application, I always made sure that "ActiveX Controls" support was checked. I just created an application without the ActiveX support included to see what would happen if I tried to include the MSComm control anyway. Sure enough, it compiles with no errors or warnings, but it exits immediately when I try to run it!

So now I have the question, what does checking the include "ActiveX Controls" support actually do? Does it just add directives or includes that I can add after the fact? How can I include support for ActiveX controls in an application that previously did not include that support?

Thanks,
Ian
Sep 14 '07 #3
I haven't touched VC++ for a long long time, and at the moment I only have VS2005 installed.
Looking at the help, if you uncheck the box, and would like to add the ActiveX control support later, you should add the call AfxEnableControlContainer() in your application's InitInstance function.

Not sure if this helps.
Sep 14 '07 #4
Sorry to reply to my own message again, but I found the solution to my problem.

Checking the "ActiveX Controls" support checkbox does a few things:
1) Adds #include <afxdisp.h> to StdAfx.h
2) Adds a call to AfxEnableControlContainer(); in the application's InitInstance function.

Once I added those two things to my larger, more complex application it ran fine.

Ian
Sep 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tico Tech | last post by:
Hi: I have a question about the Microsoft Communications Control Version 6.0 from visual studio .net. I have this code: Dim Buffer As String Do Buffer = AxMSComm1.Input() //Error, it does...
0
by: stacy | last post by:
I used the wizard to upgrade an application from VB 6 to VB.net, the following warnings appear around the .Input method of the MSCOmm control 'UPGRADE_WARNING: Couldn't resolve default property of...
1
by: Peter Krikelis | last post by:
Hi, I am trying to develope a User Control Library that features MScomm control. I test my user control in a test application. When I run the application I receive the following: An...
0
by: morgal | last post by:
That is one reason I quit using MS custom controls, you have to buy the license. In VB 6 they give you a try it license and then you develop a huge application or small one and find out you don't...
6
by: Barry Martin | last post by:
I am using an activex control mscomm to control a serial port in VB.NET. I place the control on the main form and set its port, baud rate, etc. properties. After creating a code module that needs...
1
by: Barry | last post by:
I am using the mscomm activex control in vb.net. I can add the control to the toolbar which will allow me to drop it onto a form. As long as I am in the code space for that form it works fine....
1
by: Pete | last post by:
Hello, Have just started using VB.Net and have been trying to work on some updates to a very old piece of code. Currently we send messages via the serial port in the following formate ...
6
by: Tico Tech | last post by:
Hi: I have a question about the Microsoft Communications Control Version 6.0 from visual studio .net. I have this code: Dim Buffer As String Do Buffer = AxMSComm1.Input() //Error, it does...
3
by: MarkTingson | last post by:
Hello Scripters, I have a project that needs to connect with a bluetooth device. My bluetooth is connected to my USB Port..Is it possible to use MSCOMM control to access my bluetooth?. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.