Re-using VS6 MFC classes

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

Hi, all
I have an experience in programming with VS6 (Visual C++, MFC, STL),
but I'm totally beginner in VS.Net, so forgive me for the stupid
questions. But I'll really appreciate if somebody will spend some
time answering it.

The question is: previously in VS6 I've created some classes, based
on MFC and STL libraries, which perform some specific tasks. Lets say
I have "DoSomething.h" and "DoSomething.cpp". Can I add this
class to the project in Managed C++, create an instance of this class,
call its methods? Or MFC based classes cannot be re-used in MC++
projects at all?

Thanks,
Alex
 
Alex said:
Hi, all
I have an experience in programming with VS6 (Visual C++, MFC, STL),
but I'm totally beginner in VS.Net, so forgive me for the stupid
questions. But I'll really appreciate if somebody will spend some
time answering it.

The question is: previously in VS6 I've created some classes, based
on MFC and STL libraries, which perform some specific tasks. Lets say
I have "DoSomething.h" and "DoSomething.cpp". Can I add this
class to the project in Managed C++, create an instance of this class,
call its methods? Or MFC based classes cannot be re-used in MC++
projects at all?

Thanks,
Alex
Yes you can easily do just that.

Ronald Laeremans
Visual C++ team
 
Thanks Ronald for you attention, but I'm probably missing something
then. My current project, which I'm developing under VS2005
(Manageable C++), is the service. When I go Project->Add Class->MFC
Class... and click the button <<Add>>, I'm getting the message:
"MFC classed can only be added to MFC Project"?

Thanks,
Alex
 
Alex said:
Thanks Ronald for you attention, but I'm probably missing something
then. My current project, which I'm developing under VS2005
(Manageable C++), is the service. When I go Project->Add Class->MFC
Class... and click the button <<Add>>, I'm getting the message:
"MFC classed can only be added to MFC Project"?

Thanks,
Alex

That message is correct.You need to start out with an MFC Wizard
generated project to be able to use the Wizards to add MFC classes.

In general also MFC is NOT designed to be used in an NT service. What
MFC features are you trying to use exactly?

Ronald
 
Sorry, Ronald, you are precise but I was to "general", indeed,
I've created service project which should be periodically checking
some files in predefined locations, read them and send them (as a
parameters of some stored procedure) to SQL Server. Depending on the
result of stored procedure, rename these files and move them to
designated locations.

So far, I've been working with some classes where CFileFind,
CStdioFile classes have been used. And after you answer I'd better
use .Net tools to perform these tasks.

Also I would like to take advantage of your responses and ask another
question. What is the way to install my service on client's machine?
To do so on mine, I can use "command line" from VS2005 environment
and run "....exe -Install". But obviously clients won't be
having VS2005 installed and correspondingly there won't be
C:\WINDOWS\Microsoft.NET\Framework\...\RegSvcs.exe file, but
"native" regsvc.exe file doesn't do anything (my service
doesn't show up in the list of services). So what should I call to
install the service?

Thanks in advance,
Alex
 
Back
Top