Click here to Skip to main content
15,885,622 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: how to check that database was corrupted or not??? Pin
David Crow8-Jun-11 3:04
David Crow8-Jun-11 3:04 
AnswerRe: how to check that database was corrupted or not??? Pin
jschell8-Jun-11 9:02
jschell8-Jun-11 9:02 
QuestionSetting RTL for a window? Pin
Hans Dietrich7-Jun-11 16:27
mentorHans Dietrich7-Jun-11 16:27 
AnswerRe: Setting RTL for a window? Pin
Code-o-mat7-Jun-11 21:53
Code-o-mat7-Jun-11 21:53 
AnswerRe: Setting RTL for a window? Pin
Hans Dietrich8-Jun-11 4:00
mentorHans Dietrich8-Jun-11 4:00 
GeneralRe: Setting RTL for a window? Pin
Code-o-mat8-Jun-11 6:08
Code-o-mat8-Jun-11 6:08 
GeneralRe: Setting RTL for a window? Pin
Code-o-mat9-Jun-11 6:56
Code-o-mat9-Jun-11 6:56 
QuestionWin32 Buttons, which is which? [solved] Pin
Groulien7-Jun-11 8:56
Groulien7-Jun-11 8:56 
Hello everyone,

I've been experimenting with C++ and how to build a form with it (without MFC).
I've created two buttons at runtime with the following code:
(I used a bit of copying and pasting)
if (button1 == NULL)
{
	button1 = ::CreateWindowEx(WS_EX_LEFT,L"button",L"Button1", WS_CHILD ,50,50,50,50,parent,NULL,::GetModuleHandle(NULL),NULL);
	SendMessage(button1, WM_SETFONT, (WPARAM)defFont, MAKELPARAM(TRUE, 0));
	::ShowWindow(button1,SW_SHOW);
}
if (button2 == NULL)
{
	button2 = ::CreateWindowEx(WS_EX_LEFT,L"button",L"Button2", WS_CHILD ,125,50,50,50,parent,NULL,::GetModuleHandle(NULL),NULL);
	SendMessage(button2, WM_SETFONT, (WPARAM)defFont, MAKELPARAM(TRUE, 0));
	::ShowWindow(button2,SW_SHOW);

}

There's no problem with building the buttons, this is my WndProc:
C++
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
		case SW_SHOW:
			break;
		case WM_COMMAND:
			if (wParam == BN_CLICKED)
			{
				Triggered(L"1"); //Shows a messagebox.
			}
			break;
		case WM_SHOWWINDOW:
			Init(hwnd); //Builds the buttons here.
			break;
		case WM_CLOSE:
			DestroyWindow(hwnd);
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hwnd, msg, wParam, lParam);
	}
	return 0;

}

How can I tell which one sent the message?
--

Nevermind, got it.
lParam equals with the (LPARAM)handle of the button that sent it.
modified on Tuesday, June 7, 2011 3:05 PM

AnswerRe: Win32 Buttons, which is which? [solved] Pin
Albert Holguin7-Jun-11 14:34
professionalAlbert Holguin7-Jun-11 14:34 
AnswerRe: Win32 Buttons, which is which? [solved] Pin
Tarmo Kalda9-Jun-11 0:03
Tarmo Kalda9-Jun-11 0:03 
QuestionHelp with reading Window titles and text in C sharp Pin
turbosupramk37-Jun-11 4:56
turbosupramk37-Jun-11 4:56 
AnswerRe: Help with reading Window titles and text in C sharp Pin
Albert Holguin7-Jun-11 5:36
professionalAlbert Holguin7-Jun-11 5:36 
GeneralRe: Help with reading Window titles and text in C sharp Pin
turbosupramk37-Jun-11 6:13
turbosupramk37-Jun-11 6:13 
GeneralRe: Help with reading Window titles and text in C sharp Pin
Albert Holguin7-Jun-11 6:23
professionalAlbert Holguin7-Jun-11 6:23 
QuestionLoadInstanceString failed in Windows7 Operating System. Pin
janaswamy uday7-Jun-11 0:10
janaswamy uday7-Jun-11 0:10 
AnswerRe: LoadInstanceString failed in Windows7 Operating System. Pin
Richard MacCutchan7-Jun-11 0:21
mveRichard MacCutchan7-Jun-11 0:21 
GeneralRe: LoadString failed in Windows7 Operating System. [modified] Pin
janaswamy uday7-Jun-11 0:42
janaswamy uday7-Jun-11 0:42 
GeneralRe: LoadString failed in Windows7 Operating System. Pin
giangian7-Jun-11 0:50
giangian7-Jun-11 0:50 
GeneralRe: LoadString failed in Windows7 Operating System. Pin
janaswamy uday7-Jun-11 0:57
janaswamy uday7-Jun-11 0:57 
QuestionRe: LoadString failed in Windows7 Operating System. Pin
David Crow7-Jun-11 2:52
David Crow7-Jun-11 2:52 
GeneralRe: LoadString failed in Windows7 Operating System. Pin
Richard MacCutchan7-Jun-11 0:57
mveRichard MacCutchan7-Jun-11 0:57 
GeneralRe: LoadString failed in Windows7 Operating System. Pin
Richard MacCutchan7-Jun-11 0:59
mveRichard MacCutchan7-Jun-11 0:59 
QuestionC++ Question Pin
Software20076-Jun-11 17:18
Software20076-Jun-11 17:18 
AnswerRe: C++ Question Pin
Niklas L7-Jun-11 2:00
Niklas L7-Jun-11 2:00 
GeneralRe: C++ Question Pin
Stefan_Lang7-Jun-11 2:05
Stefan_Lang7-Jun-11 2:05 

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.