我用CreateWindow每生成一个窗口后,在桌面的任务栏上就会显示一个按钮,
如何实现无论生成多少个窗口,在任务栏上都不会显示仍会按钮!!还有几个关于编辑框的问题
对于一个多行编辑框,
1.如何得到编辑框有多少行?
2.如何得知当前光标在第几行?
3.如何在编辑框里移动光标?
4.如何改变编辑框的字体,字体颜色和背景色?

解决方案 »

  1.   

    http://www.csdn.net/develop/Read_Article.asp?Id=17482编辑框前3条请看msdn中关于Edit的参考.
    第四个可在该编辑框的父窗口的wm_ctlcolor中处理.具体看msdn中wm_ctlcolor消息的说明.
      

  2.   

    小弟我用SDK生成了一个窗口,上面有一个多行的EDIT
    窗口HWND为hWin
    EDIT的HWND为hEdit我想知道一些对EDIT的控制的方法
    1.1.如何得到EDIT有多少行?
    2.如何得知当前光标在第几行?
    3.如何在EDIT里移动光标?
    4.如何改变EDIT的背景色?
    5.如何改变EDIT的字体和字体颜色?
    6.如何用代码把编辑框设置为只读和非只读?很急
    请真正的大虾给出具体的代码!!!!!!!!!!
      

  3.   

    可以查阅msdn中关于EM_GETLINECOUNT的描述,以及相关消息的用法。
    如得到EDIT有多少行,可用下面代码:
    int nAllLines=::SendMessage(hEdit,EM_GETLINECOUNT,0L,0L);
    有关光标的操作,首先要取得光标的位置(GetCursor()),然后用EM_CHARFROMPOS消息(用法同上)获得光标所在行数和具体位置。
    设置光标用SetCursor()即可,改变颜色和字体用WM_CTLCOLOREDIT 消息,即在父窗口中编制处理WM_CTLCOLOREDIT 消息的函数,系统要重画edit框时,会自动调用消息处理函数,你在函数中设置好你想用的颜色和字体即可;
    改变只读非只读属性用EM_SETREADONLY消息:设成只读::SendMessage(hEdit,EM_SETREADONLY,1,0);设成非只读为::SendMessage(hEdit,EM_SETREADONLY,0,0).
      

  4.   

    我用::SendMessage(hEdit,EM_SETREADONLY,0,0)把EDIT设为只读
    但是EDIT的背景色变了,如何实现在EDIT处于只读模式的时候,背景
    色不变?
      

  5.   

    如何得知EDIT的光标的的位置的改变???
      

  6.   

    以下是MSDN中关于EM_SETREADONLY的信息,
    请教wangweixing2000,我从那里找答案????!!!!Platform SDK: Windows User Interface 
    EM_SETREADONLY
    The EM_SETREADONLY message sets or removes the read-only style (ES_READONLY) of an edit control. You can send this message to either an edit control or a rich edit control.To send this message, call the SendMessage function with the following parameters. SendMessage( 
      (HWND) hWnd,              // handle to destination window 
      EM_SETREADONLY,           // message to send
      (WPARAM) wParam,          // read-only option
      (LPARAM) lParam          // not used; must be zero
    );
    Parameters
    wParam 
    Specifies whether to set or remove the ES_READONLY style. A value of TRUE sets the ES_READONLY style; a value of FALSE removes the ES_READONLY style. 
    lParam 
    This parameter is not used. 
    Return Values
    If the operation succeeds, the return value is nonzero.If the operation fails, the return value is zero.Res
    When an edit control has the ES_READONLY style, the user cannot change the text within the edit control. To determine whether an edit control has the ES_READONLY style, use the GetWindowLong function with the GWL_STYLE flag. Rich Edit: For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls. Requirements 
      Windows NT/2000: Requires Windows NT 3.1 or later.
      Windows 95/98: Requires Windows 95 or later.
      Version: Requires Rich Edit 1.0 or later.
      Header: Declared in Winuser.h; include Windows.h.See Also
    Edit Controls Overview, Edit Control Messages, GetWindowLong Built on Thursday, May 11, 2000Requirements 
      Windows NT/2000: Requires Windows NT 3.1 or later.
      Windows 95/98: Requires Windows 95 or later.
      Version: Requires Rich Edit 1.0 or later.
      Header: Declared in Winuser.h; include Windows.h.
    See Also
    Edit Controls Overview, Edit Control Messages, GetWindowLong 
      

  7.   

    我用以下的代码来取得EDIT的光标在第几行,
    POINT point;
    GetCursorPos(&point);
    long CurLine=SendMessage(hEdit,0L,(LPARAM)(&point));
    DWORD dwError=GetLastError();结果是
    CurLine总是等于-1
    dwError总是等于0为什么?????
      

  8.   

    去CodeProject,CodeGuru看看
    或许可以找到答案再不行就得啃MSDN Platform SDK 中关于EDIT控件得参考了中文MSDN就要推出了,看看