zoukankan      html  css  js  c++  java
  • MyMacro

    #define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
    #define JIF(x) if (FAILED(hr=(x))) /
    {Msg(TEXT("FAILED(hr=0x%x) in ") TEXT(#x) TEXT("/n"), hr); return FALSE;}

    inline void Msg(char *szFormat, ...)
    {
    TCHAR szBuffer[512]; // Large buffer for very long filenames (like with HTTP)

    va_list pArgs;
    va_start(pArgs, szFormat);
    vsprintf(szBuffer, szFormat, pArgs);
    va_end(pArgs);
    MessageBox(NULL, szBuffer, "CVideoRenderer", MB_OK);
    }



    #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } }
    #define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } }

    #define SAFE_RELEASE_DELETE(p) { if (p) { (p)->Release(); delete (p); (p)=NULL; } }
    #define ERMSG(x) MessageBox(hWnd, x, "DirectDraw Samplee", MB_OK);
    #define ERR_MSG(err, msg) {if (err==hr) {AfxMessageBox(msg);}}
    #define ERR_TRACE(err, msg) {if (err==hr) {TRACE("/r/n");TRACE(msg);}}
    #define TRACE_POINT(pt, name) {CString strMsg; strMsg.Format("/r/n%sPT = (%d,%d)", name, pt.x, pt.y);TRACE(strMsg);};
    #define TRACE_RECT(rc, name) {CString strMsg; strMsg.Format("/r/n%sRECT<t=%d,l=%d,b=%d,r=%d>", name, rc.top, rc.left, rc.bottom, rc.right);TRACE(strMsg);};

    #define TRACE_DWORD(d, name) {CString strMsg; strMsg.Format("/r/n%sPT = %d", name, d);TRACE(strMsg);};
    #define NUM_PROTECT(num, minl, maxl) {if (num>maxl){num=maxl;} if (num<minl){num=minl;} };

    #define PUSHHANDLE m_vecHandle.push_back(m_pCurHandle);
    #define DC_FHANDLE(pDC, hDC) {CMainFrame *pFrame = (CMainFrame *)AfxGetApp()->GetMainWnd(); pDC = CDC::FromHandle(pFrame->hDC);}

    #define XYWH int x, int y, int nWidth, int Height
    #define SAFE_DELETE(p) {if (p!=NULL){delete p; p=NULL;}}

    #define PUSHHANDLE(ph) {m_pCurHandle = ph;m_vecHandle.push_back(m_pCurHandle);}



    // 02

    #define TRACE_DWORD02(d) CString TRACE_DWORD02_OUTPUT; {TRACE_DWORD02_OUTPUT += _T("/r/n"); CString strMsg; strMsg=#d; TRACE_DWORD02_OUTPUT += strMsg; strMsg.Format(_T(" = %d"), d); TRACE_DWORD02_OUTPUT += strMsg; TRACE(TRACE_DWORD02_OUTPUT);}



    // 数学运算代码宏

    #define PI 3.1415926535
    #define RADIAN(angle) ((angle)*PI/180.0) //角度到弧度转化的宏



    // windows 操作代码宏

    //取应用程序主窗口句柄 需要先定义 HWND ParentWnd, glhTargetWnd;并对 glhTargetWnd 赋值,ParentWnd就是程序主窗口句柄
    #define GET_EXE_MAIN_HWND(ParentWnd, glhTargetWnd) /
    { /
    ParentWnd=glhTargetWnd; /
    while (ParentWnd !=NULL) /
    { /
    glhTargetWnd=ParentWnd; /
    ParentWnd=GetParent(glhTargetWnd); /
    } /
    } /



    #ifndef LASTMSGBOXINFOLIBAPI
    #define LASTMSGBOXINFOLIBAPI extern "C" __declspec(dllimport)
    #endif
  • 相关阅读:
    新浪微博 js 解密
    新浪微博、qq rsa密码加密c#实现
    C#版本的discuz authcode函数
    搬地方了,在github弄了个新博客
    python 发送邮件
    通用网页广告监测,ADBlock plus算法的C#实现。
    58同城登录 c#,非直接操作js
    python模块之smtplib: 用python发送SSL/TLS安全邮件
    Python少打字小技巧
    python模块之poplib: 用pop3收取邮件
  • 原文地址:https://www.cnblogs.com/carl2380/p/2317346.html
Copyright © 2011-2022 走看看