⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialoglock.cpp

📁 这是USB传输数据的下位机程序!与另外一个配套使用!一个收一个发!因功能不同
💻 CPP
字号:
// DialogLock.cpp : implementation file
//

#include "stdafx.h"
#include "app_1.h"
#include "DialogLock.h"
#include "function.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

extern CString SaveFile;
/////////////////////////////////////////////////////////////////////////////
// CDialogLock dialog


CDialogLock::CDialogLock(CWnd* pParent /*=NULL*/)
	: CDialog(CDialogLock::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDialogLock)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDialogLock::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialogLock)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialogLock, CDialog)
	//{{AFX_MSG_MAP(CDialogLock)
	ON_BN_CLICKED(IDC_BUTTON_Lock, OnBUTTONLock)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialogLock message handlers

void CDialogLock::OnBUTTONLock() 
{
	// TODO: Add your control notification handler code here
	      BROWSEINFO   bi;     
          TCHAR   szDisplayName[100];     
          LPITEMIDLIST   pidl;     
    
          ZeroMemory(&bi,   sizeof(bi));               
          bi.hwndOwner   =   GetSafeHwnd();     
          bi.pszDisplayName   =   szDisplayName;     
          bi.lpszTitle   =   TEXT("请选择一个文件夹:");     
          bi.ulFlags   =   BIF_RETURNONLYFSDIRS;       
          pidl   =   SHBrowseForFolder(&bi);   //选择文件夹   
          if   (pidl)     
          {     
                  SHGetPathFromIDList(pidl,   szDisplayName);   //   set   the   directory   name.     
                  sPath   =   szDisplayName;   //   m_sPath是CString變量,最後結果在這兒。         
          }  
		  SetDlgItemText(IDC_EDIT_Lock,sPath); 
	      UpdateData(TRUE);
}

void CDialogLock::OnOK() 
{
	// TODO: Add extra validation here
    FILE *fp=NULL;
	if( (fp = fopen( SaveFile,"r")) != NULL)
	{
		fclose(fp);
		DeleteFile(SaveFile);
	}
	GetFile(sPath);
	AfxMessageBox("锁定成功!");	
    SendMessage(WM_CLOSE);
//	CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -