亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? btnetscdlg.cpp

?? Bug管理系統(tǒng)
?? CPP
字號:
// btnetscDlg.cpp : implementation file
//

#include "stdafx.h"
#include "btnetsc.h"
#include "btnetscDlg.h"
#include ".\btnetscdlg.h"
#include <atlimage.h>
#include "SendDlg.h"
#include "base64.h"
#include <fstream>
#include "ConfigDlg.h"
#include "TimeoutSocket.h"
#include "BitMapWnd.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

CString get_temp_file_path()
{
	char temp_path[1000];
	::GetTempPath(1000,temp_path);
	CString temp_file = temp_path;
	temp_file += "bugtracker_screen_capture.jpeg";
	return temp_file;
}


// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	enum { IDD = IDD_ABOUTBOX };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation
protected:
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()


// CbtnetscDlg dialog



CbtnetscDlg::CbtnetscDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CbtnetscDlg::IDD, pParent)
{
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
	m_hBitmap = 0;
	m_strPassword = "";
}

CbtnetscDlg::~CbtnetscDlg()
{
	if (m_hBitmap)
	{
		::DeleteObject(m_hBitmap);
	}
}


void CbtnetscDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_MYPICT, m_ctlPict);
	DDX_Control(pDX, IDC_FILE_SAVED, m_ctlFileSaved);
	DDX_Control(pDX, IDC_SEND, m_btnSend);
}

BEGIN_MESSAGE_MAP(CbtnetscDlg, CDialog)
	//{{AFX_MSG_MAP(CbtnetscDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
	ON_BN_CLICKED(IDC_SEND, OnBnClickedSend)
	ON_BN_CLICKED(IDC_CONFIGURE, OnBnClickedConfigure)
	ON_BN_CLICKED(IDC_FOREGROUND, OnBnClickedForeground)
	ON_BN_CLICKED(IDC_ALL, OnBnClickedAll)
END_MESSAGE_MAP()


// CbtnetscDlg message handlers

BOOL CbtnetscDlg::OnInitDialog()
{
	CDialog::OnInitDialog();


	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// 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

	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CbtnetscDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CbtnetscDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
		//CPaintDC dc(this); 
	}
}

// The system calls this function to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CbtnetscDlg::OnQueryDragIcon()
{
	return static_cast<HCURSOR>(m_hIcon);
}


void CbtnetscDlg::CaptureWindow(bool bForeground)
{
	if (m_hBitmap)
	{
		::DeleteObject(m_hBitmap);
		m_hBitmap = 0;
	}

	// Save original position
	WINDOWPLACEMENT lpwndpl;
	GetWindowPlacement(&lpwndpl);
	lpwndpl.showCmd = SW_MINIMIZE;
	SetWindowPlacement(&lpwndpl);
	Sleep(1000);

	// Capture entire screen

	int nScreenWidth;
	int nScreenHeight;
	HWND hSourceWnd;
	if (bForeground)
	{
		hSourceWnd = ::GetForegroundWindow();
		RECT rectSource;
		::GetWindowRect(hSourceWnd,&rectSource);
		nScreenWidth = rectSource.right-rectSource.left;
		nScreenHeight = rectSource.bottom-rectSource.top;
	}
	else
	{
		hSourceWnd = ::GetDesktopWindow();
		nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
		nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
	}

	HDC hSourceDC = ::GetWindowDC(hSourceWnd);
	HDC hMemDC = ::CreateCompatibleDC(hSourceDC);
	m_hBitmap = ::CreateCompatibleBitmap(hSourceDC, nScreenWidth, nScreenHeight);

	::SelectObject(hMemDC,m_hBitmap);
	::BitBlt(hMemDC,0,0,nScreenWidth,nScreenHeight,hSourceDC,0,0,SRCCOPY);

	//SaveBitmap(m_hBitmap);

	// Display bitmap
	m_ctlPict.SetBitmap(m_hBitmap);

	::ReleaseDC(hSourceWnd,hSourceDC);
	::DeleteDC(hMemDC);

	// Restore this window
	lpwndpl.showCmd = SW_RESTORE;
	SetWindowPlacement(&lpwndpl);

	m_btnSend.EnableWindow();
	//OnOK();
}

///////////////////////////////////////////////////////////////////////
void CbtnetscDlg::SaveBitmap(HBITMAP hbitmap)
{

	// Save as a JPEG
	ATL::CImage img;
	img.Attach(hbitmap);
	img.Save(get_temp_file_path(), Gdiplus::ImageFormatJPEG);
	img.Detach();

	m_ctlFileSaved.SetWindowText(get_temp_file_path() + " saved.");
}


