DWORD dwError=GetLastError();
  char szError[260];
  FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
                NULL,dwError,MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
                szError,sizeof(szError),NULL);
  AfxMessageBox(szError);
多检查几次,看看是不是hPass句柄根本没得到,NULL吧

解决方案 »

  1.   

    If the point is over a static text control, the return value is a handle to the window under the static text control. 
    WindowFromPoint函数获得的是edit后面的窗口句柄!!!!
      

  2.   

    HWND hWndParent = ::WindowFromPoint(szPoint);
    HWND hPassReal  = ::ChildWindowFromPoint(hWndParent, szPoint);SendMessage(hPassReal......)
      

  3.   

    GetLastError();的结果是"操作成功完成"
      

  4.   

    多谢这位兄弟支持。已经搞定,原因竟然是char *szBuffer;这句身上。
    改成char szBuffer[255];就行,原因不知道,而且在BCB中却运行正常。不明白分儿送上。