1

我有一个 c++ 程序来加载视频,我想在接口 java 中获取这个视频,所以我继续使用 jni

这是我的java代码:

Display display = new Display();
        Shell shell = new Shell(display);
        shell.setText("Example");
        shell.setLayout(new FillLayout());
        // Create a canvas
        final Canvas canvas = new Canvas(shell, SWT.NONE);
        shell.setSize(580, 350);
        shell.open();
        int i = canvas.handle;
       //start( canvas.handle ); 

这是我的 C++ 代码:

Console::WriteLine("0");
            m_ctrl = gcnew AxVideoRecvCtrl();
            Console::WriteLine("1");
            m_ctrl->Name = "VideoRecvCtrlLive";
            m_ctrl->BeginInit();
            Console::WriteLine("idCanvas = "+idCanvas);
            //
            IntPtr windowHandle = Process.GetCurrentProcess().MainWindowHandle;
            m_ctrl->Parent = control->FromHandle((IntPtr)(idCanvas));

            if(m_ctrl->Parent == nullptr){
                Console::WriteLine("Is NULll");
                return;
            }

问题是我总是得到 NULL 结果,有什么帮助吗?

4

0 回答 0