Click here to Skip to main content
15,881,882 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to save IHTMLELEMENT of Tag IMG Pin
shichangone9-Jul-10 21:49
shichangone9-Jul-10 21:49 
GeneralRe: How to save IHTMLELEMENT of Tag IMG Pin
voo doo1212-Jul-10 15:49
voo doo1212-Jul-10 15:49 
QuestionHow can put here Vertical Scrollbar and Infotip or Tooltip for Items and Subitems? [modified] Pin
Le@rner9-Jul-10 20:20
Le@rner9-Jul-10 20:20 
QuestionCannot open the Dalog(DataBase error) [modified] Pin
raju_shiva9-Jul-10 18:33
raju_shiva9-Jul-10 18:33 
AnswerRe: Cannot open the Dalog(DataBase error) Pin
Richard MacCutchan10-Jul-10 0:39
mveRichard MacCutchan10-Jul-10 0:39 
Questionunreadable text on Grid Control Pin
Max++9-Jul-10 14:54
Max++9-Jul-10 14:54 
AnswerRe: unreadable text on Grid Control Pin
Garth J Lancaster9-Jul-10 19:22
professionalGarth J Lancaster9-Jul-10 19:22 
QuestionWin32 + Direct2D Pin
Fareed Rizkalla9-Jul-10 14:33
Fareed Rizkalla9-Jul-10 14:33 
I've never used GDI in any of my projects.
But had some programming introduction to it.
Since I've been using Windows 7, I'm trying to build a new project with Direct2D.

It compiles and runs, but it doesn't display anything!
Does anyone have any experience, what could be the reason?


#include <Windows.h>
#include <d2d1.h>

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain(HINSTANCE hCurrInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	WNDCLASS SetFileTime = {};
	SetFileTime.hInstance = hCurrInstance;
	SetFileTime.lpfnWndProc = WndProc;
	SetFileTime.lpszClassName = L"D2D";

	RegisterClass(&SetFileTime);

	CreateWindow(
		L"D2D",
		L"Direct2D",
		WS_OVERLAPPEDWINDOW|WS_VISIBLE,
		100, 100, 800, 600,
		NULL,
		NULL,
		hCurrInstance,
		NULL);

	MSG WindowMessages = { };
    while (GetMessage(&WindowMessages, NULL, 0, 0))
    {
        TranslateMessage(&WindowMessages);
        DispatchMessage(&WindowMessages);
    }
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg)
	{
		case WM_CREATE:
		{
			ID2D1Factory* pD2DFactory = NULL;
			D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, &pD2DFactory);

			RECT rc;
			GetClientRect(hwnd, &rc);

			ID2D1HwndRenderTarget* pRT = NULL;
			pD2DFactory->CreateHwndRenderTarget( D2D1::RenderTargetProperties(), 
				D2D1::HwndRenderTargetProperties(hwnd, D2D1::SizeU( rc.right - rc.left, rc.bottom - rc.top)),
				&pRT);



			ID2D1SolidColorBrush* m_pLightSlateGrayBrush = NULL;
			pRT->CreateSolidColorBrush( D2D1::ColorF(D2D1::ColorF::LightSlateGray), &m_pLightSlateGrayBrush);
			

			D2D_RECT_F OriginalRect;
			OriginalRect.left = 10.f;
			OriginalRect.top = 10.f;
			OriginalRect.bottom = 100.f;
			OriginalRect.right = 100.f;

			D2D1_ROUNDED_RECT RoundedRect;
			RoundedRect.rect = OriginalRect;
			RoundedRect.radiusX = 1.0f;
			RoundedRect.radiusY = 1.0f;

			ID2D1RoundedRectangleGeometry* Card = NULL;
			pD2DFactory->CreateRoundedRectangleGeometry(RoundedRect, &Card);

			pRT->BeginDraw();
			pRT->FillRoundedRectangle(&RoundedRect, m_pLightSlateGrayBrush);
			pRT->DrawRoundedRectangle(&RoundedRect, m_pLightSlateGrayBrush);
			pRT->EndDraw();

			return 0;
		}
		case WM_CLOSE:
		{
			DestroyWindow(hwnd);
			return 0;
		}
		case WM_DESTROY:
		{
			PostQuitMessage(0);
			return 0;
		}
		default:
			return DefWindowProc(hwnd, msg, wParam, lParam);
	}
}

AnswerRe: Win32 + Direct2D Pin
Cedric Moonen9-Jul-10 22:02
Cedric Moonen9-Jul-10 22:02 
QuestionError in building QuickFix library in Exceptions.h Pin
arupsarkar9-Jul-10 8:54
arupsarkar9-Jul-10 8:54 
AnswerRe: Error in building QuickFix library in Exceptions.h Pin
David Crow9-Jul-10 9:04
David Crow9-Jul-10 9:04 
AnswerRe: Error in building QuickFix library in Exceptions.h Pin
Aescleal9-Jul-10 10:13
Aescleal9-Jul-10 10:13 
GeneralRe: Error in building QuickFix library in Exceptions.h Pin
arupsarkar16-Jul-10 6:46
arupsarkar16-Jul-10 6:46 
Questionerror C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
deadlyabbas9-Jul-10 5:23
deadlyabbas9-Jul-10 5:23 
QuestionRe: error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
David Crow9-Jul-10 5:50
David Crow9-Jul-10 5:50 
AnswerRe: error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
Stuart Dootson11-Jul-10 0:46
professionalStuart Dootson11-Jul-10 0:46 
QuestionMFC crash occurs on DLL during language translation in string table entries Pin
Thirumalesh.U8-Jul-10 23:40
Thirumalesh.U8-Jul-10 23:40 
QuestionRun-time Error while word 2010 Automation, "A null reference pointer was passed to the stub." [modified] Pin
m_code8-Jul-10 23:04
m_code8-Jul-10 23:04 
AnswerRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 1:42
Niklas L9-Jul-10 1:42 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 2:07
m_code9-Jul-10 2:07 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 2:24
Niklas L9-Jul-10 2:24 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 2:48
m_code9-Jul-10 2:48 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 3:14
Niklas L9-Jul-10 3:14 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 5:20
m_code9-Jul-10 5:20 
QuestionFile Mapping Pin
john56328-Jul-10 22:31
john56328-Jul-10 22:31 

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.