Build error when adding a message handler to a CWinThread derived class

This one might be simple, but I'm scratching my head a bit.

I've got a class derived from CWinThread, and when I want it to do
something I'll post a message to it

MyWinThreadObj->PostThreadMessage(MyMessage, param1, param2);

and declare a function handler as public or protected or whatever

LRESULT Handler(WPARAM, LPARAM);


and in the message map for the class :

BEGIN_MESSAGE_MAP(MyClass, CWinThread)
	ON_MESSAGE(WM_MYMESSAGE,Handler)
END_MESSAGE_MAP()


and the compliler is telling me:
error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall
MyClass::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::*
)(WPARAM,LPARAM)'

With .Net 2003 and the code is identical to stuff I've previously used
under VC6.

0
silangdon (42)
7/19/2005 10:14:06 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
502 Views

Similar Articles

[PageSpeed] 29

"Simon L" <silangdon@hotmail.com> wrote in message
news:1121768046.437982.321650@g47g2000cwa.googlegroups.com...
> This one might be simple, but I'm scratching my head a bit.
>
> I've got a class derived from CWinThread, and when I want it to do
> something I'll post a message to it
>
> MyWinThreadObj->PostThreadMessage(MyMessage, param1, param2);
>
> and declare a function handler as public or protected or whatever
>
> LRESULT Handler(WPARAM, LPARAM);
>
>
> and in the message map for the class :
>
> BEGIN_MESSAGE_MAP(MyClass, CWinThread)
> ON_MESSAGE(WM_MYMESSAGE,Handler)
> END_MESSAGE_MAP()
>
>
> and the compliler is telling me:
> error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall
> MyClass::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::*
> )(WPARAM,LPARAM)'
>
> With .Net 2003 and the code is identical to stuff I've previously used
> under VC6.

MFC7.x adds that static_cast checking to message handlers so that folks will
use the proper macro and signature. See if using...

ON_THREAD_MESSAGE

....and...

VOID Handler(WPARAM, LPARAM)

....works for you.

-- 
Jeff Partch [VC++ MVP]


0
jeffp (1711)
7/19/2005 11:16:03 AM
Reply:

Similar Artilces:

Error message 0x800cccoe Port 25 socket error 10060
I have Windows 7 home premium. Windows live mail receives messages but I am unable to send them. The error message also states that Windows live mail cannot connect with the Comcast server. I am able to send and receive through Comcast Smartzone, but not with live mail. I want to be able to have live mail connect with the Comcast server. Thanks for any help, tubbman. Change the SMTP port to 587 and make sure: My Server Requires Authentication is checked. How do I set up/configure Outlook Express & Windows Mail for Comcast email? http://www.comcast.com/customers/faq/FaqDe...

new message envelope
Outlook 2003 (11.5608.5703 - all updates) on XP Pro (all updates) During the past week, my new message envelope in the system tray has disappeared. I've verified that the check box is checked that reads "Show an envelope icon in the notification area", and I've done a repair of Office. Neither of these have worked; the envelope still isn't appearing for new messages. Is there anything I can do to get it back? Thanks, Andre fuhgetit. it was xp hiding the icon - mistakenly thinking it was inactive. ...

