问题描述
我很困惑如何在以下场景中混合托管/非托管C ++:
非托管
--------- ---
带有应该在托管中调用事件的方法的回调监听器类
Form1。
启动监听器的监听器的初始化代码线程。
管理
----------
带有自定义事件处理程序的Windows表单应用程序。
我相信这可以分为三个部分:
1)如何从非托管C ++调用Form1中的托管代码事件。
2)如何访问Form1(因为它是表单的实例)。
3)如何从Form1中初始化非托管回调侦听器。
谢谢!
I''m puzzled how to mix managed/unmanaged C++ in the following scenario:
Unmanaged
------------
Callback listener class with method that should call an event in managed
Form1.
Initialization code for the listener that launches the listener thread.
Managed
----------
Windows form application with a custom event handler.
I believe this can be broken down into three parts:
1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.
Thanks!
推荐答案
我也想知道如何做到这一点。
几年前我试过这个,但到目前为止我从来没有能够做到这一点
工作。
我无法想象它不是以某种方式通过思考由Microsoft。
I am also wondering how to do this.
I tried this a few years ago but so far I have never been able to make it
work.
I cannot imagine that it is not somehow thought through by Microsoft.
我也想知道如何做到这一点。
几年前我试过这个,但到目前为止我从来没有能够做到这一点
工作。
我无法想象它不是以某种方式通过思考由Microsoft。
I am also wondering how to do this.
I tried this a few years ago but so far I have never been able to make it
work.
I cannot imagine that it is not somehow thought through by Microsoft.
1)如何从非托管C ++调用Form1中的托管代码事件。
2)如何访问Form1(因为它是一个Form的实例)。
3)如何从Form1中初始化非托管回调侦听器。
谢谢!
1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.
Thanks!
这篇关于混合托管/非托管C ++回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!