Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
Bonsai Trees

Liquid Web Managed Dedicated Server: RAID 1 SSD with 16GB of RAM minimum! 24/7 On-Site Heroic Support! Industry-Leading SLA!

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Liquid Web Cloud VPS Hosting

8,978 questions

12,389 answers

573 users

How to Create Window 7 style button in C Win32 API

1 Answer

0 votes
#include <windows.h> 

#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
  MSG  msg ;    
  HWND hwnd;

  WNDCLASS wc = {0};
	
  wc.lpszClassName = TEXT("Window");
  wc.hInstance     = hInstance ;
  wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
  wc.lpfnWndProc   = WndProc;
  
  RegisterClass(&wc);
  hwnd = CreateWindow(wc.lpszClassName, L"Window Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 
					  100, 100, 350, 250, NULL, NULL, hInstance, NULL);  

  while(GetMessage(&msg, NULL, 0, 0)) 
  {
    DispatchMessage(&msg);
  }
  return (int) msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
  switch(msg)  
  {
		case WM_CREATE:
		{
			CreateWindow(L"button", L"Ok",  WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
						 100, 100, 90, 30, hwnd, (HMENU) 1, NULL, NULL);  

			break;    
		}
		case WM_COMMAND:
		{
			MessageBox(NULL, L"Hello World", L"MessageBox Title", 0);
			break;
		}
		case WM_DESTROY:
		{
			PostQuitMessage(0);
			return 0;
		}
  }
  return DefWindowProc(hwnd, msg, wParam, lParam);
}





answered Dec 18, 2014 by avibootz
...