创建 多级目录 Created Multiple Directory
admin | C++ | 2013-08-20
C++
#include <direct.h>
#include <vector>
#include <string>
using namespace std;
bool CreatedMultipleDirectory( char* direct)
{
string Directoryname = direct;
if ( Directoryname[Directoryname.length() - 1] != '//' && Directoryname[Directoryname.length() - 1] != ... [阅读全文]
curl_easy_perform 返回值说明
admin | C++ | 2013-08-19
response=curl_easy_perform(curl);
response返回的状态值
CURLE_OK: printf(“send ok!\n”);
CURLE_HTTP_POST_ERROR: printf(“post error!\n”);
CURLE_COULDNT_CONNECT: printf(“cannot connect to server\n”);
CURLE_OK = 0, 0: no error
CURLE_UNSUPPORTED_PROTOCOL, 1: unsupported protocol
CURLE_FAILED_INIT... [阅读全文]
curl_easy_setopt函数介绍
admin | C++ | 2013-08-19
本节主要介绍curl_easy_setopt中跟http相关的参数。注意本节的阐述都是以libcurl作为主体,其它为客体来阐述的。
1. CURLOPT_URL
设置访问URL
2. CURLOPT_WRITEFUNCTION,CURLOPT_WRITEDATA
回调函数原型为:size_t function( void *ptr, size_t size, size_t nmemb, void *stream); 函数将在libcurl接收到数据后被调用,因此函数多做数据保... [阅读全文]
CString to wchar_t* to char*
admin | win32 | 2013-08-15
C++
CString str;
UpdateData(true);
str = "EditTEXT文本";
//EditTEXT.GetWindowText(str1);
int strLength = str.GetLength() ;
//CString to wchar_t*
wchar_t *wCharString =new wchar_t(strLength +1);
wmemset(wCharString,'\0',sizeof(wCharString));
wCharString = str.GetBuffer(str.GetLength());
str.R... [阅读全文]
win32 使用 SetTimer
admin | win32 | 2013-08-12
C++
#include <windows.h>
#include<iostream>
using namespace std;
void CALLBACK TimerProc(HWND hWnd, UINT nMsg, UINT nIDEvent, DWORD dwTime)
{
cout<<"这里就是原来的ONTIMER函数"<<dwTime<<endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
SetTimer(NULL, 1, 1000, T... [阅读全文]
boost::signals, libsig++, Qt/signal/slot
admin | win32 | 2013-08-05
C++
这三个库都实现了信号与插槽的概念,其中Qt的signal/slot机制最为完善。
libsig++被应用于基于Gtk+的gtkmm中,boost::signals很多的借鉴了libsig++的思想。
在boost::signals中,里面是用boost::function对象记录slot的,如果是实现一对一的"回调",则还是直接使用boost:function快,如果是一对多(一个signal对应多个s... [阅读全文]
VC关于置顶窗口的方法小结
admin | C++ | 2013-07-29
C++
将窗体置顶的方法有:
//将窗体置顶的API函数
::SetWindowPos(m_hWndTop,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
//MFC
pDlg->SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
说明:
&CWnd::wndTopMost 是当前的最顶层窗口,调用函数,会把m_hWndTop或pDlg 置于&CWnd::... [阅读全文]
wchar_t* To std::string
admin | win32 | 2013-07-18
C++
bool wcharToString(IN wchar_t* wText, OUT string& str)
{
//WideCharToMultiByte的运用
DWORD dwNum = WideCharToMultiByte(CP_OEMCP,NULL,wText,-1,NULL,0,NULL,FALSE);
//psText为char*的临时数组,作为赋值给std::string的中间变量
char *psText;
psText = new char[dwNum];
// WideCharToMultiB... [阅读全文]
C++ 判断网络是否通畅
admin | win32 | 2013-07-13
C++
//InternetCheckConnection 有时不准确
//http://bbs.csdn.net/topics/90171586
#include "stdafx.h"
#include <Windows.h>
#include <Wininet.h>
#include <atlstr.h>
#pragma comment(lib,"Wininet")
//检查网络是否通畅
bool CheckNet(CString& url)
{
HINTERNET hSession, hFile, hR... [阅读全文]