Subject: Server Extension using C++
Posted By: Margaret Wright Post Date: 10/23/2003 1:30:10 AM
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 By: merediths Reply Date: 10/31/2003 6:52:18 PM
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 By: Margaret Wright Reply Date: 12/17/2003 5:16:41 AM
Thanks Meredith - I've been on something else, but am back to trying this now....


Go to topic 7644

Return to index page 984
Return to index page 983
Return to index page 982
Return to index page 981
Return to index page 980
Return to index page 979
Return to index page 978
Return to index page 977
Return to index page 976
Return to index page 975