谁说"参数2 应是指向字符串缓冲区的指针"?哪个Win32SDK是这样介绍的?
就是cardinal类型.Win32SDK里面写的是UINT类型!就是DWORD

解决方案 »

  1.   

    不是Delphi的BUG,是你对Windows SDK了解不透彻。
    最简单的方法就是将指针强制转化为Integer,这样就可以了。
    至于为什么,兴许经过几年的钻研,你就明白了。
      

  2.   

    An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller. WM_GETTEXT  
    wParam = (WPARAM) cchTextMax;   // number of characters to copy 
    lParam = (LPARAM) lpszText;     // address of buffer for text 
     ParameterscchTextMaxValue of wParam. Specifies the maximum number of characters to be copied, including the terminating null character. lpszTextValue of lParam. Points to the buffer that is to receive the text. 
    以上是SDK 原文,请仔细看啊。
      

  3.   

    非bug,参看函数原型:
    LRESULT SendMessage(
      HWND hWnd,      // handle to destination window
      UINT Msg,       // message
      WPARAM wParam,  // first message parameter
      LPARAM lParam   // second message parameter
    );
    其中,
    LPARAM:   A 32-bit value passed as a parameter to a window procedure or callback function.
    WPARAM:   A value passed as a parameter to a window procedure or callback function: 16 bits on Windows versions 3.0 and 3.1; 32 bits on Win32.在Delphi6里,这两个类型都用Integer来表达。
      

  4.   

    Integer和Pointer两个长度恰好都是32bit,所以只要强制类型转化就可以了。
    所以SDK的描述是正确的,并没有错误。
    如果不相信,可以到Messages单元看看,TMessage和TWMGetText表达的数据结构完全相同,但是内部结构却不一样。慢慢体会吧。