Time of Update: 2018-12-04
#include <Afxdisp.h>BOOL GetBinaryFromVariant(COleVariant & ovData, BYTE ** ppBuf, unsigned long * pcBufLen){ BOOL fRetVal = FALSE; //Binary data is stored in the variant as an array of unsigned char if(ovData.vt == (VT_ARRAY|VT_UI1)) /
Time of Update: 2018-12-04
CStringArray m_Serial_Port;BOOL Enum_Serial_Port() //枚舉串口{m_Serial_Port.RemoveAll();HKEY hKey;LPCTSTR data_Set = _T("HARDWARE\\DEVICEMAP\\SERIALCOMM\\");LONG ret0 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, data_Set, 0, KEY_READ, &hKey);if(ret0 !=
Time of Update: 2018-12-04
//拷貝pWnd指向的視窗的lpSrcRect到剪貼簿//運行過此程式,可以開啟畫圖進行粘貼測試CopyScreenToClipboard(CWnd *pWnd, CRect *lpSrcRect){if(!IsWindow(pWnd->GetSafeHwnd())){AfxMessageBox("視窗控制代碼無效");return (FALSE);}// first, determine the update region and select itif ( !
Time of Update: 2018-12-04
//拷貝pWnd指向視窗的lpRect部分到檔案Dstfile中(BMP檔案格式)CopyScreenToFile(CWnd *pWnd, CRect *lpRect, LPCTSTR Dstfile){ if(!IsWindow(pWnd->GetSafeHwnd())) { AfxMessageBox("視窗控制代碼無效"); return (FALSE); } CDC *pDC = pWnd->GetDC(); int Width = lpRect->Width(
Time of Update: 2018-12-04
//顯示位元影像//pWnd 顯示視窗指標//rect 顯示地區//bitMapFile 顯示檔案virtual BOOL Draw_Bitmap(CWnd *pWnd,CRect rect,LPCTSTR bitMapFile);virtual BOOL Draw_Bitmap(CWnd *pWnd,CRect rect,UINT IDB_BITMAP) {return(Draw_Bitmap(pWnd,rect,MAKEINTRESOURCE(IDB_BITMAP)));}bool
Time of Update: 2018-12-04
#include <windows.h>#include <tchar.h>typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);LPFN_ISWOW64PROCESS fnIsWow64Process;BOOL IsWow64(){ BOOL bIsWow64 = FALSE; //IsWow64Process is not available on all supported versions of
Time of Update: 2018-12-04
處理簡單的音頻輸入資料SoundIn類見我的另一篇部落格 http://blog.csdn.net/zgl7903/article/details/5669770 #pragma once//Microphone_Measure.h#include "SoundIn.h"class CMicrophone_Measure{public: CMicrophone_Measure(); virtual ~CMicrophone_Measure();public: BOOL
Time of Update: 2018-12-04
typedef struct _THREADINOF{ BOOL *bExitFlag; //退出標誌(共用) HANDLE hExitEvent; //退出事件(共用) HANDLE hRunEvent; //運行事件 HANDLE hDoneEvent; //運行完成事件 BOOL bThreadIsRuning; //線程運行中 UINT uThreadIndex; //線程索引 UINT uTaskID; //任務ID LPCRITICAL_SECTION
Time of Update: 2018-12-04
#include <math.h>//計算階乘double Cal_Factorial(int n){ double fFactorial = 1; for(int i=2; i<=n; i++) fFactorial *= i; return fFactorial;}//貝塞爾實現BOOL _PolyBezier(HDC hDC, //目標DC const POINT* lpPoints, int nCount, //曲線控制點 LPPOINT
Time of Update: 2018-12-04
#include <stdio.h>#include <tchar.h>//WINAPI 拷貝指定的hDC的lpRect部分到檔案Dstfile中(BMP檔案格式)BOOL SaveHDCToFile(HDC hDC, LPRECT lpRect, LPCTSTR Dstfile){ int Width = lpRect->right - lpRect->left; int Height = lpRect->bottom -
Time of Update: 2018-12-04
//關鍵代碼CBitmap * BmpColorMaskOp(CBitmap &bmpSrc, COLORREF colorMask, DWORD dwOp){ //映像資訊 BITMAP bmpInfo; bmpSrc.GetBitmap(&bmpInfo); int nWidth = bmpInfo.bmWidth; int nHeigth = bmpInfo.bmHeight; //建立DC裝置 HDC hDC = CreateDC(_T("DISPLAY"
Time of Update: 2018-12-04
記憶體使用量情況查看類class CMemoryUserge{protected: typedef struct _MEMORYSTATUS_EX { DWORD dwLength; // sizeof(MEMORYSTATUSVLM) DWORD dwMemoryLoad; // percent of memory in use DWORDLONG dwTotalPhys; // bytes of physical
Time of Update: 2018-12-04
#ifndef _tcscpy_s#define _tcscpy_s _tcscpy#endif //_tcscpy_sBOOL SetMenuFont(LPCTSTR szFontName, long PointSize){ NONCLIENTMETRICS cs={sizeof(NONCLIENTMETRICS )}; if( SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(cs), &cs, 0) ) {
Time of Update: 2018-12-04
//#include <math.h>void DrawDashLine(CDC* pDC, LPPOINT ptStart, LPPOINT ptEnd, int nWidht, COLORREF crLine){ CPen pen(PS_DASH, nWidht, crLine); CPen *pOldPen = pDC->SelectObject(&pen); double k = (double)(ptEnd->
Time of Update: 2018-12-04
#include <rpc.h> #include <rpcndr.h> #include <unknwn.h> #include <gdiplus.h> using namespace Gdiplus; #pragma comment(lib, "gdiplus.lib") struct _GdiplusToken { Gdiplus::GdiplusStartupInput gdiplusStartupInput;
Time of Update: 2018-12-04
#include <dbt.h>#include <wtypes.h>#include <sal_supp.h>#include <kernelspecs.h>#include <setupapi.h>extern "C"{#include <hidsdi.h>}#pragma comment(lib,"hid.lib")#pragma comment(lib,"setupapi.lib")BOOL
Time of Update: 2018-12-04
#include <WinSpool.h>#pragma comment(lib, "Winspool.lib")#include <shellapi.h>#pragma comment(lib, "shell32.lib")BOOL OpenDefaultPrinter(){ BOOL bRet = FALSE; DWORD dwSize = 0; if(!GetDefaultPrinter(NULL, &dwSize) &&
Time of Update: 2018-12-04
void FormatErrCodeMessage(LPCTSTR lpszFunction, DWORD dwErrorCode) { // Retrieve the system error message for the error code DWORD dwMaxTCharLen = 32000U; LPTSTR lpDisplayBuf = (LPTSTR)LocalAlloc(LPTR, dwMaxTCharLen*sizeof(TCHAR)); LPTSTR
Time of Update: 2018-12-04
#include <crtdbg.h>#include <OLE2.H>#include <ocidl.h>#include <olectl.h>#include "Shlwapi.h"#include <stdio.h>#pragma comment(lib, "Shlwapi.lib")#ifndef VERIFY#ifdef _DEBUG#define VERIFY _ASSERT#else#define VERIFY(f)
Time of Update: 2018-12-04
#include <tlhelp32.h>void KillProcess_FromName(LPCTSTR name) //name為你要終止的進程的名稱,Win9X則需包括路徑 { CString fileName = name; fileName.MakeLower(); //轉為小寫 HANDLE hShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); // 建立快照控制代碼 PROCESSENTRY32