Click here to Skip to main content
Licence 
First Posted 6 Mar 2003
Views 62,099
Bookmarked 19 times

Extendable Webserver

By | 6 Mar 2003 | Article
An example of an extendible webserver using PJ Naughter's MFC library

Introduction

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 :

http://127.0.0.1:81/Virtual/

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 :

http://127.0.0.1:81/WebCam/param?w=0&h=0&q=10&s=1

or

http://127.0.0.1:81/Desktop/param?w=0&h=0&q=10&s=1

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

Parameters

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.

Credits

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.

License

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

ETA

Software Developer (Senior)

Netherlands Netherlands

Member

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

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalnot working when using 127.0.0.1 on WindowsXP sp2 PinmemberETA21:51 30 Nov '06  
AnswerRe: not working when using 127.0.0.1 on WindowsXP sp2 PinmemberGarageSoft21:05 2 Jun '08  
GeneralImplementation of HttpVirtualScriptDirectory.h Pinmemberroelvaessen20:37 25 May '05  
GeneralRe: Implementation of HttpVirtualScriptDirectory.h PinmemberETA22:27 25 May '05  
GeneralUsing router for web hosting. Pinmemberszms3:12 19 Jan '05  
GeneralHTTP Server on Win32 API Pinmembertom87@211:21 15 Aug '04  
QuestionHow to set default web directory? PinmemberJosef Havelka3:15 11 Aug '04  
AnswerRe: How to set default web directory? PinmemberETA4:26 11 Aug '04  
AnswerRe: How to set default web directory? PinmemberETA7:16 12 Aug '04  
GeneralIntel JPEG library Pinmemberpyhtang10:06 17 Mar '04  
GeneralRe: Intel JPEG library PinmemberETA5:00 17 Mar '04  
GeneralW3Mfc classes Pinmemberjacker13:55 27 May '03  
GeneralRe: W3Mfc classes Pinmemberjacker15:47 28 May '03  
GeneralBMP -> JPEG PinmemberBlake Coverett21:45 8 Mar '03  
GeneralRe: BMP -> JPEG PinmemberETA22:35 8 Mar '03  
GeneralRe: BMP -> JPEG PinmemberBlake Coverett0:08 10 Mar '03  
GeneralRe: BMP -> JPEG PinmemberETA6:03 10 Mar '03  
GeneralScreen shot PinmemberA. Riazi18:02 7 Mar '03  
GeneralRe: Screen shot PinmemberETA22:28 8 Mar '03  
GeneralRe: Screen shot PinmemberA. Riazi8:50 9 Mar '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web02 | 2.5.120517.1 | Last Updated 7 Mar 2003
Article Copyright 2003 by ETA
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid