标题:怎么获得窗口里的Text
取消只看楼主
pcyanlun
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2007-10-28
 问题点数:0 回复次数:0 
怎么获得窗口里的Text
HDC hdc;
    PAINTSTRUCT pt;

    static HWND hwndedit,hwndbutton;
    char str[10]="";
    switch(uMsg)
    {
    case WM_COMMAND:
        if(((HWND)lParam==hwndbutton)&&(HIWORD(wParam)==BN_CLICKED))
        {
        GetWindowText(hwndedit,str,10);
        return 0;
        }
        break;
    case WM_PAINT:
        hdc=BeginPaint(hwnd,&pt);
        TextOut(hdc,200,200,str,strlen(str));
        EndPaint(hwnd,&pt);
        break;
    case WM_CREATE:
        hwndedit=CreateWindow("edit",NULL,WS_CHILD|WS_VISIBLE|WS_BORDER,10,60,100,25,hwnd,NULL,NULL,NULL);
        ShowWindow(hwnd,SW_SHOWNORMAL);

        hwndbutton=CreateWindow("button","计算",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,100,150,100,25,hwnd,NULL,NULL,NULL);
        ShowWindow(hwnd,SW_SHOWNORMAL);
        break;

我调试过:str没有得到输入框中的的文本,谢谢,那位教一下,怎么改
搜索更多相关主题的帖子: Text 窗口 
2008-03-15 18:35



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-203572-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.348651 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved