Click here to Skip to main content
15,891,375 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SDI Applicaion Pin
User 2155972-Nov-04 18:34
User 2155972-Nov-04 18:34 
GeneralCListCtrl item selection problem Pin
Neelesh K J Jain2-Nov-04 16:31
Neelesh K J Jain2-Nov-04 16:31 
Generalclose applications Pin
tiem2-Nov-04 15:47
tiem2-Nov-04 15:47 
GeneralRe: close applications Pin
Sujan Christo2-Nov-04 17:20
Sujan Christo2-Nov-04 17:20 
Question#pragma once? Pin
Link26002-Nov-04 15:03
Link26002-Nov-04 15:03 
AnswerRe: #pragma once? Pin
Maximilien2-Nov-04 15:39
Maximilien2-Nov-04 15:39 
AnswerRe: #pragma once? Pin
Henry miller3-Nov-04 2:51
Henry miller3-Nov-04 2:51 
GeneralHelp CxImage Drawing Problems! Pin
Zero_divide_12-Nov-04 15:02
Zero_divide_12-Nov-04 15:02 
Hello all!

I've racked my brains on this problem, and have now turned to those who know more than I for some solutions. I am creating an ISAPI Extension to generate GIF images and save them in my /images folder so that my site has immediate access to them. The reason I am using an ISAPI Extension is so that I can administer my website 100% via the web, but the site is heavily graphics dependent. I turned to the CxImage library for its support for saving GIF images, but I am having problems drawing. In a test program that I am using to test CxImage's functionality in this project, I am having some problems drawing. Here is a code sample:
<br />
void CImageGeneratorDlg::OnButton1() <br />
{<br />
	// TODO: Add your control notification handler code here<br />
	<br />
	CxIOFile ioFile;<br />
	CString fileName;<br />
	m_cEdit.GetWindowText(fileName);<br />
<br />
	ioFile.Open(fileName, "wb");<br />
<br />
	CxImage* generatedImg = GenerateImage();<br />
	CxImage* images[] = { generatedImg };<br />
<br />
	//generatedImg->IncreaseBpp(24);<br />
<br />
	generatedImg->DecreaseBpp(8,0,0);<br />
<br />
	long idx = generatedImg->GetPixelIndex(0,0);<br />
	generatedImg->SetTransIndex(idx);<br />
	generatedImg->SetPaletteColor(idx+1, RGB(255,0,255));<br />
	<br />
	CxImageGIF imageGIF;<br />
	imageGIF.SetComment(_T("test"));<br />
	<br />
	imageGIF.Encode(&ioFile, images, 1);<br />
<br />
	ioFile.Close();<br />
}<br />
<br />
CxImage* CImageGeneratorDlg::GenerateImage()<br />
{<br />
	CxImage* img = new CxImage(50,100,24);<br />
<br />
	if(!img) {<br />
		TRACE("==>Could not create image");<br />
		return NULL;<br />
	}<br />
<br />
	img->Clear();<br />
<br />
	<br />
<br />
	CDC screenDC;<br />
	if(!screenDC.CreateDC("DISPLAY", NULL, NULL, NULL)) {<br />
		MessageBox("Error");<br />
		return NULL;<br />
	}<br />
	<br />
	CDC memDC;<br />
	memDC.CreateCompatibleDC(&screenDC);<br />
<br />
	CBitmap bmpBitmap;<br />
	bmpBitmap.CreateCompatibleBitmap(&memDC, 50,100);<br />
	CBitmap *pOldBitmap = memDC.SelectObject(&bmpBitmap);<br />
<br />
	CBrush blackBrush(RGB(0,0,0)),<br />
		colorBrush(RGB(255,0,255));<br />
	CBrush* pOldBrush = memDC.SelectObject(&blackBrush);<br />
<br />
	memDC.Rectangle(0,0,50,100);<br />
<br />
	memDC.SelectObject(&colorBrush);<br />
<br />
	memDC.SetTextColor(RGB(255,0,255));<br />
	//memDC.SetBkColor(RGB(255,255,255));<br />
	memDC.SetBkMode(TRANSPARENT);<br />
<br />
	memDC.DrawText("WTF", CRect(0,0,50,100), DT_SINGLELINE | DT_NOCLIP | DT_LEFT);<br />
<br />
	memDC.SelectObject(pOldBitmap);<br />
	memDC.SelectObject(pOldBrush);<br />
	memDC.DeleteDC();<br />
<br />
<br />
	img->CreateFromHBITMAP(bmpBitmap);<br />
<br />
	return img;<br />
}<br />


The problem I'm having is that the text "WTF" doesn't show up in magenta like it says unless I add the line "generatedImg->SetPaletteColor(idx+1, RGB(255,0,255));". If I take that out, the GIF doesn't show up right.

The bigger problem with this is that I need to have my ISAPI Extension generate the GIF by assembling a bunch of BMP files together (bitmapped fonts) to generate an "image string", then encode it, save it, and provide a link back to the browser window. First, how would I create a CBitmap on an ISAPI Extension running on IIS for Windows 2003 so I can create the "image string". From there, how would I use CxImage to properly convert the image to GIF? Any ideas/suggestions?
GeneralDifference between OnOk() and EndDialog Pin
Don122-Nov-04 13:12
Don122-Nov-04 13:12 
GeneralRe: Difference between OnOk() and EndDialog Pin
Christian Graus2-Nov-04 13:28
protectorChristian Graus2-Nov-04 13:28 
GeneralRe: Difference between OnOk() and EndDialog Pin
Yulianto.2-Nov-04 13:39
Yulianto.2-Nov-04 13:39 
GeneralRe: Difference between OnOk() and EndDialog Pin
Jack Puppy2-Nov-04 13:44
Jack Puppy2-Nov-04 13:44 
QuestionResolution independent programming? Pin
bitpusher2-Nov-04 13:08
bitpusher2-Nov-04 13:08 
AnswerRe: Resolution independent programming? Pin
Sujan Christo2-Nov-04 19:45
Sujan Christo2-Nov-04 19:45 
GeneralInstallation package Pin
lillah2-Nov-04 12:47
lillah2-Nov-04 12:47 
GeneralRe: Installation package Pin
Brad Bruce2-Nov-04 13:16
Brad Bruce2-Nov-04 13:16 
GeneralRe: Installation package Pin
lillah2-Nov-04 13:44
lillah2-Nov-04 13:44 
GeneralRe: Installation package Pin
Brad Bruce2-Nov-04 15:40
Brad Bruce2-Nov-04 15:40 
GeneralRe: Installation package Pin
ThatsAlok3-Nov-04 23:37
ThatsAlok3-Nov-04 23:37 
Generalgetting the divider handle in a SplitterWnd Pin
b@andreasen8.org2-Nov-04 11:53
b@andreasen8.org2-Nov-04 11:53 
Generalsome help for how shutdown computer remotely Pin
faroqtam2-Nov-04 11:25
faroqtam2-Nov-04 11:25 
GeneralRe: some help for how shutdown computer remotely Pin
Graham Bradshaw2-Nov-04 11:50
Graham Bradshaw2-Nov-04 11:50 
GeneralRe: some help for how shutdown computer remotely Pin
Christian Graus2-Nov-04 11:50
protectorChristian Graus2-Nov-04 11:50 
Generallogging off windows 2000 in VC++ Pin
jet91532-Nov-04 9:49
jet91532-Nov-04 9:49 
GeneralRe: logging off windows 2000 in VC++ Pin
David Crow2-Nov-04 10:39
David Crow2-Nov-04 10:39 

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.