Solved

good points for good answer

Posted on 2001-08-25
7
206 Views
Last Modified: 2010-05-18
Hi guys here's the situation.

I wanna write a windows2000 based app, using VC++6.

The app would only run when scheduled to.  It would have a system sevice that would query a database via dsn connection every 5 min or so.  if it detects that it should run it will spawn off a child process that will do various things on the server, db access, internet access etc.

here's the question.  I wanna know what sort of technologies I would use and how I would integrate them with one another.  this is what I have so far.

I would be using ATL for the system service.  this in turn will use ADO to connect to my db via the dsn.  

when it decides it should run I figured i would then import code stored in DLL's (that way the system service is kept to a minimum).

it all sounds a bit iffy, well that's becuase my kowledge on these topics is a bit iffy :-)  that's where you guys come in.

what I'd like is for someone to clarify what exactly I should be researching to improve my understanding.

0
Comment
Question by:MattC
  • 4
  • 2
7 Comments
 
LVL 1

Expert Comment

by:Toad224
ID: 6425467
Windows has something called "Scheduled Tasks" which would allow you to run something every 5 min. or so...  Look in the control panel...
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6425604
I have done a similar project, but in MFC.  That made it easy to create a Tray Icon for access to settings, etc.  I started with a CNtService class that I had hanging around.  Patched in the UI of a dialog-based app and used CRecordset for db access.

There is really nothing to it.  But since you are here in the C++ section, you are probably an MFC hater, so... never mind.

-- Dan
0
 
LVL 1

Author Comment

by:MattC
ID: 6426419
no I am using the MFC's for CinternetSession and all the other classes.  Are services that run with a tray icon any different to those that don't like iisadmin.  

Also what is the difference in using #import to use functions stored in DLL's as opposed to using CreateInstance (COM).

Dan,

If you have a simple system service then post it in my other question please :-)

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=cplusprog&qid=20138513
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 1

Author Comment

by:MattC
ID: 6446654
Are services that run with
a tray icon any different to those that don't like iisadmin.  

Also what is the difference in using #import to use functions stored in DLL's as opposed to using CreateInstance
(COM).  Would it be better to write my DB and internet access classes in DLL that are importable or DLL and use COM to implement them?
0
 
LVL 1

Author Comment

by:MattC
ID: 6458833
thnx dan the points are yours if you can just clarify my last question.
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 200 total points
ID: 6459330
>> Are services that run with a tray icon any different to those that don't like iisadmin.  

Only in that you need to do the UI programming for it.  You must provide the tray icon handling and whatever popup dialog box, etc. comes up when you double-click the icon.  Also, the service must be configured to "allow to interact with the desktop."

>> Also what is the difference in using #import to use functions stored in DLL's as opposed to using CreateInstance (COM).  Would it be better to write my DB and internet access classes in DLL that are importable or
DLL and use COM to implement them?

I think this is

A COM style interface is the way to go for many types of projects. It provides a generized way for any program (VB, Javascript, C++) to access its functions.  

But there is a considerable learning curve to writing your first COM object.  From what you describe, there is no need for it in the scenario that you paint.  Just wirte a Service that wakes up every 5 minutes, does its job, then goes back to sleep.  "Its job" would be to spawn some other program, make some additional datbase accesses,... whatever.  It could read its settings from a manually maintained INI file (or registry settings) Or you can have a separate (very simple) dialog-based app maintain those settings.  Once the core functionality is there, you can dress it uo with a UI, tray icon, etc.
-=--=-=-=-=-=

All this stuff about DLLs and COM is, i think related to this from your original Q:

>>when it decides it should run I figured i would then import code stored in DLL's (that way the system service is kept to a minimum).

Keeping the system service footprint small is fine, but hardly relevant unless you are talking about grabbing and holding 5MB of memory -- unlikely in the task you describe.  Just write the NT Service code without getting fancy.  Memory considerations can be fixed up later.

-- Dan
0
 
LVL 1

Author Comment

by:MattC
ID: 6459553
thanks Dan,

well I figure I'll do as u suggested, run a job checker as a service using ATL, when a job needs to run it will just thread off another process and go back to sleep.

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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

21 Experts available now in Live!

Get 1:1 Help Now