错误:
Run-Time Check Failure #3 - The variable 'TextLabelVar' is being used without
being initialized.
说明代码:
HWND VarText;
char Disps[100];
float some_number;
WINAPI WndProc(..)
{
switch(...)
case WM_CREATE:
TextLabelVar=CreateWindowEx(WS_EX_WINDOWEDGE,TEXT("Edit"), TEXT("Val."), WS_CHILD \
| WS_VISIBLE, 380, 50, 140, 20, hwnd, NULL, NULL, NULL);
break;
case WM_MESSAGEFROMANOTHERWINDOW:
some_number=1298.123123;
sprintf(Disps,"%f",some_number);
SetWindowText(TextLabelVar,TEXT(Disps));
}
问题:好的,我收到错误 TextLabelVar is正在使用而没有初始化。对于 var Disps,我遇到了类似的错误。然后我宣布 char Disps[100]; 这显示没有错误。现在,错误转移到句柄上。我不确定我是否可以将句柄声明为数组,这是否有意义。我该如何解决这个问题?