Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C and C++

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-14-2007, 08:39 AM
ifitzgerald ifitzgerald is offline
Newbie
 
Join Date: Sep 2007
Posts: 3
Credits: 0
Rep Power: 0
ifitzgerald is on a distinguished road
Default 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 cl***, including the CMSComm.h file, etc. If you'd like to see anything in particular let me know.

Thanks,
Ian
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 09-14-2007, 08:57 AM
ifitzgerald ifitzgerald is offline
Newbie
 
Join Date: Sep 2007
Posts: 3
Credits: 0
Rep Power: 0
ifitzgerald is on a distinguished road
Default I had an epiphany!

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-14-2007, 10:05 AM
ifitzgerald ifitzgerald is offline
Newbie
 
Join Date: Sep 2007
Posts: 3
Credits: 0
Rep Power: 0
ifitzgerald is on a distinguished road
Default Solution

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Studio 2005 and Windows Vista Jordan General Programming 3 01-22-2007 03:21 PM
Visual Studio 2005 Pro Won't Install CheeseBurgerMan Software Development Tools 10 09-22-2006 05:44 PM
Visual Studio 2005 Express Edition Crane Software Development Tools 9 05-25-2006 06:17 PM


All times are GMT -5. The time now is 01:07 AM.

Contest Stats

Xav ........ 1322.18
MeTh0Dz|Reb0rn ........ 1053.7
morefood2001 ........ 879.43
John ........ 877.37
marwex89 ........ 869.98
WingedPanther ........ 830.24
Brandon W ........ 735.07
chili5 ........ 309.39
Steve.L ........ 239.84
dcs ........ 216.02

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 82%

Ads