Click here to Skip to main content
13,453,569 members (45,293 online)
Click here to Skip to main content
Add your own
alternative version


21 bookmarked
Posted 6 Mar 2003

Extendable Webserver

, 6 Mar 2003
Rate this:
Please Sign up or sign in to vote.
An example of an extendible webserver using PJ Naughter's MFC library


This is a sample build on the W3Mfc Webserver classes from PJ Naughter. I made a DLL of the W3Mfc code, but I can't include the sources of it, for PJ has stated not to distribute the modified sources, else many different branches will circulate on the net. (Like FlaskMPEG ). So I just added the .h, .dll and the .lib so you can use it.

This is a sample app which will generate a HTML text file and a counter when called :

On the Dialog there is a button to reset the counter. Nothing spectacular, but as a sample of how to implement your own functionality. Another request for our server is called when you call :


The first gives a pictures from your webcam and converts it to a jpeg, The second gives a JPG of the desktop.


w and h stand for width and height respectively. When w=0 & h=0 the bitmap will not be resized, when you give another size, the bitmap will be converted using StretchBlt. Only size multiple of16 are allowed, so for example when you enter something like w=129 you get a JPG with width of 128 .The intel JPG routine has trouble using other sizes than multiple of 16. Another problem of the intel lib is that it can only handle 24 bit bitmaps, So a couple of bmp to DIB routines have also been included.

q=? stands for the quality of the returned jpeg

If s=0, nothing happens. If s=1 then the image is drawn above the jpg (actually in the jpg), 16 extra lines are added when this feature is requested.


A lot of this code is download from the CodeProject and I did my thing with it. I don't have an exact list of who gave me what code, but here is a short list:

  • PJ Naughter: for his W3Mfc classes Version 1.56
  • John W. Ratcliff : for his Jpeg routines, to call the intel Library. I added the scaling and color conversion to a 24 DIB myself
  • DIBAPI : from ancient code from Microsoft
  • Even a little code from Laurent Kempé

I spent a lot of time on the BMP to JPEG routines, for I could nowhere find some decent working code, hopefully this solves the problem of some more people trying to send JPG over the internet.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Software Developer (Senior)
Netherlands Netherlands
I'm a 31 year old full-time programmer ('76).
(Currently: Lead Software System Designer)

You may also be interested in...

Comments and Discussions

Generalnot working when using on WindowsXP sp2 Pin
ETA30-Nov-06 21:51
memberETA30-Nov-06 21:51 
AnswerRe: not working when using on WindowsXP sp2 Pin
GarageSoft2-Jun-08 21:05
memberGarageSoft2-Jun-08 21:05 
GeneralImplementation of HttpVirtualScriptDirectory.h Pin
roelvaessen25-May-05 20:37
memberroelvaessen25-May-05 20:37 
GeneralRe: Implementation of HttpVirtualScriptDirectory.h Pin
ETA25-May-05 22:27
memberETA25-May-05 22:27 
GeneralUsing router for web hosting. Pin
szms19-Jan-05 3:12
memberszms19-Jan-05 3:12 
GeneralHTTP Server on Win32 API Pin
tom87@2115-Aug-04 1:21
membertom87@2115-Aug-04 1:21 
QuestionHow to set default web directory? Pin
Josef Havelka11-Aug-04 3:15
memberJosef Havelka11-Aug-04 3:15 

1. I would like to know, how should I set (or map) for instance c:\data\website as a default directory for HTML filtes for the "Extensible Webserver". So when I write http://localhost the default.htm from c:\mywww\website will be displayed (I do not wish to give an alias to it).

2. Is it possible to obtain detailed documentation for W3Mfc from somehow ???

Thank you for answers.

AnswerRe: How to set default web directory? Pin
ETA11-Aug-04 4:26
memberETA11-Aug-04 4:26 
AnswerRe: How to set default web directory? Pin
ETA12-Aug-04 7:16
memberETA12-Aug-04 7:16 
GeneralIntel JPEG library Pin
pyhtang117-Mar-04 0:06
memberpyhtang117-Mar-04 0:06 
GeneralRe: Intel JPEG library Pin
ETA17-Mar-04 5:00
memberETA17-Mar-04 5:00 
GeneralW3Mfc classes Pin
jacker27-May-03 13:55
memberjacker27-May-03 13:55 
GeneralRe: W3Mfc classes Pin
jacker28-May-03 15:47
memberjacker28-May-03 15:47 
GeneralBMP -> JPEG Pin
Blake Coverett8-Mar-03 21:45
memberBlake Coverett8-Mar-03 21:45 
GeneralRe: BMP -> JPEG Pin
ETA8-Mar-03 22:35
memberETA8-Mar-03 22:35 
GeneralRe: BMP -> JPEG Pin
Blake Coverett10-Mar-03 0:08
memberBlake Coverett10-Mar-03 0:08 
GeneralRe: BMP -> JPEG Pin
ETA10-Mar-03 6:03
memberETA10-Mar-03 6:03 
GeneralScreen shot Pin
A. Riazi7-Mar-03 18:02
memberA. Riazi7-Mar-03 18:02 
GeneralRe: Screen shot Pin
ETA8-Mar-03 22:28
memberETA8-Mar-03 22:28 
GeneralRe: Screen shot Pin
A. Riazi9-Mar-03 8:50
memberA. Riazi9-Mar-03 8:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03-2016 | 2.8.180318.3 | Last Updated 7 Mar 2003
Article Copyright 2003 by ETA
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid