Click here to Skip to main content
15,903,201 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem in Images display on dialog. Pin
hemlat18-Mar-09 21:07
hemlat18-Mar-09 21:07 
GeneralRe: Problem in Images display on dialog. Pin
_AnsHUMAN_ 19-Mar-09 1:23
_AnsHUMAN_ 19-Mar-09 1:23 
GeneralRe: Problem in Images display on dialog. Pin
hemlat19-Mar-09 21:06
hemlat19-Mar-09 21:06 
Questionhow to convert legacy C++ library with nested class and callback to managed code [modified] Pin
Frank_Q18-Mar-09 16:57
Frank_Q18-Mar-09 16:57 
AnswerRe: how to convert legacy C++ library with nested class and callback to managed code Pin
Frank_Q19-Mar-09 16:03
Frank_Q19-Mar-09 16:03 
GeneralRe: how to convert legacy C++ library with nested class and callback to managed code Pin
David Knechtges20-Mar-09 10:07
David Knechtges20-Mar-09 10:07 
GeneralRe: how to convert legacy C++ library with nested class and callback to managed code Pin
Frank_Q21-Mar-09 5:03
Frank_Q21-Mar-09 5:03 
Questionproblem accessing member functions from LRESULT CALLBACK Function() { } Pin
abiemann18-Mar-09 15:17
abiemann18-Mar-09 15:17 
Problem Statement:
SetWindowsHookEx() won't permit the 2nd parameter to be a function in a class. Therefore, I have created a separate global function in my .cpp file "MouseHookWndProc" that will be called. However, how is it possible to reach functions in my (Dialog) class from the global function "MouseHookWndProc" ?

Source code:
//DIALOG CONSTRUCTOR
S2000_CP_DLG::S2000_CP_DLG(CWnd* pParent) : CDialog(S2000_CP_DLG::IDD, pParent)
{
    mouseHook = SetWindowsHookEx(WH_MOUSE, (HOOKPROC)MouseHookWndProc, GetModuleHandle(NULL), NULL);
}

LRESULT CALLBACK MouseHookWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
    if (nCode < 0)
        return CallNextHookEx(mouseHook, nCode, wParam, lParam);

    char chTempText[100];
    sprintf(chTempText,"MouseHook:0x%X",wParam);
    //S2000_CP_DLG::CpMessage(chTempText,0);//show mouse action on dialog

    return CallNextHookEx(mouseHook, nCode, wParam, lParam);
}

class S2000_CP_DLG : public CDialog
{
	DECLARE_DYNAMIC(S2000_CP_DLG)
public:
        void CpMessage(char* pszMessage, int nVal);// show messages in edit control
        CEdit   m_editMessages;
}



My Attempt to solve it:
The obvious solution for me was to make CpMessage() a static (as well as the m_editMessages since that member variable is used by the function).
This compiled, however Linking failed:
error LNK2019: unresolved external symbol "public: static class CEdit S2000_CP_DLG::m_editMessages" (?m_editMessages@S2000_CP_DLG@@2VCEdit@@A) referenced in function "protected: virtual void __thiscall S2000_CP_DLG::DoDataExchange(class CDataExchange *)" (?DoDataExchange@S2000_CP_DLG@@MAEXPAVCDataExchange@@@Z)	S2000_CP_DLG.obj


void S2000_CP_DLG::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);

	DDX_Control(pDX, IDC_MESSAGES, this->m_editMessages);//Edit Control
}



The problem persists... and unfortunately adding "this->" to the DoDataExchange() didn't work Sigh | :sigh:


does anyone have any recommendations ?
AnswerRe: problem accessing member functions from LRESULT CALLBACK Function() { } Pin
«_Superman_»18-Mar-09 16:48
professional«_Superman_»18-Mar-09 16:48 
GeneralRe: problem accessing member functions from LRESULT CALLBACK Function() { } Pin
abiemann19-Mar-09 8:18
abiemann19-Mar-09 8:18 
Questiondesign a Kohonen SOM of 15 neurons in a 3X5 rectangular grid Pin
w118sxa18-Mar-09 11:30
w118sxa18-Mar-09 11:30 
AnswerRe: design a Kohonen SOM of 15 neurons in a 3X5 rectangular grid Pin
Maximilien18-Mar-09 12:40
Maximilien18-Mar-09 12:40 
Questionpersistent pointer/memory allocation Pin
Ylno18-Mar-09 10:04
Ylno18-Mar-09 10:04 
AnswerRe: persistent pointer/memory allocation Pin
Joe Woodbury18-Mar-09 10:12
professionalJoe Woodbury18-Mar-09 10:12 
AnswerRe: persistent pointer/memory allocation Pin
Luc Pattyn18-Mar-09 13:19
sitebuilderLuc Pattyn18-Mar-09 13:19 
AnswerRe: persistent pointer/memory allocation Pin
«_Superman_»18-Mar-09 16:53
professional«_Superman_»18-Mar-09 16:53 
AnswerRe: persistent pointer/memory allocation Pin
Eytukan18-Mar-09 19:41
Eytukan18-Mar-09 19:41 
AnswerRe: persistent pointer/memory allocation Pin
abiemann19-Mar-09 8:34
abiemann19-Mar-09 8:34 
QuestionConverting win32 console app. to service ? Pin
mmayur18-Mar-09 10:01
mmayur18-Mar-09 10:01 
AnswerRe: Converting win32 console app. to service ? Pin
Jerry.Wang18-Mar-09 13:52
Jerry.Wang18-Mar-09 13:52 
QuestionSome help on interpreting this makefile for linux... Pin
leslie wu18-Mar-09 7:07
leslie wu18-Mar-09 7:07 
AnswerRe: Some help on interpreting this makefile for linux... Pin
Stuart Dootson18-Mar-09 8:14
professionalStuart Dootson18-Mar-09 8:14 
AnswerRe: Some help on interpreting this makefile for linux... Pin
bolivar12318-Mar-09 8:18
bolivar12318-Mar-09 8:18 
AnswerRe: Some help on interpreting this makefile for linux... Pin
CPallini18-Mar-09 8:35
mveCPallini18-Mar-09 8:35 
QuestionDevPartner Studio Pin
BobInNJ18-Mar-09 5:58
BobInNJ18-Mar-09 5:58 

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.