- 博客(14)
- 收藏
- 关注
原创 事件对象实现线程同步
#include #include DWORD WINAPI Fun1Proc( LPVOID lpParameter // thread data);DWORD WINAPI Fun2Proc( LPVOID lpParameter // thread data);int tickets=100;HANDLE g_hEvent;void mai
2016-04-29 21:57:59
299
原创 进程通信_剪贴板
void CClipboardDlg::OnBtnSend() { // TODO: Add your control notification handler code here if(OpenClipboard()) { CString str; HANDLE hClip; char *pBuf; EmptyClipboard(); GetDlgI
2016-04-29 21:55:44
286
原创 进程通信_匿名管道
服务器端:void CParentView::OnPipeCreate() { // TODO: Add your command handler code here SECURITY_ATTRIBUTES sa; sa.bInheritHandle=TRUE; sa.lpSecurityDescriptor=NULL; sa.nLength=sizeof(SECURI
2016-04-29 21:53:46
280
原创 拷贝构造函数与赋值构造函数
#include#includeusing namespace std;class String{private: char *m_data;public: String(const char *str); String(const String &other); String & operator=(const String &other); ~Str
2016-04-29 21:48:24
215
转载 关键代码段(临界区)实现线程死锁
#include #include DWORD WINAPI Fun1Proc( LPVOID lpParameter // thread data);DWORD WINAPI Fun2Proc( LPVOID lpParameter // thread data);int tickets=100;CRITICAL_SECTION g_csA;C
2016-04-29 21:46:54
671
原创 操作符重载及友元函数
#includeusing namespace std;class Students{private: int age; int weigth;public: Students(); Students(int age,int weigth); Students operator+(const Students &stu) const; friend vo
2016-04-29 20:06:58
325
原创 istringstream用法
//istringstream对象可以绑定一行字符串,然后以空格为分隔符把该行分隔开来#include#include#include//头文件using namespace std;void main(){ string str; while(getline(cin,str)) { std::istringstream tmpStream(str);
2016-04-29 20:04:12
467
原创 Android手机震动
package com.example.vibrate;import android.app.Activity;import android.app.Service;import android.os.Bundle;import android.os.Vibrator;import android.view.Menu;import android.view.MenuItem
2016-04-29 20:00:47
347
原创 查找某一目录下的所有文件名
#include#include#include#include#includeusing namespace std;vector pathList;void GetFilePath(string path){ struct _finddata_t fileInfo; long hFile = 0; string fileName; string
2016-04-29 19:56:44
525
原创 CArchive类基本读写
#include#includeusing namespace std;void ArchiveRead(){ CFile file("C:\\Users\\Administrator\\Desktop\\test.txt",CFile::modeRead); CArchive ar(&file,CArchive::load); int i; char ch;
2016-04-29 19:53:41
1048
原创 C++中多字节与双字节的字符的转换
#include#include#includeusing namespace std;void c2w(const char *pchar, wchar_t *pwchar,int len){ int clen = strlen(pchar) + 1; int wclen = MultiByteToWideChar(0,0,pchar,clen,NULL,0);
2016-04-29 19:51:17
2487
原创 配置文件的读写
#include#includeusing namespace std;typedef struct school{ char name[20]; int time;};void main(){ char *filePath = "C:\\Users\\Administrator\\Desktop\\config.ini"; int age; cha
2016-04-29 19:45:54
274
原创 简单Win32程序示例
#include#includeLRESULT CALLBACK MyWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ switch(uMsg) { case WM_LBUTTONDBLCLK: MessageBox(hWnd,"dbClick","",MB_YESNO); case WM_L
2016-04-29 19:36:01
511
翻译 String中的assign函数
string &assign(const char *s);用c类型字符串s赋值 string &assign(const char *s,int n);用c字符串s开始的n个字符赋值 string &assign(const string &s);把字符串s赋给当前字符串 string &assign(int n,char c);用n个字符c赋值给当前字符串 st
2016-04-29 19:24:37
3645
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人