Click here to Skip to main content
15,889,992 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: About inheritance Pin
led mike14-Aug-07 4:55
led mike14-Aug-07 4:55 
GeneralRe: About inheritance Pin
Nandu_77b24-Aug-07 4:29
Nandu_77b24-Aug-07 4:29 
Questionreal time matrix conversion Pin
Morad Kobi13-Aug-07 4:02
Morad Kobi13-Aug-07 4:02 
AnswerRe: real time matrix conversion Pin
Luc Pattyn13-Aug-07 5:51
sitebuilderLuc Pattyn13-Aug-07 5:51 
QuestionRe: real time matrix conversion Pin
George L. Jackson13-Aug-07 13:58
George L. Jackson13-Aug-07 13:58 
QuestionAccess controls from other modules of a program Pin
eugk12-Aug-07 23:31
eugk12-Aug-07 23:31 
AnswerRe: Access controls from other modules of a program Pin
mid=574113-Aug-07 5:38
mid=574113-Aug-07 5:38 
GeneralRe: Access controls from other modules of a program Pin
eugk13-Aug-07 8:40
eugk13-Aug-07 8:40 
Michael, thanks a lot for your reply. I did try delegates even before my desperate call for help and now I tried it again, but still no luck. Here is what I put on top of my Form1.h:

<br />
delegate void MyFormMethod (void); // declare the delegate.<br />
typedef void (*PFUNC)(void);       // type for the method I want to call from outside.<br />
<br />
PFUNC pFunc (void);                // actually create a public pointer for my method.<br />


Then in the form's constructor I do this:

	<br />
public:<br />
    Form1(void)<br />
    {<br />
        InitializeComponent();<br />
<br />
        MyFormMethod^ m = gcnew MyFormMethod(this, &Form1::MyMethod); // create instance of my delegate.<br />
        IntPtr pint = Marshal::GetFunctionPointerForDelegate (m);     // get the pointer my method.<br />
        PFUNC pFunc = (PFUNC)pint.ToPointer ();                       // save it in the global pointer.<br />
    }<br />


So far so good, but if I try to use pFunc () anywhere in the code the program does not link. Even if I use it in the same Form's Button handler I get an error:

error LNK2028: unresolved token (0A00000A) "void (__clrcall*__clrcall pFunc(void))(void)" (?pFunc@@$$FYMP6MXXZXZ) referenced in function "private: void __clrcall My2::Form1::button1_Click(class System::Object ^,class System::EventArgs ^)" (?button1_Click@Form1@My2@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z)

There is just no simple example anywhere that I could start from. I saw the console app examples where they create a delegate in the main() function and then use it in that main() function. That works, but when I try to move the same concept into my form...Confused | :confused: There should be some obvious problem in my understanding of things, could you please point me to it?

Many thanks!
Eugene
GeneralRe: Access controls from other modules of a program Pin
mid=574113-Aug-07 9:12
mid=574113-Aug-07 9:12 
GeneralRe: Access controls from other modules of a program Pin
eugk13-Aug-07 12:02
eugk13-Aug-07 12:02 
GeneralRe: Access controls from other modules of a program [modified] Pin
mid=574113-Aug-07 12:35
mid=574113-Aug-07 12:35 
GeneralRe: Access controls from other modules of a program Pin
eugk13-Aug-07 15:52
eugk13-Aug-07 15:52 
GeneralRe: Access controls from other modules of a program [modified] Pin
mid=574113-Aug-07 16:12
mid=574113-Aug-07 16:12 
GeneralRe: Access controls from other modules of a program Pin
eugk13-Aug-07 20:26
eugk13-Aug-07 20:26 
QuestionWhat makes a class IDisposable? Pin
mid=574111-Aug-07 15:19
mid=574111-Aug-07 15:19 
AnswerRe: What makes a class IDisposable? Pin
Mark Salsbery12-Aug-07 7:30
Mark Salsbery12-Aug-07 7:30 
GeneralRe: What makes a class IDisposable? Pin
mid=574112-Aug-07 7:58
mid=574112-Aug-07 7:58 
GeneralRe: What makes a class IDisposable? Pin
Luc Pattyn12-Aug-07 8:41
sitebuilderLuc Pattyn12-Aug-07 8:41 
GeneralRe: What makes a class IDisposable? [modified] Pin
mid=574112-Aug-07 9:00
mid=574112-Aug-07 9:00 
GeneralRe: What makes a class IDisposable? Pin
iddqd51513-Aug-07 6:06
iddqd51513-Aug-07 6:06 
GeneralRe: What makes a class IDisposable? Pin
mid=574113-Aug-07 6:15
mid=574113-Aug-07 6:15 
GeneralRe: What makes a class IDisposable? Pin
led mike13-Aug-07 6:28
led mike13-Aug-07 6:28 
GeneralRe: What makes a class IDisposable? Pin
mid=574113-Aug-07 6:46
mid=574113-Aug-07 6:46 
GeneralRe: What makes a class IDisposable? Pin
iddqd51513-Aug-07 6:29
iddqd51513-Aug-07 6:29 
GeneralRe: What makes a class IDisposable? Pin
mid=574113-Aug-07 6:45
mid=574113-Aug-07 6:45 

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.