_thiscall problem - 562479

Hi There!
   i am facing _thiscall conversation problem, while this below given 
code... could somebody suggest me some work around to solve this problem

[code begin]
#include <iostream.h>
typedef int wxCoord ;

template <class T>
class CTextDropTarget
{

private:

     bool (T::*m_pt2CallbackFunc)(wxCoord x, wxCoord y);
public:
     CTextDropTarget(bool (T::*pt2Func)(wxCoord x, wxCoord y));
     virtual ~CTextDropTarget(void);
     virtual bool OnDropText(wxCoord x, wxCoord y);

};

template <class T>
CTextDropTarget<T>::CTextDropTarget(bool ( T::*pt2Func)(wxCoord x, wxCoord y))
{
	m_pt2CallbackFunc=pt2Func;
	
}


template <class T>
CTextDropTarget<T>::~CTextDropTarget(void)
{
}


template <class T>
bool CTextDropTarget<T>::OnDropText(wxCoord x, wxCoord y)
{
     return false;
}


class CSACAddressListCtrl
{
	public:
     CTextDropTarget<CSACAddressListCtrl> *m_pDropTarget;
    static  bool OnTextDropTarget(wxCoord x, wxCoord y)
	{
		return x+y;
	}
};

 
void main()
{
    CTextDropTarget* m_pDropTarget = new 
CTextDropTarget<CSACAddressListCtrl>( &CSACAddressListCtrl::OnTextDropTarget);
 
}
[code end]

Alok Gupta
0
thiscall (2)
12/22/2005 12:50:02 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
865 Views

Similar Articles

[PageSpeed] 22

Hi,

You declared a pointer to a class-method like this:

bool (T::*m_pt2CallbackFunc)(wxCoord x, wxCoord y);

But then you passed to CTextDropTarget constructor the address of
a _static_ class-method which differes from what the constructor
expects. So, you need either to change static into non-static or to
change the func-pointer defination like this:

bool (*m_pt2CallbackFunc)(wxCoord x, wxCoord y);

Next, in main function you made a syntax mistake: Create the 
object of CTextDropTarget like this:

CTextDropTarget<CSACAddressListCtrl> *m_pDropTarget
		= new CTextDropTarget<CSACAddressListCtrl>( 
&CSACAddressListCtrl::OnTextDropTarget );


The code now compiles.


-- 
======
Arman


"thiscall" wrote:

> Hi There!
>    i am facing _thiscall conversation problem, while this below given 
> code... could somebody suggest me some work around to solve this problem
> 
> [code begin]
> #include <iostream.h>
> typedef int wxCoord ;
> 
> template <class T>
> class CTextDropTarget
> {
> 
> private:
> 
>      bool (T::*m_pt2CallbackFunc)(wxCoord x, wxCoord y);
> public:
>      CTextDropTarget(bool (T::*pt2Func)(wxCoord x, wxCoord y));
>      virtual ~CTextDropTarget(void);
>      virtual bool OnDropText(wxCoord x, wxCoord y);
> 
> };
> 
> template <class T>
> CTextDropTarget<T>::CTextDropTarget(bool ( T::*pt2Func)(wxCoord x, wxCoord y))
> {
> 	m_pt2CallbackFunc=pt2Func;
> 	
> }
> 
> 
> template <class T>
> CTextDropTarget<T>::~CTextDropTarget(void)
> {
> }
> 
> 
> template <class T>
> bool CTextDropTarget<T>::OnDropText(wxCoord x, wxCoord y)
> {
>      return false;
> }
> 
> 
> class CSACAddressListCtrl
> {
> 	public:
>      CTextDropTarget<CSACAddressListCtrl> *m_pDropTarget;
>     static  bool OnTextDropTarget(wxCoord x, wxCoord y)
> 	{
> 		return x+y;
> 	}
> };
> 
>  
> void main()
> {
>     CTextDropTarget* m_pDropTarget = new 
> CTextDropTarget<CSACAddressListCtrl>( &CSACAddressListCtrl::OnTextDropTarget);
>  
> }
> [code end]
> 
> Alok Gupta
0
armancho_x1 (249)
12/22/2005 1:32:03 PM
Reply:

