Click here to Skip to main content
15,913,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Multilingual Support: Use "String Tables" instead of creating a new set of Dialogs for each supported language Pin
John R. Shaw23-Feb-07 16:31
John R. Shaw23-Feb-07 16:31 
AnswerRe: Multilingual Support: Use "String Tables" instead of creating a new set of Dialogs for each supported language Pin
Rajesh R Subramanian23-Feb-07 18:33
professionalRajesh R Subramanian23-Feb-07 18:33 
AnswerRe: Multilingual Support: Use "String Tables" instead of creating a new set of Dialogs for each supported language Pin
Hamid_RT23-Feb-07 18:54
Hamid_RT23-Feb-07 18:54 
QuestionNot drawing full dialog Pin
aquawicket23-Feb-07 14:14
aquawicket23-Feb-07 14:14 
AnswerRe: Not drawing full dialog Pin
David Crow23-Feb-07 14:59
David Crow23-Feb-07 14:59 
GeneralRe: Not drawing full dialog Pin
aquawicket23-Feb-07 15:30
aquawicket23-Feb-07 15:30 
GeneralRe: Not drawing full dialog Pin
Rajesh R Subramanian23-Feb-07 18:43
professionalRajesh R Subramanian23-Feb-07 18:43 
QuestionVisual styles without MFC Pin
Lamgi-Mari23-Feb-07 12:01
Lamgi-Mari23-Feb-07 12:01 
Hello!

I'm currently teaching myself writing Windows32 applications with C/C++ without MFC.

Currently I'm trying to apply XP visual styles for controls. I tried to learn from the MS Platform SDK documentation how it is done, but unfortunaltely it left me Confused | :confused: and quite clueless. Please give me some hints!

Let's assume I have a simple Windows application with one window containing a simple button (a real parent window, not a dialogue - hope I'm using the right terminology here):
#include <windows.h><br />
#include "commctrl.h"<br />
<br />
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM) ;<br />
<br />
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {<br />
	MSG msg;<br />
	WNDCLASS wndclass;<br />
<br />
	wndclass.style = CS_HREDRAW | CS_VREDRAW ;<br />
	wndclass.lpfnWndProc   = WndProc ;<br />
	wndclass.cbClsExtra    = 0 ;<br />
	wndclass.cbWndExtra    = 0 ;<br />
	wndclass.hInstance     = hInstance ;<br />
	wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;<br />
	wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;<br />
	wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;<br />
	wndclass.lpszMenuName  = NULL ;<br />
	wndclass.lpszClassName = TEXT("App");<br />
     <br />
	if(!RegisterClass(&wndclass)) {<br />
		MessageBox (NULL, TEXT("This program requires Windows NT!"), TEXT("App"), MB_ICONERROR);<br />
		return 0;<br />
	}<br />
     <br />
	HWND hwnd = CreateWindow(TEXT("App"), TEXT("Just an application"), <br />
		WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, <br />
		NULL, NULL, hInstance, NULL);<br />
	ShowWindow(hwnd, iCmdShow);<br />
	UpdateWindow(hwnd) ;<br />
<br />
	while(GetMessage(&msg, NULL, 0, 0)) {<br />
		TranslateMessage(&msg);<br />
		DispatchMessage(&msg);<br />
	}<br />
	return msg.wParam ;<br />
}<br />
<br />
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
     static HWND  hwndButton;<br />
     HDC          hdc ;<br />
     PAINTSTRUCT  ps ;<br />
     <br />
     switch (message)<br />
     {<br />
     case WM_CREATE :<br />
          hwndButton = CreateWindow ( TEXT("button"), <br />
                                   TEXT("Just a button"),<br />
                                   WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,<br />
                                   20, 20,<br />
                                   130, 50,<br />
                                   hwnd, (HMENU) 0,<br />
                                   ((LPCREATESTRUCT) lParam)->hInstance, NULL) ;<br />
          return 0 ;<br />
<br />
     case WM_PAINT :          <br />
          hdc = BeginPaint (hwnd, &ps) ;<br />
<br />
          EndPaint (hwnd, &ps) ;<br />
          return 0 ;<br />
          <br />
     case WM_DESTROY :<br />
          PostQuitMessage (0) ;<br />
          return 0 ;<br />
     }<br />
     return DefWindowProc (hwnd, message, wParam, lParam) ;<br />
}

I have added a manifest to the project ressources as told.
All I want now is to enable this button to use visual styles. Please show me how!

Greetings,
Lamgi-Mari
AnswerRe: Visual styles without MFC Pin
John R. Shaw23-Feb-07 16:51
John R. Shaw23-Feb-07 16:51 
QuestionTired of copy/pasting code....... Pin
pblais23-Feb-07 10:40
pblais23-Feb-07 10:40 
AnswerRe: Tired of copy/pasting code....... [modified] Pin
Mark Salsbery23-Feb-07 12:23
Mark Salsbery23-Feb-07 12:23 
AnswerRe: Tired of copy/pasting code....... Pin
PJ Arends23-Feb-07 12:33
professionalPJ Arends23-Feb-07 12:33 
AnswerRe: Tired of copy/pasting code....... Pin
S Douglas24-Feb-07 23:28
professionalS Douglas24-Feb-07 23:28 
QuestionActiveX returning custom types from methods?? Pin
jhinze23-Feb-07 10:13
jhinze23-Feb-07 10:13 
QuestionReferences vs. Pointers Pin
Yonggoo23-Feb-07 9:15
Yonggoo23-Feb-07 9:15 
AnswerRe: References vs. Pointers Pin
Joe Woodbury23-Feb-07 9:32
professionalJoe Woodbury23-Feb-07 9:32 
GeneralRe: References vs. Pointers Pin
Yonggoo23-Feb-07 9:46
Yonggoo23-Feb-07 9:46 
GeneralRe: References vs. Pointers Pin
David Crow23-Feb-07 10:28
David Crow23-Feb-07 10:28 
GeneralRe: References vs. Pointers Pin
Joe Woodbury23-Feb-07 10:34
professionalJoe Woodbury23-Feb-07 10:34 
GeneralRe: References vs. Pointers Pin
Jörgen Sigvardsson23-Feb-07 11:35
Jörgen Sigvardsson23-Feb-07 11:35 
GeneralRe: References vs. Pointers Pin
PJ Arends23-Feb-07 12:54
professionalPJ Arends23-Feb-07 12:54 
GeneralRe: References vs. Pointers Pin
Jörgen Sigvardsson23-Feb-07 13:42
Jörgen Sigvardsson23-Feb-07 13:42 
AnswerRe: References vs. Pointers Pin
Mark Salsbery23-Feb-07 10:44
Mark Salsbery23-Feb-07 10:44 
QuestionStrange errors related to getline()... Pin
CoffeeAddict1923-Feb-07 9:12
CoffeeAddict1923-Feb-07 9:12 
AnswerRe: Strange errors related to getline()... Pin
Newbie0023-Feb-07 9:51
Newbie0023-Feb-07 9:51 

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.