|
-
July 27th, 2004, 07:56 AM
#1
Send Message Problem
Hi,
Have a class which is derived from CDialog.
Have given this in the Header & the corresponding declaration in the .cpp of the class
LRESULT SendMessage(UINT message,WPARAM wParam = 0 );
I get this error while compiling the .cpp
error C2511: 'SendMessageW' : overloaded member function 'int (unsigned int)' not found in ...
My project is uncode defined...
Can I put this function using the class wizard,If yes,which message in class wizard..
-
July 27th, 2004, 08:03 AM
#2
Why are you trying to implement your own function with the same name (and almost the same parameters) as a standard API SendMessage ?
What does your own SendMessage have to do?
-
July 27th, 2004, 08:06 AM
#3
 Originally Posted by Kohinoor24
Hi,
Have a class which is derived from CDialog.
Have given this in the Header & the corresponding declaration in the .cpp of the class
LRESULT SendMessage(UINT message,WPARAM wParam = 0 );
I get this error while compiling the .cpp
error C2511: 'SendMessageW' : overloaded member function 'int (unsigned int)' not found in ...
My project is uncode defined...
Can I put this function using the class wizard,If yes,which message in class wizard..
there is no problem!!! with SendMessage. The problem is that you won't even open MSDN to see what prototype this function has. if you would have done it you would have known that this is the correct fucntion prototype:
Code:
LRESULT SendMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 );
It has nothing to do with your project being UNICODE as well.
And no, you cannot put this function using class wizard for the simple reason that it doesn't exist there!
As a conclusion I would advise you to start learning/reading a bit about MFC and clarify some of the things, because it can be clearly seen that you hardly have an idea of what you're suppose to do. No offense!
-
July 27th, 2004, 08:08 AM
#4
Actually, depending on Unicode and non-unicode mode 'SendMessage' is #defined as either SendMessageA or SendMessageW. Here, if you strongly need to use that same name, you need to #undef SendMessage. After doing that, you may see many and many of the errors.
So, its better to rename the method in your class.
-
July 27th, 2004, 08:11 AM
#5
you are right in that Iam new to MFC. I made this post after looking into MFC.I saw these same parameters,I reduced it to 2 paramters co's
When I used
My class::SendMessage(..It showed here only 2 parameters.
Thanks for ur advice....
-
July 27th, 2004, 08:14 AM
#6
 Originally Posted by Ajay Vijay
Actually, depending on Unicode and non-unicode mode 'SendMessage' is #defined as either SendMessageA or SendMessageW.
..nevertheless, the different naming doesn't affect the number of parameters, which is what i said.
-
July 27th, 2004, 08:19 AM
#7
 Originally Posted by Alin
..nevertheless, the different naming doesn't affect the number of parameters, which is what i said.
File: WINUSER.H
Line: 2524
VS6
Code:
#ifdef UNICODE
#define SendMessage SendMessageW
#else
#define SendMessage SendMessageA
#endif // !UNICODE
Got it??
I also present simple example:
Code:
#define if main
void if()
{
printf("Hello World!");
}
-
July 27th, 2004, 08:30 AM
#8
I think you didn't get what I was trying to say. I KNOW that there are 2 different things, but the number of paramenters DOESN'T change.
also from the above quoted winuser.h:
Code:
WINUSERAPI
LRESULT
WINAPI
SendMessageA(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam);
WINUSERAPI
LRESULT
WINAPI
SendMessageW(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam);
Do you see know what I'm referring to?
-
July 27th, 2004, 08:37 AM
#9
Yes buddy, now I got it. I thought you were ignoring the constants definition concept.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|