📄 ieprodlg.cpp
字号:
// IEProDlg.cpp : implementation file
//
#include "stdafx.h"
#include "IEPro.h"
#include "IEProDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CIEProDlg dialog
CIEProDlg::CIEProDlg(CWnd* pParent /*=NULL*/)
: CDialog(CIEProDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CIEProDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CIEProDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CIEProDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CIEProDlg, CDialog)
//{{AFX_MSG_MAP(CIEProDlg)
ON_BN_CLICKED(IDC_OPEN, OnOpen)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CIEProDlg message handlers
BOOL CIEProDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CIEProDlg::OnOpen()
{
// TODO: Add your control notification handler code here
PROCESS_INFORMATION pi;
//Create an IE process
BOOL fSuccess = CreateProcess(
_T( "\\Windows\\explorer" ),
NULL,
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE,//The new process has a new console, instead of inheriting the parent's console.
NULL,
NULL,
NULL,
&pi );
if ( fSuccess )
{
//Send a ALT+V event to IE process.
//Press down ALT+V keys,and VK_MENU is virtual key code of "Alt"
//and 0x56 is the virtual key code of "V"
keybd_event ( VK_MENU, 0, KEYEVENTF_EXTENDEDKEY | 0, 0 );
keybd_event ( 0x56, 0, KEYEVENTF_EXTENDEDKEY | 0, 0 );
//Press up ALT+V keys,and VK_MENU is virtual key code of "Alt"
//and 0x56 is the virtual key code of "V"
keybd_event ( 0x56, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
keybd_event ( VK_MENU, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
Sleep(2000);
//Send a "A" keyboard event to IE process
//0x41 is the virtual key code of "A"
keybd_event ( 0x41, 0, KEYEVENTF_EXTENDEDKEY | 0, 0 );
keybd_event ( 0x41, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0 );
Sleep(1000);
MessageBox( _T( "Success!!" ), _T( "Information" ), MB_ICONINFORMATION );
}
else
{
MessageBox( _T( "Failed to create the process!" ), _T( "Error" ), MB_ICONERROR );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -