Jump to content

Who Here Knows C++ And Winapi And Dx


Recommended Posts

Well... Since i moved to native C++ it's just been a fun ride making apps...

Figured ide ask here if anyone know's any good DX books?

I made a form... Extended the glass .. now i want to add a DX component..

Straight from the Main.cpp

#include <windows.h>
#include <dwmapi.h>
#pragma comment(lib,"dwmapi")


bool Running = true;

LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
switch (Msg) {
	case WM_DESTROY:
		//End();
		//Running = false;
		PostQuitMessage(0);
		break;

}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
WNDCLASSEX wc;
MSG Msg;
HWND hWnd;
wc.cbSize =	sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0; 
wc.cbWndExtra = 0; 
wc.hInstance = hInstance;
wc.hIcon = 0; 
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(RGB(0,0,0)); 
wc.lpszMenuName = NULL;
wc.lpszClassName = "CTmain";
wc.hIconSm = 0;

RegisterClassEx(&wc);
hWnd = CreateWindow("CTmain", "DX Test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 720, 400,
	NULL, NULL, hInstance, NULL);
if (!hWnd) {
	return 0;
}

ShowWindow(hWnd, nShowCmd);
UpdateWindow(hWnd);
MARGINS mar = {0};
 mar.cyBottomHeight = -1;
 DwmExtendFrameIntoClientArea ( hWnd, &mar );
ZeroMemory(&Msg, sizeof(Msg));
while (Running == true) {
	if (PeekMessage(&Msg, hWnd, 0, 0, PM_REMOVE)) {
		TranslateMessage(&Msg);
		DispatchMessage(&Msg);
	} else {

	}
}
return 0;
}

Just messing around.. Any thaughts?

razor5070.png
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Who's Online   1 Member, 0 Anonymous, 1062 Guests (See full list)

×
×
  • Create New...