C ++转换为Visual C ++程序代码 [英] C++ into Visual C++ program codes

查看:71
本文介绍了C ++转换为Visual C ++程序代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

专家们好!

我有一个用C ++编写的程序,因此它是一个控制台应用程序,希望将其重新编写为Visual C ++.该程序很简单,它的作用是打开一个文件,读取它,然后将转换后的字符串输出到新文件中,然后关闭输入文件.

到目前为止,我已经在Visual C ++中设计了带有进度条和2个按钮的表单.第一个按钮打开文件,第二个按钮处理文件.但是现在,我陷入了困境,不知道如何继续使用我的旧C ++代码,也不知道如何重用我的代码.例如,如何通过单击按钮打开输入文件?然后单击另一个按钮来处理文件,即通过旧的C ++代码中的所有过程和功能进行操作.

请指导我如何进行.如果能在Visuall C ++中看到一些程序示例(代码),它们与我的程序具有相似的功能,那么我将不胜感激,这样我就可以关联并研究这些代码.我一直在网上到处寻找示例代码,但没有成功.

我开始编写的Visual C ++是Windows窗体应用程序,而不是MFC.

提前非常感谢您...

Hi Experts!

I have a program that I have written in C++ so it a console application and wanted to re-write it into Visual C++. The program is simple, what it does is to open a file, read it, and output a converted string into a new file, and then close the input file.

Until now, I have already designed the form in Visual C++ with a progress bar and 2 buttons. The first button to open the file and the second one is to work on it. But now, I''m stuck and don''t know how to proceed with my old C++ codes and no clue on how to re-use my codes. For instance, how can I open the input file by clicking a button? Then clicking another button to process the file, i.e., going thru all the procedures and functions in the old C++ codes.

Please guide me on how to proceed. I would appreciate if I can see some program samples (codes) in Visuall C++ that does similar things as my program so I can then relate and study the codes. I have been looking everywhere on the web for sample codes but no success.

The Visual C++ that I started to write is a Windows forms application not MFC.

Thank you so much in advance...

推荐答案

Windows窗体应用程序意味着您正在使用托管C ++? IMO最好使用.NET文件流,因为它们使用起来要容易得多.但是,如果要将控制台应用程序移到表单应用程序中,只需将已有的代码复制到要触发它们的事件的代码中,这样就可以使按钮具有按下事件,并且可以向其中添加代码询问文件路径,然后采用这些路径并从此处运行其余代码.当然,添加进度条是一个全新的项目,但是一旦掌握了基础知识,您就可以专注于如何跟踪进度.提示-您需要运行多个线程来使酒吧工作,这并不是一个简单的任务,它具有自己的学习曲线.
A windows forms application means you''re using managed C++ ? IMO you''re better off using the .NET file streams then because they are a lot easier to work with. But if you want to move your console app into your forms app, just copy the code you have into the code for the events that you want to trigger them, so you may have a button with a pressed event, and you may add code to ask for file paths, then take those paths and run the rest of your code from there. Of course, adding a progress bar is a whole new project, but once you get the basics done you can focus on how to track progress. A clue - you will need to run multiple threads for your bar to work, it''s not really a simple task, it has it''s own learning curve.


这篇关于C ++转换为Visual C ++程序代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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