如何获取向量,从DLL列表中进行处理 [英] how to get vector, list from DLL to work with

查看:97
本文介绍了如何获取向量,从DLL列表中进行处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MainProgram.exe,此程序使用MainLibrary.dll.我需要制作另一个MyProgram.exe,以实时修改此MainLibrary.dll.每次更改MyProgram.exe中的设置时,MainLibrary.dll都会收到此设置并将其用于MainProgram.exe.

I have a MainProgram.exe, this program use a MainLibrary.dll. I need to make another MyProgram.exe, that modify this MainLibrary.dll in real time. Every time I change setting in the MyProgram.exe, the MainLibrary.dll receive this settings and use them for the MainProgram.exe.

class MainWindow
{
    public:
        MainWindow();
        ~MainWindow();
        list <SubWindow*> GetVector();
        list <subwindow*> MainWin;
        list <subwindow*>::iterator it;
};

list <SubWindow*> MainWindow::GetVector()
{
    // list <SubWindow*> MainWin;
    return MainWin;
}

list <void*>::iterator it; // ?????
typedef list <void*>(*VECTOR)(); // ?????
VECTOR _VECTOR;

HINSTANCE hDLL = LoadLibrary("Win32Project.dll");

if (hDLL != NULL)
{
    _VECTOR pVectorFunction = (VECTOR)GetProcAddress(hDLL, "GetVector");

    if (pVectorFunction)
    {
        for (it = MainWin.begin(); it != MainWin.end(); it++)
        {
            //do stuff here
        }
    }
}

推荐答案

您必须使用某种进程间通信(IPC)才能使应用程序进行通信,但无法加载DLL并将其传递给其他exe数据.

IPC有多种选择,请参见Wikipedia页面并仔细阅读您的选择,然后找到适合您需求的选择.
IPC Wikipedia [ ^ ]
You have to use some sort of Inter-process Communications (IPC) to get your applications communicating, you can''t load a DLL and pass it data for the other exe.

There are a variety of IPC options, see the Wikipedia page and read up on your options then find one that suits your needs.
IPC Wikipedia[^]


这篇关于如何获取向量,从DLL列表中进行处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