Similar Artilces:

Outlook Problem?
I file exit from outlook, but it doesn't totally exit. The inbox is still active and accepting mail at my work station. It used to shut down, so then I would get my mail at home. Any ideas. I have MS2000 workstation as the operating system on that computer ...

Too Many Recepients Problem
Hi, Is their a way out from Too many recepients problem when I try to send an email to a distribution list of 100 contacts? Abhay "Abhay Sobti" wrote in message news:uG4dT26bIHA.5128@TK2MSFTNGP05.phx.gbl... > Is their a way out from Too many recepients problem when I try to > send an email to a distribution list of 100 contacts? Send the same e-mail to less than the maximum number of recipients permitted by your e-mail provider's anti-spam quota. Repeat sending your same e-mail to less than maximum recipient count until all recipients have been included. If ...

problem with a conditional max problem
-- What formula could you enter in cell E13 so that if a value is entered in cell E12, cell E13 will display the value of f(x) that corresponds to the largest tabulated x which is less than or equal to the value entered. For example, if 3 is entered in cell E12, then E13 should display the value of f(0). Brian If your tabulated x's are in a range named "tabx", one way: =f(LOOKUP(E12,tabx)) where f() is your function. In article <8D7078DA-197C-4F2B-B7D0-129DEDC8EC8D@microsoft.com>, "Brian Cornejo" <BrianCornejo@discussions.microsoft.com> wrot...

Problem Entering Stock Option Excersized
I ventured into my first stock option and now it has been excersized. I bought a call on JPM which expired on 9/20/08. The call was excersized because the stock was above the strike price. When I try to enter the information into Money Plus HB, it telle me to enter a date between 9/10/2008 and 11/30/1999. Which of course does not make any sense but even if I change the date to within that period I still get the same response about the date. As a work around, I did it as 2 transactions - 1 to sell the shares and the other to have the options expire but I would prefer to show it correc...

Problems with MDI
Hello, I am a newbie in programming with MFC. Recently I created a MDI program with MFC and added different types of views (like ListView, TreeView) to this program. However, I was not able to make the various types of windows appear upon startup. Can anyone who knows how to do it shed some light upon it? Also, even though I tried using "SetWindowtext()" in the OnDraw() methods, all the different windows still get named in numerical order even though they are of different types. Did I do it wrong? Thank you very much in advance. Fedrick. ...

Problem with deleting COM object
I have made an ATL COM which uses classes from an MFC extension DLL. Everything works great until I try to delete a pointer (to an object defined in the extension DLL) to an object from within the destructor of the COM object. When exiting the destructor of the object I get the following error: Invalid Address specified to RtlValidateHeap( 7f0000, 7c7088 ) All involved EXE and DLL's are built using Debug MultiThreaded DLL Anyone have a solution to this? -- Helge "Helge Opg�rd" <helgeo@hotmail.com> wrote: > I have made an ATL COM which uses classes from an MFC...

Office 2003 Student edition Outlook meeting problem
I just purchase and installed the 2003 Student edition of office 2003. I am having a problem with outlook 2003. When people send me meeting notices they do no show up as such and there is not accept box present. They are also using Office 2003 When I send them a meeting notice it does not show up as one on their end either. Jer If I send myself a meeting notice it works fine. Anyone have any idea whats up? Thanks, Jerry ...

CStdioFile Problem
What's wrong here? I keep getting an assertion failed error (str != null in fgets.c) CStdioFile file; try { file.Open(fname, CFile::modeRead); } catch (CFileException) { CString s("Could not open file "); s += fname; dlg->m_StatusBox.AddString(s); return false; } CString buff; file.ReadString(buff); On Mon, 21 Feb 2005 19:25:40 -0500, Debaser <guest@unknown.com> wrote: >What's wrong here? I keep getting an assertion failed error (str != >null in fgets.c) > > CStdioFile file; > ...

Strange problem
We have been rolling out new Windows 7 workstations (all new computers) at work over the last few months and a strange problem has developed. Prior to Windows 7 we were using Windows XP with Office 2007. The problem is, we have a workbook which uses a UserForm for filling in all required information. Prior to rolling out the new Windows 7 workstations, the workbook and UserForm were working flawlessly (for over a year) and they still work flawlessly on the first 3 Windows 7 workstations but on the last 2 workstations we rolled out if you open the UserForm and leave it open for ...

