Hey so for one of my c++ projects I need to develop a 4-5 window application.Now the issue is that currently all of my programs tasks are divided into classes, and I have tested them by passing 'dummy' values and returning print results. That's all fine and working, however now as I want to introduce a GUI interface it presents me with the problem of how my processing should communicate with the front end, since winAPI is initially meant for c and not object oriented language.
嘿,对于我的一个c ++项目,我需要开发一个4-5窗口应用程序。现在的问题是,目前我的所有程序任务都被分成了类,我通过传递'dummy'值并返回打印结果来测试它们。这一切都很好并且正常工作,但是现在因为我想介绍一个GUI界面,它向我展示了我的处理应该如何与前端通信的问题,因为winAPI最初是针对c而不是面向对象的语言。
What I am thinking of doing, and have a feeling is going to be a tedious task, to make a class which does the win api's registrations and methods for me. Is there any other alternative to this ???
我正在考虑做什么,并且有一种感觉将是一项单调乏味的任务,为我做一个为win api注册和方法的课程。有没有其他替代品???
I was looking at integrating Qt into eclipse but I think they stopped providing the library for eclipse, because I couldn't find a download for the library anywhere, not even on the Qt download page.
我正在考虑将Qt集成到eclipse中,但我认为他们不再为eclipse提供库,因为我无法在任何地方找到该库的下载,甚至在Qt下载页面也没有。
2 个解决方案
#1
0
Well, if you want to use Win32, then you have to do all the stuff that Win32 needs you to do. It's a rather low level API, so you just have to take care of a lot of details.
好吧,如果你想使用Win32,那么你必须完成Win32需要你做的所有事情。这是一个相当低级别的API,所以你只需要处理很多细节。
However, don't over-engineer things. You don't have to write a generic C++ wrapper for Win32... you just have to make a GUI for your program.
但是,不要过度设计事物。您不必为Win32编写通用的C ++包装器...您只需为您的程序创建一个GUI。
#2
0
If your problem is only that classes are not supported by C, then simply replace the keyword class
with the keyword struct
. Just make sure to declare the access types of all variables (private, public, protected), that way it becomes interchangeable (Works for both). The only difference between them is the default access type, which for classes is private. In case you used other syntax that is unique to C++, then this wouldn't work.
如果你的问题只是C不支持类,那么只需用关键字struct替换关键字class。只需确保声明所有变量(私有,公共,受保护)的访问类型,这样就可以互换(适用于两者)。它们之间的唯一区别是默认访问类型,对于类是私有的。如果你使用了C ++独有的其他语法,那么这将不起作用。
There are code generators from C++ to C as well. The optimal solution would be to create a GUI using an IDE specifically for that purpose which uses C++ as its base language. MFC works well, but it is not open-source and you will need a considerable knowledge on inheritance and comfort with "class typecasting". Using the included wizards in Visual Studio will help.
还有从C ++到C的代码生成器。最佳解决方案是使用专门为此目的创建GUI,使用C ++作为基本语言。 MFC运行良好,但它不是开源的,你需要对“类类型转换”的继承和舒适性有相当的了解。在Visual Studio中使用包含的向导将有所帮助。
Try the first option; it will possibly work the same way.
尝试第一个选项;它可能会以同样的方式工作。
#1
0
Well, if you want to use Win32, then you have to do all the stuff that Win32 needs you to do. It's a rather low level API, so you just have to take care of a lot of details.
好吧,如果你想使用Win32,那么你必须完成Win32需要你做的所有事情。这是一个相当低级别的API,所以你只需要处理很多细节。
However, don't over-engineer things. You don't have to write a generic C++ wrapper for Win32... you just have to make a GUI for your program.
但是,不要过度设计事物。您不必为Win32编写通用的C ++包装器...您只需为您的程序创建一个GUI。
#2
0
If your problem is only that classes are not supported by C, then simply replace the keyword class
with the keyword struct
. Just make sure to declare the access types of all variables (private, public, protected), that way it becomes interchangeable (Works for both). The only difference between them is the default access type, which for classes is private. In case you used other syntax that is unique to C++, then this wouldn't work.
如果你的问题只是C不支持类,那么只需用关键字struct替换关键字class。只需确保声明所有变量(私有,公共,受保护)的访问类型,这样就可以互换(适用于两者)。它们之间的唯一区别是默认访问类型,对于类是私有的。如果你使用了C ++独有的其他语法,那么这将不起作用。
There are code generators from C++ to C as well. The optimal solution would be to create a GUI using an IDE specifically for that purpose which uses C++ as its base language. MFC works well, but it is not open-source and you will need a considerable knowledge on inheritance and comfort with "class typecasting". Using the included wizards in Visual Studio will help.
还有从C ++到C的代码生成器。最佳解决方案是使用专门为此目的创建GUI,使用C ++作为基本语言。 MFC运行良好,但它不是开源的,你需要对“类类型转换”的继承和舒适性有相当的了解。在Visual Studio中使用包含的向导将有所帮助。
Try the first option; it will possibly work the same way.
尝试第一个选项;它可能会以同样的方式工作。