httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Complete source for Apache MSVC/Borland IconBar APP
Date Wed, 28 Jun 2000 03:42:40 GMT

In a message dated 00-06-27 09:54:00 EDT, William Rowe writes...

> Actually looked at three things... the third being the IconBar app
>  issue... since I have some nearly pure code for it.  It was coded
>  for ATL 2.0, but that's a pretty 'simple' windowing system (compared
>  to MFC, which has always put more roadblocks in my way than actually
>  accelerating development :(

It gets even simpler than that. You don't need to bother with either
ATL or MFC to have a great IconBar App. In fact, there are many
reasons to definitely STAY AWAY from that stuff when it comes
to TRAY ICON apps.

See attached code. ( APTRAY1.ZIP only 46k )

It is a complete working IconBar App that is about as simple
and as flexible as it gets and it uses pure Win32 API only.

It is also a perfect example of how to code such an application
to compile with either MSVC or Borland, which gets real weird
if it started out as ATL or MSVC.

The attached IconBar APP is already coded to 'look' like an
Apache TRAY ICON program that can Start/Stop the Apache
Service and even has the right APACHE.ICO icon already.

It is only 53k including the Win32 Registry update code to
make it a permanent 'persistent' TRAY ICON.

It compiles/runs/installs as a persistent TRAY ICON using
all of the following ( Build files for all included... )
MSVC 5.x
MSVC 6.x
Borland 5.0
Borland 5.5 ( Free version of compiler that uses ilink32.exe ).

The info from the top of the attached TRAY1.C code also
reprinted at the bottom of this message.

>My concept of a taskbar is some simple way to enumerate all services
>installed vs. all services running.  Services installed is pretty
>straightforward, simply parsing strstr of the services key for all
>the Apache.exe string (don't care which directory, of course.)  And
>enumerating the Win9x running servers is easy as well, simply use
>FindWindow() with the service class and collect window names.  But
>enumerating running NT services will always be trouble.

No sweat ( See source code.. )

Just WinExec( "NET START > Services_running" )
and read the list.
NET START with no parms always list ALL Services 
that are currently running.

If the NET START command isn't available you can be sure
the Service probably isn't running due to an incomplete MS
Network support install.

I've never seen a Network enabled Win32 station that didn't
have the NET commands available anytime, anywhere, from
either command line or 'callable' with output 'redirectable'.

NET.EXE was DESIGNED to be used in this way
and even includes 'secret' commands to help reformat
and/or parse the data when called via WinExec().

It even works fine with a simple 'system()' call.

Kevin Kiley
CTO, Remote Communications, Inc. - Online Internet Compression Server

Here is the info from the top of attached TRAY1.C...

// TRAY1 - Simple Win32 Tray ICON application

// This 'simple' program can act as a front-end for any Win32
// Service related application.

// It does NOT use ATL, MFC, or any of that other bloat.
// It is a clean-and-simple .C program that used the Win32 API
// to establish and maintain a Win9x/2000 or NT TRAY ICON.

// The final TOTAL size of the .EXE is only around 53k.
// If MFC or ATL were used the .EXE would be MUCH, MUCH larger
// and more complicated.

// This particular instance of the code has been made to 'look'
// like a demo front-end for the Win32 version of the Apache
// Web Server 'Service'. The TRAY ICON itself will appear as a
// small 'feather' which is simply the standard APACHE.ICON icon
// from ..\SRC\OS\WIN32\APACHE.ICO

// The menu options simply say...

// 1. Show  the Apache Web Server Control Panel
// 2. Start the Apache Web Server
// 3. Stop  the Apache Web Server

// The TRAY related calls and globals are all prefixed with
// 'ap_tray1_xxxxx()' so they don't conflict with any
// non-Apache routines.

// To BUILD this demo just use the .BAT files.
// There are no makefiles or project files.
// They are not necessary for such a simple program.

// MKMSVC5.BAT <- Rebuild TRAY1.EXE manually using MSVC 5.x
// MKMSVC6.BAT <- Rebuild TRAY1.EXE manually using MSVC 6.x
// MKBOR50.BAT <- Rebuild TRAY1.EXE manually using Borland 5.0 (tlink32)
// MKBOR55.BAT <- Rebuild TRAY1.EXE manually using Borland 5.5 (ilink32)

// The program also shows the proper way to use _argc and _argv[]
// command line argument info in WinMain() and make it generic to
// both MSVC and Borland.

// MSVC adds extra underscores to command line arguments
// visible to WinMain() so just re-map to Borland equivalents
// like this...

// #ifndef __BORLANDC__
// #define _argc __argc
// #define _argv __argv
// #endif

// See the start of WinMain() for more details...

// There is no copyright of any kind. It's just a demo.

// Original author: Kevin Kiley, 1998

View raw message