License problem
hi, I took accidentally all Licenses of all users (also with administrator). I cannot access any more CRM. How and where can I assign License to the user? Dimitri You need to restore the database. "Dimitri" wrote: > hi, > > I took accidentally all Licenses of all users (also with administrator). I > cannot access any more CRM. How and where can I assign License to the user? > > Dimitri Thank you. I have data base restored. Now everything is correct. Dimitri "goldenshine" wrote: > You need to restore the database. > > "Dimitri...

Charting Problem #2
I have a problem with charting a Dynamic chart. I goes ok to set up the dynamic function as a range. It also shows the correct series. The range is as follows: =OFFSET(Sheet3!$A$1;1;Sheet3!$P$2-1;COUNTA(INDIRECT("C"&Sheet3!$P$2;FALSE));1) Where P2 is an input from a listbox, and the name of the range is: Sheet3!Dato. When I try to change the reference for the series i get the following message: "Your formula contains an invalid external reference to a worksheet. Verify the path, workbook, and range name or cell reference are correct, and try again." The serie...

Help needed with Integration Manager problem.
I'm trying to use integration manager 8.0 to create a bunch of new invetory items. Everytime I run the integration, I got error message "Not all required fields are entered. Required fields are shown in bold red type". But the only three required fields in GP Item maintenance are Item Number, Description and U of M Schedule ID and they are all already mapped to the source. Couldn't figure this one out as there seems to be no trace tool for IM to find out which filed it's referring to. Can anyone here help me? Thanks a lot. If the data won't import, try enterin...

