VC学习:记录2

IDC_ Control
IDD_ Dialog
IDS_ String
IDM_ Menu
IDR_ Resource
IDB_ Bitmap

HDN:Header Notify
LVN:ListView control Notify
NM:Notify Message
TVN:TreeView control Notify

AfxGetApp()得到进程指针

_tmain是为了支持unicode定义的,其实本质就是main,编译之后就变成main了。
Winmain是windows程序进入点。

Control + e可以回到括号对应
Alt + F8可以自动对齐排版,但是根据尝试,在vs2010下,只能自动对齐选中区域,且以选中区域上面的语句作为标准。

Q: 如何用系统查找功能来查找指定文件?
ShellExecute(m_hWnd,“find”,“d:\nish”,NULL,NULL,SW_SHOW);

Q: 如何启动一个程序,直到它运行结束?
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = “c:\MyProgram.exe”;
ShExecInfo.lpParameters = “”;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
或:
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo; //This is an [in] parameter
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
StartupInfo.cb = sizeof StartupInfo ; //Only compulsory field
if(CreateProcess(“c:\winnt\notepad.exe”, NULL,
NULL,NULL,FALSE,0,NULL,
NULL,&StartupInfo,&ProcessInfo))
{
WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
}
else
{
MessageBox(“The process could not be started…”);
}

获得当前路径:
char *_getcwd(char *buffer, int maxlen); //ANSI版本
wchar_t *_wgetcwd(wchar_t *buffer, int maxlen ); //Unicode版本

使用CFile读文件,使用char* Buf = new char[num]时,num要是open的文件的getlength的长度加一,然后再把最后一位手动赋值’\0’,要不最后会有乱码

发布了9 篇原创文章 · 获赞 0 · 访问量 105

猜你喜欢

转载自blog.csdn.net/qichunhao/article/details/104001747
今日推荐