求救:C++程序运行时错误

来源:百度知道 编辑:UC知道 时间:2024/06/11 01:55:24
case WM_CREATE:
{
MessageBox(hwnd,TEXT("Welcome to C++ world!"),TEXT("Welcome to C++ world"),MB_OK);
HWND Button1;
Button1 = CreateWindow(TEXT("Button"),TEXT("Display something?"),
WS_CHILD | WS_VISIBLE,
50,50,
200,50,
hwnd,
NULL,NULL,NULL); //Create the write_button called "Button1"
HWND Button2;
Button2 = CreateWindow(TEXT("Button"),TEXT("Display other things?"),
WS_CHILD | WS_VISIBLE,
50,100,
200,50,
hwnd,
NULL,NULL,NULL); //Create the delete_button called "Button2"
HWND Button3;
Button3 = CreateWindow(TEXT("Button"),TEXT("Quit"),

比较运算的时候最好把常量写在前面 假如你的IP为为一个常量的话
你这样写else if (IP == B3) 如果你粗心了 把== 误写成 = 编译器会告诉你写错了 而不至于花很多时间来调一个 自己粗心而出错

else if(B3 = lP){
int check;
check = MessageBox(hwnd,TEXT("You want to exit?"),TEXT("Quit?"),MB_YESNO);
if (check == IDYES){
DestroyWindow(hwnd);
}
把等号改为 ==

else if(B3 = lP){
~~~~~“=”---->"=="