我做了一个在主窗口里使用DLL中的窗口,用appevents控件来把主窗口的消息传给DLL窗口中,其它的按钮都正常。但是发现在MEMO控件中,无法输入回车了。不知道如何解决。

解决方案 »

  1.   

    重新弄一个窗口带个Memo,是否可以使用回车?
      

  2.   

    原因可能有很多。
    先確認dll窗體上的其他控件是否可正常接受 回車,若不能,則有可能是dllform設定keypreview 為 true,且處理掉了...
      

  3.   

    application 和 parentwindow 都已经在DLL中重新设置了。把DLL中的form单独发到一个执行程序中是可以输入回车的。我估计可能是window消息处理上存在问题。Dll与主程序的数据传递与控制,我是用接口和虚类来实现的。
      

  4.   

    我准备直接使用API来控制DLL中的form试试,希望各位大虾,给点建议。
      

  5.   

    很怪。keydown中可以看到回车键返回值。但是在keypress没有回车返回。
      

  6.   

    keypress只接受字符型的,參考:
    The Key parameter in the OnKeyPress event handler is of type Char; therefore, the OnKeyPress event registers the ASCII character of the key pressed. Keys that don't correspond to an ASCII Char value (Shift or F1, for example) don't generate an OnKeyPress event. Key combinations (such as Shift+A), generate only one OnKeyPress event (for this example, Shift+A results in a Key value of "A" if Caps Lock is off). To respond to non-ASCII keys or key combinations, use the OnKeyDown or OnKeyUp event handlers. 難道你在keypress判斷 回車?
      

  7.   

    The Key parameter in the OnKeyPress event handler is of type Char; therefore, the OnKeyPress event registers the ASCII character of the key pressed. Keys that don't correspond to an ASCII Char value (Shift or F1, for example) don't generate an OnKeyPress event. Key combinations (such as Shift+A), generate only one OnKeyPress event (for this example, Shift+A results in a Key value of "A" if Caps Lock is off). To respond to non-ASCII keys or key combinations, use the OnKeyDown or OnKeyUp event handlers.楼主,keypress只接受字符型的,The Key parameter in the OnKeyPress event handler is of type Char
      

  8.   

    问题已经解决了。
    是delphi里memo1控件把回车键给过滤掉了。
    通过重编写消息处理事件,解决了。