随笔分类 - [03]Windows编程
摘要:#include "mmsystem.h"#pragma comment(lib,"winmm.lib") ::PlaySound(strAppPath, NULL, SND_ASYNC | SND_NOWAIT); // strAppPath为音频的路径PlaySound函数的声明为:BOOL PlaySound(LPCSTR pszSound, HMODULE hmod,DWORD fdwSound);参数pszSound是指定了要播放声音的字符串,该参数可以是WAVE文件的名字,或是WAV资源的名字,或是内存中声音数据的指针,或是在系统注册表WIN.INI中定义的系统事件声音。如果该参数
阅读全文
摘要:环境VC6.0 MFC某些时候我们需要在系统关机的时候进行相应的处理。在某个窗口添加窗口过程函数LRESULT CMyDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {// TODO: Add your specialized code here and/or call the base class if ( message ...
阅读全文
摘要:环境 VC6.0代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--#include"windows.h"SERVICE_STATUSgSvcStatus;//服务状态SERVICE_STATUS_HANDLEgSvcStatusHandle;//服...
阅读全文
摘要:环境 VC6.0 代码 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--#include"windows.h"#defineSVC_ERROR((DWORD)0xC0020001L)voidWriteReportEvent(LPTSTRszName,L...
阅读全文
摘要:编译环境VC UNICODE在VC中采用ShellExecute打开网页总是那么不保险,经常会因为某些原因打不开网页,所以做过多种尝试,我认为这个方法比较可靠。链接地址:/Files/pbreak/OpenHtml.rar主要代码:////////////////////////////////////////////////////////////////// 说明: 利用默认浏览器打开网页//...
阅读全文
摘要:#include <LMACCESS.H>#include <LMERR.H>#include <LMAPIBUF.H>#include <iostream>#include <vector>using namespace std;vector<CString> m_account;GetOSUserName(){ LPUS...
阅读全文
摘要:我们平时会遇到要知道是否有存储设备的插入的情况,以下提供两种方法:第一种方法: 在MFC中为开口添加WindowProc消息相应函数,例如: LRESULT CMyDlgDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { ...
阅读全文
摘要:判断Windows密码是否为空 先以账户,任意密码输入LogonUser函数,如果Windows密码为空,那么会返回错误号:1327HANDLE token;if ( !LogonUser (strUserName.GetBuffer(0) , _T(".") , strPWD.GetBuffer(0),LOGON32_LOGON_INTERACTIVE , LOGON32_PROVIDER_DE...
阅读全文
摘要:long myProject::Convert2To10(CString strBuff){ long num = 0, sum = 0; int nLen = strBuff.GetLength(); for ( int i = 0; i < nLen; i++ ) { num = ( strBuff.GetAt(i) - 48 ); num = num * (long...
阅读全文
摘要:CString myProject::Convert16To2(CString strSource){ //转换成大写字母 strSource.MakeUpper(); CString strDest; for( int i = 0;i < strSource.GetLength();i++ ) { if(strSource.GetAt(i) == '0') str...
阅读全文
摘要://unicode编码下 HKEY hregkey; DWORD dwReturnValue = 0; CString strEnvironmentPath(_T("")); //环境变量值 TCHAR chsys[MAX_PATH] = {0}; CString sSysCh; GetSystemDirectory( chsys , sizeof(chsys) ); //获取系统盘盘...
阅读全文
摘要:#include "stdafx.h"#include <iostream.h>#include <string>#include <vector>#include "windows.h"using namespace std;//命令行输出缓冲大小const long MAX_COMMAND_SIZE = 10000;//获取MAC命令行char szFetC...
阅读全文

浙公网安备 33010602011771号