原创 結構體類型數組int成員變量求和函數

struct stru1 { int a; float b; int c; int d; }; struct stru2 { int a; char b[100]; int c; stru1 d; }; struct

原创 TAlpha類的灰色浮雕處理函數GrayEmboss_1000

//灰色浮雕[maxwidth:1000] void TAlpha::GrayEmboss_1000(byte &r, byte &g, byte &b, byte &a, int x, int y, int width, int hei

原创 [轉]理解EnterCriticalSection 臨界區

通俗解釋就像上廁所: 門鎖了,就等着,等到別人出來了,進去鎖上,然後該幹什麼幹什麼,幹完了,把門打開 門沒鎖,就進去,鎖上,然後該幹什麼幹什麼,幹完了,把門打開 -----------------------------------

原创 [轉]絕對絕對不要TerminateThread

聽過無數次不要TerminateThread,只是工作中常用,貌似也沒有什麼問題。今天在高強度測試中發現了一個不可原諒的錯誤。參看下面的例子   DWORD __stdcall mythread(void* ) {     while

原创 MDI切換到上次顯示的子窗口

void __fastcall TMainBuilder::mnuWindow_LastVisitedClick(TObject *Sender) { const HWND hwnd = m_hLastActiveChild; if

原创 鏈表宏

#define Destroy(_p) {if (((layer_type *)(_p))->Canvas != NULL) delete[] ((layer_type *)(_p))->Canvas; free(_p);} #de

原创 一維二維數組共用一次new

優化前 //非共用的 int Height; ... const int COL = 3; int *dgree = new int[Height]; byte *grgb = new byte[Height * COL]; ...

原创 c++類模板特例化

#include <iostream> #include <typeinfo> using namespace std; template <typename T1, typename T2, typename T3> class A

原创 內聯彙編優化的TAlpha::FillSolidColor

#ifndef __GNUC__ #define _calpha_using_inlineasm_ 1 #else #define _calpha_using_gccinlineasm_ 1 #ifdef _calp

原创 嵌套優化版括號匹配檢查

       設置三個計數器初值設爲零,分別記錄小括號、中括號、大括號。開始進行第一次掃描,從左向右依次掃描每個字符,遇到左括號計數器加一,遇到右括號計數器減一,出現計數器小於零時,報錯退出。掃描結束後,

原创 gcc內聯彙編將結構體成員清零

typedef struct tagstru { int a; int b; int c; }stru; stru sa; sa.a = 0x123; sa.b = 0x456; sa.c = 0x789; pri

原创 void Mask_1 - gcc彙編

void Mask_1(unsigned char * const ptrDestBuffer, const unsigned char * const ptrSrcBuffer, int Width, int Height, int i

原创 [轉]讓程序只運行一個實例的四種方法

  源代碼下載:http://d.download.csdn.net/down/907655/magictong   綜述:讓一個程序只運行一個實例的方法有多種,但是原理都類似,也就是在程序創建前,有窗口的程序在窗口創建前,檢查系統中是

原创 Photoshop馬賽克效果

void _alpha__fastcall_pre_ TAlpha::Mosaic(AlphaPara *Para) { int left; int top; int right = (left = Para->X) + Para-

原创 單圖處理的接口函數 Process_Plus

void TAlpha::Process_Plus(HDC hdc, int X, int Y, int Width, int Height, typeprocess_plus_op_fun_ptr op_fun_ptr, void *f