Outbind error in Outlook 2003
I recently purchased Outlook 2003 for the purpose of using the new mail filtering. So far so good. But when I print to a network printer (I'm on a single domain using Exchange 2000) in Outlook, I have the server setup to respond with a Messenger message to let me know the print job succeeded. It works perfectly in Word, Excel and Powerpoint. Outlook, instead of saying "Document name" printed successfully on Printername on \\Servername (as the other parts of Office do), instead says "outbind://1- 00000000D59E0B25F166A04BB9A11BF4C3CC2ED0700ED1EC63" printed succes...

pwdlastset View in AD
We changed our passwords every 90 days. Users love to call us and tell us that they cannot log in. We look in AD at their Account Properties and it is not locked out. We run a script and find that their password has not changed for over 90 days. However, Help Desk can not run the script to see this date. (obviously Help desk would not run a script.) Is their any way to view Password Last Changes or Password Expire in the AD Proerties of the account much like we see the other attributes like Account lock out, Address, Profile...etc.. We have 2003 AD Native Hello poboy_n.o_style,...

Money 2005 error with session Reference # 2000
I was trying to download my account info from Wachovia and it said that my account could not be updated and to tell my Customer Service Rep with Reference Number 2000. How do I fix this to update my info? Thanks! ...

Building Assembly
I'm trying to build an assembly that creates a directory that is named after an attribute in opportunities. this is what I have, and it is not compiling into a dll, any advice? public string CreateDirectory(string root,string folderName) { } Luke Davis, MCSE: Security DEM Networks - Senior Systems Architect 7225 N First, Suite 105 Fresno, CA 93720 Office: 1 (559) 439-1000 Fax: 1 (866) 640-2041 www.demnetworks.com ...

message counting
Does anyone know how to make outlook count the number of messages that it receives per day? ...

Fixed Asset Delete by Class ID
I have a client that needs to delete a large amount of fixed assets, but does not want to use Clear Data. I need to be able to delete a range of assets by Asset Class. Has anyone written scripts or tried to do this in SQL? you can try this: Delete FAXXXXX where ASSETINDEX in (Select assetindex from FA00100 where assetclassid = 'enter class id here') The FA00100 has the class id field which you can filter on. with that in mind, you can replace the FAXXXXX with the following tables first and run it agains the company db: -- FA00200 (Asset Book Master) -- FA00300 ...

Outlook 2007 error message #3
Does Outlook 2007 have an error log? My I-net mail server is having a problem. Outlook attempts to send message but after a minute or so pops up a little messsage on lower right screen saying "Error-click here to read" , or something similar but disappears before I can click on it. Is that message logges somewhere? TIA, John John Smith <oldibm66@cableone.net> wrote: > Does Outlook 2007 have an error log? If you enable, them, logs exist, but not otherwise. See this: http://support.microsoft.com/kb/300479 -- Brian Tillman [MVP-Outlook] ...

file already open error
Hi Every time I open a saved excel spread sheet I receive this error: A document with the name 'add-in name' is already open. You cannot open two documents with the same name, even of the documents are in different folders." If I open the file by using the File, Open menu and navigate to the file, I do not receive the error. It's only when I click on the file which is on the desktop and open it that way , do I receive the error There are no other files open at the time. Rebooting does not solve the problem. WE are running Windows XP SP2 and Excel 97 Thanks in advance...

OWA Logon error
My users can not log on to OWA! We just migrated to Exchange 2003 from 5.5. If I create a new domain user and a new mail box in Active directory they can log in. But if I change there email address in the address field they can no longer log in. There must be something I need to set somewhere to correct this problem. Please help. On Tue, 24 May 2005 10:54:03 -0700, "Shane" <Shane@discussions.microsoft.com> wrote: >My users can not log on to OWA! We just migrated to Exchange 2003 from 5.5. >If I create a new domain user and a new mail box in Active directory they ca...

what's a standard recommended message size limit?
We're running Exchange Server 2003 and our information store just keeps growing rapidly. I'ts mostly because of users sending digital photos (non-work related). What is the industry-recommended limit on message sizes? I've just set our inbound/outbound message size limit to 2 MB but I'm not sure if this is too restrictive. Thanks. chris "chrism" <chrism@no_spam> wrote in news:#Bp2cYb1FHA.3856@tk2msftngp13.phx.gbl: > I've just set our inbound/outbound message size limit to 2 MB but I'm > not sure if this is too restrictive. I think tha...

building a worksheet row by row
I hope somebody can assist. My worksheet calculates rows of data, which I wish to slide into another worksheet and secure; then change the original data, slide those results under the first. Keep repeating. Is there a way to do this without manually pasting values each time? David Dave "Sliding" rows from one sheet to another would involve the use of VBA. See Ron de Bruin's site for moving/copying rows to next available empty rows. http://www.rondebruin.nl/copy1.htm Gord Dibben Excel MVP On Thu, 4 Nov 2004 14:04:03 -0800, "DaveButcher" <DaveButcher@discussio...

I want to make singleton class
I make the simple singleton class with a boost shared_ptr that is the static pointer. normal programing didn't problem. but if i use with a extension dll file. for example the singleton class was made in the dll file, and that created one of instance in the exe file. it seemd that instance pointer didn't problem in the call from exe, but if i called singleton class to want to get same pointer in the dll. the singleton class was made new one instead of first pointer. so how can I do????? I couldn't recreate your problem. What I did was create a singleton like so in the a...

Error Importing Msg to OL Express
hi all, i had copied messages (*.dbx) files to a CD now after reinstallation am trying to import the same back to outlook express 6 but am getting the following error ________________ No messages can be found in this folder or another application is running that has the required files open. Plese select another folder or try closing applications that may have files open. ________________ Pls help i am in a mess... Thx, Niraj ...

Can I Build an Access Statement (in 2007) as a String and Execute
Hi, I know that I can build a SQL statement within a string and then execute it like the following: strSQL = "UPDATE tblAuditRpt " _ & "SET tblAuditRpt.AuditRptYesCount = " & lngInitialEvalCount & " " _ & "WHERE tblAuditRpt.AuditRptID=25;" CurrentDb.Execute strSQL, dbFailOnError Can I do the same with an Access statement itself? For example, How could I execute the following statement if I built it in a string? lngInitialEvalCount = DCount ("AuditDtlCnt", "AuditDetai...

Error in equation 'sItemNumber'
We get this error on client workstations when trying to print an invoice or sales order. I do not get it when trying to print purchasing documents. I have modified the dynamics.set file to point to the network drive with the modified reports.dic file. I do not get this message when launching GP directly from my server (logging in as the same user). This leads me to believe there is something missing from my setup instead of something wrong with my report. I'm sure it's something simple that I am missing but cannot seem to find it. Any help would be greatly appreciated! Lis...

Mail rule Error
Hi, We have a rule setup asking the server to reply with a specific message for one of our techsupport accounts. The rule reponds internal but not to external address. This worked Ok on an exchange 5.5 system but have upgraded to exchange 2003 and Outlook 2003 and it now fails. Any ideas ??? Andy Andy Judd <andyj@sci.co.uk> wrote: > We have a rule setup asking the server to reply with a > specific message for one of our techsupport accounts. > > The rule reponds internal but not to external address. > > This worked Ok on an exchange 5.5 system but have > up...

Error 0x800ccc19
I am not able to send or receive email in Outlook 2000. The error message I get says a "timeout occurred while communicating with the server" This was not a problem previously, but it just started happening. Can anyone please help me resolve this? I do use McAfee for a virus scanner, and I dont know if that is what is preventing me from getting my emails. Thanks! Turn off the message scanning and increase your server timeout on the Advanced tab of your Mail Account Properties. -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact....

Why are my Hotmail messages not appearing in Outlook?
I've had a couple problems setting up my Outlook 2002XP. First, I cannot get the account to find messages in my hotmail account. Then I tried to send a message and only receive an error message that says "Interface not registered." Is there something I need to do first or something I need to fix. Thanks fo the help. ...

error in report only when run as a subreport
I have two reports that are identical except for the underlying query. the reports show mvoement information but each report shows a different direction. I put each of these directional reports in a third report to display the directions side by side. When run individually the directional reports execute fine. When run as subreports I get divide by zero errors in a section footer of the subreports. The error does not occur when run as a stand-alone report. Any help would be appreciated. Thank you in advance for any help. -- Message posted via http://www.accessmonster.com ...

Error linking to my ATL dll
I'm using VS2005, building a WM5 application. The dll is a ATL com dll providing network services to my app. I've tested the dll with a simple dialog app, but now I try to link it to my application I get .... io 8\VC\ce\atlmfc\include\atliface.h(591) : error C2143: syntax error : missing ',' before '.' which points to virtual HRESULT STDMETHODCALLTYPE ShowUI( /* [in] */ DWORD dwID, /* [in] */ IUnknown *pActiveObject, /* [in] */ IUnknown *pCommandTarget, /...

Public Folders Error Message
In Public Folders getting an error message with some (not all) contacts and calendar items when you try to open them even with admin right or ownership right. The message says "Can't open this item" unkown error. Any thoughts "=?Utf-8?B?TWhlcm5hbmRleg==?=" <Mhernandez@discussions.microsoft.com> wrote in news:165B0C43-FC8B-4EDB-938F-7CE0B97F7FC8 @microsoft.com: > In Public Folders getting an error message with some (not all) > contacts and calendar items when you try to open them even with admin > right or ownership right. The message says "...

"This operation cannot be performed." error
Hi, I noticed recently that I got a "This operation cannot be performed." error whenever I started Money. The error details told me to run the Money file Repair tool to fix the problem. I did a level 2 repair and the report produced said "No broken records in the original file.". I still got errors when I closed and further tried to reopen the file. I then went into 'Bills' and started to delete a bill, then close/reopen Money to see the effect. It came down to a single bill. I duplicated this bill and deleted the original, now Money is working ok and not re...

Distmon error
I am having the same prob that everyone else is describing, however have looked on the Microsoft support forum. I did a search and did no find the 2 Adobe files anywhere on my computer. I also disabled the NAV plugin...... I am still haveing the sam prob. Is there any OTHER way to fix this without reformatting!!?? Thanks in advance -- Message posted from http://www.ExcelForum.com I think I'd shell to DOS and run an old DOS command: dir c:\pdfmak*.xla /s Or make sure you're looking through hidden folders and for hidden files, too (windows explorer setting). "spcinf <...