Click here to Skip to main content
15,902,635 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Error in updating files Pin
Nibu babu thomas2-Apr-08 20:01
Nibu babu thomas2-Apr-08 20:01 
GeneralApplication is working in Windows Xp but it is crashing in Windows 2003 Pin
RamaraoPV2-Apr-08 18:23
RamaraoPV2-Apr-08 18:23 
GeneralRe: Application is working in Windows Xp but it is crashing in Windows 2003 Pin
Stephen Hewitt2-Apr-08 18:45
Stephen Hewitt2-Apr-08 18:45 
GeneralRe: Application is working in Windows Xp but it is crashing in Windows 2003 Pin
Hamid_RT7-Apr-08 4:24
Hamid_RT7-Apr-08 4:24 
QuestionFinding coordinates inside a window that has been scrolled Pin
Nathan Going2-Apr-08 16:41
Nathan Going2-Apr-08 16:41 
GeneralRe: Finding coordinates inside a window that has been scrolled Pin
Nibu babu thomas2-Apr-08 17:24
Nibu babu thomas2-Apr-08 17:24 
GeneralRe: Finding coordinates inside a window that has been scrolled Pin
Iain Clarke, Warrior Programmer3-Apr-08 3:42
Iain Clarke, Warrior Programmer3-Apr-08 3:42 
GeneralOLE From Print To Bitmap To PDF Pin
Kyudos2-Apr-08 14:02
Kyudos2-Apr-08 14:02 
I don't know much about GDI stuff so I have a question that is probably quite striaghforward for someone...

I've added OLE to my application's document. I want to be able to epxort the OLE items as bitmaps to PDF. I've managed to add a function that will print my OLE items, by drawing them to the printer DC, thus:

void PrintOLEItems()
{
	// See if we can print OLE items
	CDC dcWorld;
	HDC hDC;
	short iError;

	// Get the associated hDC
	hDC = (HDC)GetDC(&iError);

	// Attach to create a compatible CDC in memory
	dcWorld.Attach(hDC);

	// Set the map modes to match
	dcWorld.SetMapMode(::GetMapMode(hDC));

	CIrricadDoc* pDoc = m_pView->GetDocument();

	if (pDoc!= NULL)
	{
		// Draw the OLE items from the list, if the appropriate layer is visible
		POSITION pos = pDoc->GetStartPosition();
		while (pos != NULL)
		{
			// Getthe item
			CContainerItem* pItem = (CContainerItem*)pDoc->GetNextItem(pos);

			// Get the handle of the associated rect
			LONG lHandle = pItem->GetRectHandle();
			
			// Get the layer on which the rect resides
			short nLayer = GetLayer(lHandle);

			// If the layer is present and visible...
			if (nLayer != -1)
			{
				Array<Layer>* pLayers = pDoc->GetLayers();
				if ((*pLayers)[nLayer].IsVisible())
				{
					Polyline Rect;
					GetEntityPoints(lHandle, VCRect);
					Rectangle newrect;
					newrect.Construct(Rect[0], Rect[2]);

					// Convert world coordinates to device coordinates
					CRect newsize = WorldRectToDeviceRect(&dcWorld, newrect, TRUE);

					// Draw the item in the printer DC
					pItem->Draw(&dcWorld, &newsize, DVASPECT_CONTENT);
				}
			}
		}
	}

	// Detach hDC
	dcWorld.Detach();
}


Now, my PDF export object has a 'WriteImage' function to which I need to pass BYTE* Data. The pixel data must be arranged as an array of pixels with each pixel specified by three bytes, with a byte for red, a byte for green and a byte for blue. The pixels are arranged in rows starting from the top of the bitmap.

So I think, if I create a compatible dc, draw my OLE items to that dc I can extract the relvant data from the CBitmap object of the dc. The problem is, I have no idea how to do that...

Can anyone help?

Thanks
GeneralRasDial... Pin
martin_hughes2-Apr-08 9:49
martin_hughes2-Apr-08 9:49 
GeneralRe: RasDial... Pin
led mike2-Apr-08 10:01
led mike2-Apr-08 10:01 
GeneralRe: RasDial... Pin
martin_hughes2-Apr-08 10:07
martin_hughes2-Apr-08 10:07 
GeneralRe: RasDial... Pin
led mike2-Apr-08 10:43
led mike2-Apr-08 10:43 
GeneralRe: RasDial... Pin
bob169722-Apr-08 16:31
bob169722-Apr-08 16:31 
GeneralRe: RasDial... Pin
led mike3-Apr-08 6:16
led mike3-Apr-08 6:16 
QuestionProblem with VS2005 solution with one dll and one exe Pin
Tom Thorp2-Apr-08 9:19
Tom Thorp2-Apr-08 9:19 
GeneralRe: Problem with VS2005 solution with one dll and one exe Pin
pabloraul2-Apr-08 9:22
pabloraul2-Apr-08 9:22 
AnswerRe: Problem with VS2005 solution with one dll and one exe Pin
Paresh Chitte2-Apr-08 18:19
Paresh Chitte2-Apr-08 18:19 
QuestionCall DialogB from DialogA Pin
pabloraul2-Apr-08 8:58
pabloraul2-Apr-08 8:58 
GeneralRe: Call DialogB from DialogA Pin
led mike2-Apr-08 9:13
led mike2-Apr-08 9:13 
GeneralRe: Call DialogB from DialogA Pin
pabloraul2-Apr-08 9:19
pabloraul2-Apr-08 9:19 
GeneralRe: Call DialogB from DialogA Pin
led mike2-Apr-08 9:25
led mike2-Apr-08 9:25 
QuestionRe: Call DialogB from DialogA Pin
CPallini2-Apr-08 9:42
mveCPallini2-Apr-08 9:42 
GeneralRe: Call DialogB from DialogA [modified] Pin
pabloraul2-Apr-08 9:46
pabloraul2-Apr-08 9:46 
GeneralRe: Call DialogB from DialogA Pin
David Crow2-Apr-08 10:05
David Crow2-Apr-08 10:05 
GeneralRe: Call DialogB from DialogA Pin
pabloraul2-Apr-08 10:11
pabloraul2-Apr-08 10:11 

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.