任何方式使用HTML作为一个接口为C / C ++程序? [英] Any way to use HTML as an interface to a C/C++ program?

查看:800
本文介绍了任何方式使用HTML作为一个接口为C / C ++程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发是在接口USB产品。我想为它编写控制程序,但我不能编程为便便的GUI,所以我想出了使用网页(本地应用程序的安装目录)作为接口方案的想法。

I'm developing a product that is interfaced over USB. I want to write a control app for it, but I cannot program a GUI for poo, so I came up with the idea of using a web page (local to the app's install directory) as the interface to the program.

因此​​,通信线路是:用户 - > HTML页面(未托管 - 这是本地) - > C ++程序 - > USB接口

So, the line of communication would be: User --> HTML page (not hosted - it's local) --> C++ program --> USB port

我想这样来做,因为它是便携式的,至少UI明智的,我可以流利地写HTML。

I'd like to do it this way because it's portable, at least UI wise, and I can write HTML fluently.

我的问题是:这将有可能使用一个HTML页面通过一个C ++程序交谈的USB端口

My question is this: would it be possible to use an HTML page to talk to the USB port through a C++ program?

如果没有,我会学习GTK - 这是不够便携

If not, I'll learn GTK - it's portable enough.

PS。请问这有可能与PHP,或(eugh)的Java?

PS. Would this be possible with PHP, or (eugh) Java?

编辑:刚刚意识到PHP是一个服务器端语言 - 它不会在我的情况下工作,因为页面需要被作为程序运行(IE,只需使用Web浏览器和HTML的图形用户界面,与实际采用处理完成C / C ++)

Just realised PHP is a server-side language - it wouldn't work in my situation because the page needs to be run as a program (I.E., just use the web browser and HTML as the GUI, with the actual processing done using C/C++)

推荐答案

您就可以创建一个使用C Web应用程序++使用一种称为重量(类似的API Qt的)。还有一个独立的浏览器,以及为Apache的模块。这样,您就可以使用C ++作为编程语言你会C#与ASP.NET同样的方式,这样的话你也可以使用现有的C ++ code。这不是真正的优雅,但。

You can actually create web applications in C++ using a toolkit called Wt (similar API to Qt). There is a standalone browser as well as a module for Apache. This way you can use C++ as your programming language the same way you would C# with ASP.NET, and thus you can also use your existing C++ code. It's not really elegant though.

其实我建议您了解Qt和写在它的上面整个应用程序。这是令人难以置信的便携和具有只是一切广泛的API - 这是一个应用框架; GTK +不只是用户界面,并在C,虽然C ++ gtkmm的包装是好的。检查它在 http://qt.nokia.com - 这是在GNU LGPL可用

I'd actually recommend you learn Qt and write the whole application on top of it. It's incredibly portable and has an extensive API for just about everything - it's an application framework; GTK+ does just the UI, and in C, although the GTKmm wrapper for C++ is nice. Check it out at http://qt.nokia.com - it's available under the GNU LGPL.

这篇关于任何方式使用HTML作为一个接口为C / C ++程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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