如何避免按下按钮? [英] How to avoid pressing a button?

查看:139
本文介绍了如何避免按下按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

这是我的第一个MFC应用程序,不幸的是我不明白,它是如何工作的?我找到了一个简单的MFC应用程序,该应用程序获取给定路径的文件列表.我根据自己的需要修改了此代码,但是现在我遇到了一个问题.我的应用程序应该执行以下操作.它从文件中读取两个驱动器号.然后获取两个驱动器的文件列表,然后进行比较.如果主驱动器上的文件不在辅助驱动器上,则它将自动复制它.我做了所有这些,但是现在我希望它自动运行.不幸的是,当我按下一个按钮时,原始的MFC应用程序启动了.我要删除此内容,我不应该按下任何按钮,它只是自动复制新文件.所以我的问题是以下.如果主驱动器上有新文件,则我的函数(我在CGetFileListDlg :: OnPaint()函数中调用的CGetFileListDlg :: OnBnClickedButtonGetFileList())会复制数据.一切正常,但是直到复制未完成,我只能看到窗口的轮廓.如果复制完成,则只能看到我的列表控件.这很烦人,因为我想打印当前正在复制的文件.最后,我的问题是,我应该在哪里调用函数,以便在复制过程中可以看到窗口.如果您需要一些代码,我可以发布一些代码,但是我不知道您需要哪个代码:S
请有人帮我!

提前谢谢!

kampi

Hi!

This is my first my MFC application, and unfortunately i don''t understand, how it works? I found a simple MFC application, which gets the file list of a given path. I modifyed this code for my needs, but now i have one problem. What my application should do is the following. It reads two drive letters from a file. Then gets the file list for both drives, and then compares them. If the primary drive has files which aren''t on the secondary drive then it copies it automatically. I did all this, but now i want that it run automatically. Unfortunately, the original MFC application started when i pressed a button. I want to take this out, that i shouldn''t press any buttons, it just copies the new files automatically. So my problem is the following. If there are new file on the primary drive my function ( CGetFileListDlg::OnBnClickedButtonGetFileList() which i called in CGetFileListDlg::OnPaint() function) copies the data. This is working fine, but untill the copying isn''t finished, i can see only the window''s outlines. I can see the only my List Controls, if the copy has finished. This is annoying, because i want print which file am i currently copying. And finally my question is, where should i call my function, so i can see my window during the copying. I can post some code if you need some, but i don''t know which one you need :S
Please someone help me!

Thanks in advance!

kampi

推荐答案

您可以执行以下两项操作之一.用户输入路径的文本框,可以处理文本更改的事件,检查输入的路径是否存在,并显示文件列表,或者可以处理文本框失去输入焦点的事件(这更好) ,然后执行此操作.
You can do one of two things. The textbox the user enters the path in to, you can handle the event of the text changing, check if the path entered exists, and show the file list, or you can handle the event of the textbox losing input focus ( this is better ), and do it then.


这篇关于如何避免按下按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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