///////////////////////////////////////////////////////////////////////
bool CbtnetscDlg::CheckIfSettingsComplete()
{
	CbtnetscApp* pApp = (CbtnetscApp*) AfxGetApp();
	pApp->GetSavedSettings();

	if (this->m_strPassword = "")
	{
		this->m_strPassword = pApp->m_strPassword;
	}

	if (pApp->m_strUrl == ""
	|| pApp->m_strPort == ""
	|| pApp->m_strEmail == ""
	|| pApp->m_strUsername == ""
	|| this->m_strPassword == "" )   
	{
		return false;
	}
	else
	{
		return true;
	}
}


///////////////////////////////////////////////////////////////////////
void CbtnetscDlg::OnBnClickedSend()
{
	
	if (!CheckIfSettingsComplete())
	{
		AfxMessageBox("Please enter your settings, username, and password.");
		OnBnClickedConfigure();
		if (!CheckIfSettingsComplete())
		{
			return;
		}
	}

	CSendDlg send_dlg;
	if (send_dlg.DoModal() != IDOK)
	{
		return;
	}
		
	SaveBitmap(m_ctlPict.GetBitmap());

	CbtnetscApp* pApp = (CbtnetscApp*) AfxGetApp();

	// GET THE JPEG FILE INTO MEMORY
	std::ifstream jpeg_file;


	jpeg_file.open(get_temp_file_path(), std::ios::binary);
	if (!jpeg_file.is_open())
	{
		AfxMessageBox (get_temp_file_path() + " not found.");
		return;
	}
	jpeg_file.seekg (0, std::ios::end);
	int jpeg_file_size = jpeg_file.tellg();
	unsigned char* jpeg_file_buffer = new unsigned char[jpeg_file_size];
	jpeg_file.seekg (0, std::ios::beg);
	jpeg_file.read((char*)jpeg_file_buffer,jpeg_file_size);


	// sorry about the mixture of STL strings and MFC strings...
	CString email = "";

	// Format the email embedded into the request
	email += "From: $.$FROM$.$\r\n";
	email += "To: BugTracker.NET\r\n";
	email += "Subject: $.$SUBJECT$.$\r\n";
	email += "MIME-Version: 1.0\r\n";
	email += "Content-Type: multipart/mixed;\r\n";
	email += "\tboundary=\"----=...my_boundary..........\"\r\n\r\n";

	email += "This is a multi-part message in MIME format.\r\n\r\n";

	email += "------=...my_boundary..........\r\n";

	// Body
	email += "Content-Type: text/plain;\r\n\tcharset=\"iso-8859-1\"\r\n";
	email += "Content-Transfer-Encoding: 7bit\r\n\r\n";

	email += "$.$BODY$.$\r\n";
	email += "------=...my_boundary..........\r\n";

	// Attachment
	email += "Content-Type: image/jpeg;\r\n\tname=\"screen_capture.jpeg\"\r\n";
	email += "Content-Transfer-Encoding: base64\r\n";
	email += "Content-Disposition: attachment;\r\n\tfilename=\"screen_capture.jpeg\"\r\n\r\n";
	email += "$.$JPEG$.$\r\n\r\n";
	email += "------=...my_boundary..........--\r\n";
	//AfxMessageBox(email);

	// Replace the variables in the email
	std::string base64_jpeg = base64_encode(
		jpeg_file_buffer,jpeg_file_size);
	email.Replace("$.$FROM$.$",pApp->m_strEmail);
	email.Replace("$.$SUBJECT$.$",send_dlg.m_strDesc);
	email.Replace("$.$BODY$.$", send_dlg.m_strComment);
	email.Replace("$.$JPEG$.$",base64_jpeg.c_str());

	CString strUrl = pApp->m_strUrl;
	strUrl.Replace("HTTP://","");
	strUrl.Replace("http://","");
	int pos = strUrl.Find("/");
	CString strHostPart = strUrl.Left(pos);
	int nUrlLen = strUrl.GetLength();
	CString strUrlPart = strUrl.Right(nUrlLen-pos);

	// Create the HTTP POST request
	std::string msg = "POST ";
	msg += strUrlPart;
	msg += "\r\n";
	msg += "Content-Type: application/x-www-form-urlencoded\r\n";

	// Format the content of the HTTP request
	CString content = "";
	content += "username=";
	content += url_encode(std::string(pApp->m_strUsername)).c_str();
	content += "&password=";
	content += url_encode(std::string(this->m_strPassword)).c_str();
	content += "&from=" ;
	content += url_encode(std::string(pApp->m_strEmail)).c_str();
	content += "&short_desc=" ;
	content += url_encode(std::string(send_dlg.m_strDesc)).c_str();
	content += "&projectid=" ;
	content += url_encode(std::string(pApp->m_strProject)).c_str();
	content += "&message=";
	content += url_encode(std::string(email)).c_str();
	content += "&foo=bar";

	// calculate the Content-Length;
	msg += "Content-Length: ";
	char int_buf[20];
	msg += itoa(content.GetLength(), int_buf, 10);
	msg += "\r\n\r\n";
	msg += content;
	msg += "\r\n\r\n";

	delete jpeg_file_buffer;
	jpeg_file.close();

	/*
	std::ofstream request_file;
	request_file.open("c:\\btnetsc_request_file.txt",std::ios::binary);
	request_file << msg.c_str();
	request_file.close();
	*/

	// Send the HTTP request
	AfxSocketInit();
	CTimeOutSocket sock;
	BOOL created = sock.Create();
	sock.SetTimeOut(10000);
	BOOL connected = sock.Connect(
		strHostPart,
		atoi(pApp->m_strPort)); 
	
	if (connected)
	{
		size_t http_request_len = msg.size();
		int sent = sock.Send(msg.c_str(),(int)http_request_len);
			//sock.Receive(
		char buf[2000];

		// Examine the response
		int received = sock.Receive(buf,1024);
		buf[received] = '\0';
		AfxMessageBox(buf);
	}
	else
	{
		AfxMessageBox("Unable to connect to " + strHostPart + " port " + pApp->m_strPort);
	}
	sock.Close();
}

