#define MAKEADSENTRY(x)  &IID_##x, _T(#x) 
#define ADDADSERROR(x)   x, _T(#x)
#define DECLAREADSPROC(x) void DlgProc##x(LPUNKNOWN, LPUNKNOWN *ppNew=NULL); \
void DlgProc##x(LPUNKNOWN pUnk, LPUNKNOWN *ppNew) { CDlg##x dlg( pUnk); dlg.DoModal(); }
里##的作用是什么呢?

解决方案 »

  1.   

    It permits separate tokens to be joined into a single token 
    例如:
    #define paster( n ) printf( "token" #n " = %d", token##n )

    paster( 9 );
    等同于
    printf( "token9 = %d", token9 );
      

  2.   

    Token-Pasting Operator (##)
    The double-number-sign or “token-pasting” operator (##), which is sometimes called the “merging” operator, is used in both object-like and function-like macros. It permits separate tokens to be joined into a single token and therefore cannot be the first or last token in the macro definition.If a formal parameter in a macro definition is preceded or followed by the token-pasting operator, the formal parameter is immediately replaced by the unexpanded actual argument. Macro expansion is not performed on the argument prior to replacement. Then, each occurrence of the token-pasting operator in token-string is removed, and the tokens preceding and following it are concatenated. The resulting token must be a valid token. If it is, the token is scanned for possible replacement if it represents a macro name. The identifier represents the name by which the concatenated tokens will be known in the program before replacement. Each token represents a token defined elsewhere, either within the program or on the compiler command line. White space preceding or following the operator is optional.This example illustrates use of both the stringizing and token-pasting operators in specifying program output:#define paster( n ) printf( "token" #n " = %d", token##n )
    int token9 = 9;If a macro is called with a numeric argument likepaster( 9 );the macro yieldsprintf( "token" "9" " = %d", token9 );which becomesprintf( "token9 = %d", token9 );
    --------------------------------------------------------------------------------
    Send feedback to MSDN.Look here for MSDN Online resources.
      

  3.   

    ##是把两个字符串连接起来#define ss(a)  a##1用时
    int ss(MYVar);
    在程序中会产生这样一个变量
    MyVar1,是int型的
      

  4.   

    ##就是连接符嘛!动态连接字符串的。
    注意##只能在宏中使用,否则会出错
    如:print("%d",token##n);  -----error!
      

  5.   

    一个是连接字符串
    两个是连接token
    字符串!=token