BYTE 和 COleVariant 相互轉換

#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)) /

通過註冊表枚舉串口

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 !=

拷貝pWnd指向的視窗的指定地區到剪貼簿

 //拷貝pWnd指向的視窗的lpSrcRect到剪貼簿//運行過此程式,可以開啟畫圖進行粘貼測試CopyScreenToClipboard(CWnd *pWnd, CRect *lpSrcRect){if(!IsWindow(pWnd->GetSafeHwnd())){AfxMessageBox("視窗控制代碼無效");return (FALSE);}// first, determine the update region and select itif ( !

拷貝pWnd指向視窗的lpRect部分 寫成BMP檔案

//拷貝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(

在指定的視窗指定的地區繪製指定的BMP圖片

 //顯示位元影像//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

檢測當前Process是否是64位進程

#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

簡單處理音頻輸入資料的類

處理簡單的音頻輸入資料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

多線程完成多個任務

  typedef struct _THREADINOF{ BOOL *bExitFlag; //退出標誌(共用) HANDLE hExitEvent; //退出事件(共用) HANDLE hRunEvent; //運行事件 HANDLE hDoneEvent; //運行完成事件 BOOL bThreadIsRuning; //線程運行中 UINT uThreadIndex; //線程索引 UINT uTaskID; //任務ID LPCRITICAL_SECTION

貝茲路徑繪製

   #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

WINAPI 拷貝指定的hDC的lpRect部分到檔案Dstfile中(BMP檔案格式)

 #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 -

圖片顏色掩碼操作

 //關鍵代碼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"

記憶體使用量情況查看類

 記憶體使用量情況查看類class CMemoryUserge{protected: typedef struct _MEMORYSTATUS_EX { DWORD dwLength; // sizeof(MEMORYSTATUSVLM) DWORD dwMemoryLoad; // percent of memory in use DWORDLONG dwTotalPhys; // bytes of physical

修改系統功能表字型和大小

  #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) ) {

使用演算法實現線寬不為1的 Dash Line

//#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->

GDI+ 儲存指定的視窗為JPEG檔案(X Y軸鏡像功能可選)

 #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;

枚舉匹配VID PID的 HID裝置,並返回裝置路徑

  #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

SHInvokePrinterCommand 開啟印表機

 #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) &&

FormatMessage 格式化 GetLastError 擷取的錯誤碼

 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

OleLoadPicture 在指定視窗上繪製

  #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)

從名稱結束進程

#include <tlhelp32.h>void KillProcess_FromName(LPCTSTR name) //name為你要終止的進程的名稱,Win9X則需包括路徑 {   CString fileName = name;  fileName.MakeLower(); //轉為小寫   HANDLE hShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);  // 建立快照控制代碼   PROCESSENTRY32

總頁數: 61357 1 .... 17741 17742 17743 17744 17745 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.