void CbtnetscDlg::OnBnClickedConfigure()
{
	CConfigDlg dlg;
	dlg.DoModal();
	m_strPassword = dlg.m_strPassword;
}

void CbtnetscDlg::OnBnClickedForeground()
{
	CaptureWindow(true);
}

void CbtnetscDlg::OnBnClickedAll()
{
	CaptureWindow(false);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
宅男在线国产精品| 亚洲色图视频网| 日韩av网站在线观看| 欧美日韩免费不卡视频一区二区三区| 一区二区不卡在线视频 午夜欧美不卡在| 99久久国产综合色|国产精品| 国产精品水嫩水嫩| 91首页免费视频| 国产麻豆成人精品| 2023国产一二三区日本精品2022| 韩国三级中文字幕hd久久精品| 中文字幕欧美国产| 在线观看不卡一区| 免费看精品久久片| 国产日韩欧美不卡在线| av午夜精品一区二区三区| 一区二区三区国产豹纹内裤在线| 欧美在线看片a免费观看| 日韩高清不卡在线| 国产视频一区二区在线| 色香蕉成人二区免费| 日韩国产成人精品| 国产精品色一区二区三区| 欧洲av一区二区嗯嗯嗯啊| 青娱乐精品在线视频| 欧美激情一区二区三区全黄| 91视频观看视频| 青青草国产精品亚洲专区无| 国产精品天美传媒沈樵| 欧美日韩成人在线| 国产高清成人在线| 午夜久久福利影院| 国产精品乱人伦中文| 欧美一区二区三区免费视频| 成人动漫在线一区| 久久国产尿小便嘘嘘| 日韩码欧中文字| 日韩精品自拍偷拍| 在线免费观看成人短视频| 激情综合网天天干| 亚洲乱码中文字幕综合| 精品久久久久久久人人人人传媒 | 不卡av免费在线观看| 亚洲免费观看高清| 日韩免费一区二区三区在线播放| 成人av电影在线| 精品一区二区影视| 亚洲最快最全在线视频| 日本一区免费视频| 欧美成人女星排行榜| 欧美在线一二三| 成人激情视频网站| 精品一区二区三区欧美| 亚洲国产综合人成综合网站| 国产精品青草综合久久久久99| 欧美大黄免费观看| 欧美午夜宅男影院| 91久久精品一区二区| 国产91丝袜在线18| 狠狠色综合日日| 免费欧美在线视频| 视频一区欧美日韩| 亚洲高清在线视频| 亚洲综合一二三区| 亚洲精品菠萝久久久久久久| 国产精品网站一区| 国产精品欧美经典| 国产精品无遮挡| 国产日韩欧美一区二区三区综合| 欧美xxxxx牲另类人与| 欧美一区日本一区韩国一区| 在线不卡a资源高清| 欧美日韩夫妻久久| 欧美一区二区视频网站| 欧美日韩精品系列| 亚洲视频资源在线| 国产精品乱子久久久久| 中文字幕电影一区| 国产精品成人免费精品自在线观看| 久久亚洲精精品中文字幕早川悠里| 欧美一卡二卡三卡四卡| 日韩欧美国产综合在线一区二区三区 | 在线亚洲+欧美+日本专区| 99re视频精品| 一本色道亚洲精品aⅴ| 欧洲精品一区二区三区在线观看| 91麻豆swag| 欧美偷拍一区二区| 91麻豆精品国产91久久久久久久久 | 色综合天天综合色综合av | 亚洲最新视频在线观看| 伊人一区二区三区| 亚洲成人1区2区| 日本亚洲最大的色成网站www| 日韩国产精品大片| 久久狠狠亚洲综合| 国产精品白丝av| av亚洲精华国产精华精华| 97国产一区二区| 欧美日韩高清一区二区三区| 日韩精品最新网址| 国产精品色哟哟网站| 一区二区免费在线| 蜜臀国产一区二区三区在线播放| 国产一区二区中文字幕| 99久久伊人精品| 欧美男生操女生| 久久视频一区二区| 亚洲精品视频在线观看网站| 日日噜噜夜夜狠狠视频欧美人 | 成人免费视频播放| 欧美伊人精品成人久久综合97| 日韩女优av电影在线观看| 国产欧美精品一区aⅴ影院 | 国产精品网友自拍| 亚洲成精国产精品女| 国产福利91精品一区| 欧美偷拍一区二区| 日本一区二区三区电影| 亚洲成在线观看| 国产a久久麻豆| 欧美日韩免费不卡视频一区二区三区| 亚洲精品一区二区三区99| 亚洲欧美偷拍卡通变态| 免费观看久久久4p| 91免费版pro下载短视频| 日韩欧美国产一区二区在线播放| 亚洲视频在线观看一区| 国产一区不卡精品| 欧美性xxxxx极品少妇| 国产精品水嫩水嫩| 美女网站色91| 欧美在线免费观看亚洲| 日本一区二区动态图| 麻豆精品久久精品色综合| 91免费视频网址| 国产偷国产偷亚洲高清人白洁 | 日韩精品一区二区三区四区视频 | 亚洲一级二级在线| kk眼镜猥琐国模调教系列一区二区| 91麻豆精品国产自产在线| 一区二区三区中文字幕电影| 国产一区在线视频| 日韩免费看网站| 偷窥国产亚洲免费视频| 91麻豆免费视频| 国产偷v国产偷v亚洲高清| 另类小说综合欧美亚洲| 欧美日韩一级二级| 一区二区三区自拍| 99re热这里只有精品视频| 久久久久国产精品人| 久久91精品国产91久久小草 | 99精品国产热久久91蜜凸| www精品美女久久久tv| 日本v片在线高清不卡在线观看| 91麻豆精东视频| 亚洲精选在线视频| 99国产欧美另类久久久精品| 国产精品天干天干在观线| 久久精品国产秦先生| 欧美丰满少妇xxxxx高潮对白| 一区二区三区欧美日| 在线视频欧美精品| 亚洲一区二区视频在线观看| 91国产成人在线| 夜色激情一区二区| 欧美日本在线播放| 午夜激情一区二区三区| 欧洲精品在线观看| 亚洲国产精品一区二区www在线 | 日韩一本二本av| 久久国产精品一区二区| 久久影院午夜论| 国产成+人+日韩+欧美+亚洲| 国产午夜亚洲精品午夜鲁丝片| 国产成人一区在线| 国产精品久久久久影院色老大| 99国产精品久久久久久久久久久 | 亚洲福中文字幕伊人影院| 欧美欧美午夜aⅴ在线观看| 亚洲电影第三页| 91精品国产91热久久久做人人 | 91麻豆精品国产自产在线观看一区| 日韩电影网1区2区| 日韩欧美国产1| 国产成人久久精品77777最新版本| 国产精品国产a级| 欧美综合色免费| 美国毛片一区二区| 国产色一区二区| 一本色道久久综合精品竹菊| 亚洲国产一区视频| 日韩你懂的在线观看| 成人激情视频网站| 亚洲18色成人| 国产人成一区二区三区影院| 一本色道亚洲精品aⅴ| 日韩精品乱码av一区二区| 久久一留热品黄|