Calendar Problems afte Migration Question
Hello, We migrated from Exchange 5.5 to Exchange 2003 Interorg. Did not successfully get Free / Busy replicated during migration but users lived with it. We are now fully migrated minus turning off old server. The smtp setup during migration was / is : mail comes in from internet to smtp appliance , delivers to new 2003 server, hands off to old sever if no mailbox, old server handles all smtp traffic to internet via connector. Now all the mailboxes are on the new server. We are having intermittent delivery failures and calendar issues. (Users cant see free busy of users on same serv...

Problem with empty page
hi asp.net 3.5 I have a webpage which if it has a querystring attached it'll display some usefull information. But if no querystring is attached it displays this content: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD> <BODY></BODY></HTML> I've tryed to put some logic into the page so when no querystring is used it should give some values to a Literal control on the page. That code executes ...

Strange problem #2
User is running Excel 2002. Her normal routine is to open Excel, then open 8 different files (all linked to other files). As worked is completed on each file, files is saved and closed so Excel never has more than one file open at any given time. Excel shuts down every morning after she runs the 3rd or 4th file with various errors. If she runs this routine by opening Excel and then closing it after each file - the errors don't occur. So as long as she closes Excel after she runs each file and starts a new session for the next file - everything runs smoothly. Any ideas? Do ...

cursor problem
When I am typing any kind of text in word or email messages, my cursor jumps around randomly causing all kinds of crazy typos. How do I correct this problem? Adjust the sensitivity of the touchpad on your laptop. -- Cheers! Gordon Bentley-Mix Word MVP "amyparker" <amyparker@discussions.microsoft.com> wrote in message news:14C737D2-488D-4C4E-A649-638D62B7A4D7@microsoft.com... > When I am typing any kind of text in word or email messages, my cursor > jumps > around randomly causing all kinds of crazy typos. How do I correct this > problem? ...

Thread problem #2
Hello, I'm trying to write a MFC-Dialog of a Dpws-Server-Client sample. So I have the existing C sample-code, which starts a thread, but I am not able to transform it to C++. This is the existing c-code: // ===================================== #include <windows.h> #include <stdio.h> #include "dpws.h" /* * IMPORTANT NOTE: This multi-thread server is supplied as an example for studying purpose * and does not meet the usual standards of industrial software. For instance, threads * should not create threads or allocate a runtime structure for every serv...

Having Problems with AnimateWindow
hi I want to hide my application on certain conditions when the application is minimized. Till now i was using ShowWindow to achieve this and it worked fine. Now when I am using the AnimateWindow API the window gets hidden but the window's entry in the taskbar remains. I am posting the code that i have written. void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == SC_MINIMIZE) { if(bMinimizeToTray) { this->AnimateWindow(200,AW_HIDE |AW_SLIDE | AW_VER_POSITIVE); // this->ShowWindow(SW_HIDE); return; } } CFrameW...

Problems migrating POP3 to IMAP
Hi there, since years I'm using GMX-Mail with MS Outlook (POP3). Due to the fact I got a laptop too I thought about using the IMAP protocol to keep both synchronal. First off all I had to migrate all my "offline" mails to the GMX-server. For that purpose I created parallely an IMAP account, created the corresponding Folder and copied my offline mails into the IMAP folders. Up to this point everything worked fine. But if update my IMAP folders with Outlook every mail has the current date. So I tried something different. I exported all my mails to the Thunderbird mail-client...

very weird problem
sbs2003, 6.5, outlook 2003 with spam bayes for spam control i reinstalled the outlook 2003, which seemed corrupted, and i think the procedure i followed is from scratch - save the current outlook hierarchy in a pst file - delete the old mail acct from mail in control panel - remove and reinstall office 2003 so i had a fresh copy of outlook - when creating (recreating) the mail acct i forced it to create a new ost file - in this outlook i'm using spam bayes for spam control as was used in the old - import the saved pst file data into the 'new' outlook seemed to work ok, could se...

Problem
I get this message while updating on the internet with Microsoft Money "an error was encountered while processing a download file ('%s') during smart connect This has happened for over two weeks now. -- Stephen and Erica Chenelle In microsoft.public.money, Stephen & Erica Chenelle wrote: >I get this message while updating on the internet with Microsoft Money "an >error was encountered while processing a download file ('%s') during smart >connect > >This has happened for over two weeks now. > It is a current problem we all have, but there...

CRM 3.0 Problems on multihomed SBS 2003
We've just installed CRM 3.0.5300 on a brand new SBS 2003 Premium server. Also have installed a single WinXP SP2 workstation on the network and installed the CRM client for Outlook 2003. When accessing CRM from the workstation, we often get error messages stating that the server is unavailable or that the web site can't be located. We get these errors from both the integrated Outlook client as well as accessing the CRM site through IE7. Hitting Refresh once or twice will usually relocate/load the page from the CRM site, but performance is very slow (appx. 30 seconds to load a p...

Banner Problems
NOTE: This is the first time I have ever been to this newsgroup. This is the first time I have tried to print a banner. It is 8.5" high x 5' long. Two problems; #1: no matter what I do, I cannot get a colored background to print. #2: I cannot get the individual tiles to line up correctly. They either leave gaps in between tiles, or they duplicate too much between tiles. I just want to trim the non-image parts on each end with a paper cutter, and have the text and images line up. Any help appreciated. Regards, Kevin Kevin, we don't hold it against you for this being your ...

keyboard problems...
My keyboard has gone French on me... even though the taskbar shows all settings as English language and US keyboard. Any ideas on where else I can look? Also, this is only happening on my work user profile, not my home user profile. C. Carmen, A simple restart usually fixes it. My Spanish keyboard sometimes forgets its latin origin and it also goes bananas. :) Carlos "Carmen Gauvin-O'Donnell" wrote: > My keyboard has gone French on me... even though the taskbar shows all > settings as English language and US keyboard. > > Any ideas o...

Outlook 2003.. problem with XP SP2
When I load xp SP2 my dialogue boxes , especially the date ones in Outlook 2003 don't work properly. When you try to move the mouse into the clader drop-down box it closes. You can't click to select the time. Other dialogue boxes open the worng size, on the wrong screen and go to the back How do I report this? How long before it is fixed? I have had to rebuild my machine twice to get rid of SP2 and prove that this is a correct assessment rfc rfc <rfc_net@ yahoo.com> wrote: > I have had to rebuild my machine twice to get rid of SP2 and prove > that this is a corr...