Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 23rd, 2003, 01:30 AM
Registered User
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Server Extension using C++

I am trying to write a server extension DLL to download or graph data. Can anyone help with the following 2 questions, please?

1. In the server context, how can I draw a picture? I should say that I currently have this working in an MFC-derived program, where I've obviously used the CDC class in a view. I can't find any hints anywhere in MS about this. Do I create a bitmap? If so, how do I convert this into a gif file for downloading, and how do I get access to draw on it?

2. I currently create a csv file for downloading the data and then send a redirection message down to the client to point to the file. Is there a way of doing this more efficiently, forcing the client to ask whether to save or open the file. If I need to send more than 1 file, how could I do that?

Many, many thanks to anyone who can help.
Margaret

Reply With Quote
  #2 (permalink)  
Old October 31st, 2003, 07:52 PM
Authorized User
 
Join Date: Jul 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to merediths
Default

Hello Margret,

  1.) As far as graphing data goes there are a number of ways you can accomplish this, depending on how complex your dataset is / how fancy you want to get. The first way is to create a bitmap on the server ... i.e. grab a Device Context and draw on it was GDI functions as you would in a normal windows program. Unfortunately, the win32 API doesn't have built in .gif / .jpeg support, so you will need to either write your own encoded or find a ready-made component / object you can plug into your app to achieve this. You may already have something on your system you can use ... review the SDK documention for ImageCodecInfo objects and the GetImageEncoders function.
   alternatively, I find it quick and efficient to simulate simple graphs using html tables...i.e. by setting the background colors of cells to create bars of varios colors and lengths.

2.) You should be able to foce the user to open/save the file by playing with the content-type header ( i.e. set it to application/octet stream or something of that nature) and pointint the user at it with an htttp-redirect, *however* that will only work for one file...if you want multiple files, perhaps providing links to all of them on a results page would work, or you could zip them on the server and push the zip to the client.

Regards
Meredith Shaebanyan

Reply With Quote
  #3 (permalink)  
Old December 17th, 2003, 06:16 AM
Registered User
 
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Meredith - I've been on something else, but am back to trying this now....

Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
xml extension Maxxim BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 October 27th, 2007 04:23 AM
Front Page server extension error NWilson Assembly Language 1 January 17th, 2006 01:55 PM
How to use html extend Frontpage Server Extension? keenx C# 0 May 31st, 2004 02:09 AM
What file extension should I use? pigtail Javascript 3 April 12th, 2004 02:58 PM
Extension Server in C++ / MFC Margaret Wright Visual C++ 0 October 23rd, 2003 01:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.