自定义void,怎样给编辑框显示数字?m_roleblood是编辑框变量。只有这么多,前面也没有任何初始化。void CALLBA
自定义void,怎样给编辑框显示数字?
m_roleblood是编辑框变量。
只有这么多,前面也没有任何初始化。
void CALLBACK RoleBlood(
HWND hwnd, // handle of window for timer messages
UINT uMsg, // WM_TIMER message
UINT idEvent, // timer identifier
DWORD dwTime // current system time
)
{
char s[30];
int * pBlood=(int *)BloodBase;
itoa(* pBlood,s,10);
SetWindowText(m_roleblood.m_hWnd,s);
//错误:'m_roleblood' : undeclared identifier
//错误:'.m_hWnd' must have class/struct/union type
}
const int RoleBloodCheckID=238;
void WGForm::OnRoleblood()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(m_rolebloodcheck)
{
SetTimer(RoleBloodCheckID,500,&RoleBlood);
}
else
{
KillTimer(RoleBloodCheckID);
}
}
[解决办法]m_roleblood.SetWindowText(s);
[解决办法]SetWindowText
The SetWindowText function changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of the control is changed. However, SetWindowText cannot change the text of a control in another application.
BOOL SetWindowText(
HWND hWnd, // handle to window or control
LPCTSTR lpString // address of string
);
Parameters
hWnd
Handle to the window or control whose text is to be changed.
lpString
Pointer to a null-terminated string to be used as the new title or control text.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, callGetLastError.
Remarks
If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style, however, SetWindowText sets the text for the control, not for the list box entries.
The SetWindowText function does not expand tab characters (ASCII code 0x09). Tab characters are displayed as vertical bar (
[解决办法]) characters.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
和
CWnd::SetWindowText
void SetWindowText( LPCTSTR lpszString );
Parameters
lpszString
Points to a CString object or null-terminated string to be used as the new title or control text.
Remarks
Sets the window’s title to the specified text. If the window is a control, the text within the control is set.
This function causes aWM_SETTEXT message to be sent to this window.
CWnd Overview
[解决办法] Class Members
[解决办法] Hierarchy Chart
See Also CWnd::GetWindowText,::SetWindowText
和
CWindow::SetWindowText
BOOL SetWindowText( LPCTSTR lpszString );
SeeSetWindowText in the Win32 SDK.
Remarks
Changes the window’s text.
CWindow Overview
[解决办法] Class Members
See Also CWindow::GetWindowText
三者不完全是一回事!