Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing windows using API

Status
Not open for further replies.

londonDevil

Programmer
Nov 7, 2002
7
GB
i've been working on a program using API and now am 'TRYING' to develop a feature which would:
clear out TWO windows on selecting 'Stats'.
This is part of the code from the case statement when 'Stats' is selected:
......

case IDM_Stats:
SendMessage(hWndBig, EM_SETSEL,0,MAKELONG(0, -1));
SendMessage(hWndBig, WM_CLEAR, 0, 0L);
SendMessage(hWndSmall, EM_SETSEL,0,MAKELONG(0, -1));
SendMessage(hWndSmall, WM_CLEAR, 0, 0L);

......


Currently this isn't clearing ANY data that I enter in the two windows. I REALLY hope one of you c++ experts can help me out. :) Thanx!
 
If these are list boxes/edits then just do:

SetWindowText(hList, "");

That won't work if the list box has a caption, though.

In that case do:

SendMessage(hList, WM_SETTEXT, 0, (LPARAM)" \0");

If it's a window you're talking about, just do:

//...remember, don't delete stock brushes...
HBRUSH brush = (HBRUSH)GetStockObject(WHITE_BRUSH);
HDC hdc = GetDC(win);
brush = (HBRUSH)SelectObject(hdc, brush); //save old brush
PatBlt(hdc, 0, 0, width, height, PATCOPY);
SelectObject(hdc, brush); //...restore old brush
ReleaseDC(win, hdc);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top