WM_RBUTTONDOWN

Hey guys... :) I am trying to use the WM_RBUTTONDOWN message but I can't!!! It seems like I haven't understood it yet! Anyway, if anyone could give any information about it, it would be really great!!! Thank you in advance!
Uh, this may sound dumb, but I just tried it, just to see if it worked for me.
I did:
1
2
3
4
5
6
7
8
switch(msg){

//--other WM--

case WM_RBUTTONDOWN:
MessageBox(hwnd, L"FUFEF", L"Fefe", MB_OK);    //random letters, just a test
break;
}


I ran the program, and, like you it didn't work. I tried RBUTTONUP, still no dice. Then, I realized I was clicking the left mouse button. Hehe. Whoops
Anyway, my question to you is: Were you clicking the left mouse button, or are you positive that you are right clicking?

Also: What code is in the message? Without any code given, this is pretty much crystal ball debugging.
Last edited on
Warning: Pet peeve post:

MessageBox(hwnd, L"FUFEF", L"Fefe", MB_OK);



Grrrr....

MessageBox takes TCHARs, not wide chars.

Correct usage:
1
2
3
MessageBoxW(hwnd, L"FUFEF", L"Fefe", MB_OK); // <- wide strings, wide function
MessageBoxA(hwnd, "FUFEF", "Fefe", MB_OK); // <- narrow strings, narrow function
MessageBox(hwnd, TEXT("FUFEF"), TEXT("Fefe"), MB_OK); // <- TCHAR strings, TCHAR function 
@Disch yeah I know, but Qt didn't let me use narrow strings the first time, so I just used a lpwstr. It still works. It really didn't occur to me to use TCHARs
@Disch yeah I know, but Qt didn't let me use narrow strings the first time, so I just used a lpwstr.


MessageBox is not a Qt function, so it doesn't matter.

EDIT: Or did you mean Qt Builder?
In which case: yeah. It doesn't let you use narrow strings because MessageBox doesn't take narrow strings... it takes TCHAR strings.

It shouldn't let you take wide strings either... but unfortunately C++ is weakly typed.

It still works.


Grrrrrrrrrrrr
GRRRRRRRRR


It really didn't occur to me to use TCHARs


It's very simple:

MessageBox = TCHARs
MessageBoxA = chars
MessageBoxW = wchar_ts


Same is true of virtually every WinAPI function:
DeleteFile = TCHARs
DeleteFileA = char
DeleteFileW = wchar_t

etc
Last edited on
Oh. Well, I am fairly new to windows programming, so thanks for the advice :)

Anyway, about Son's question, I tried every single thing I could TO GET AN ERROR, and none of them were even relevant to this question. Really, only two other things. Son, are you SURE you are right clicking?
Topic archived. No new replies allowed.