麻烦各位了,文件查找结束时有无法预知的错误

P8618282287827770 2010-11-29 07:13:41
cpp文件时# include <windows.h>
# include <stdlib.h>
# include "stdio.h"
# include <string.h>
LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
BOOL InitWindowClass(HINSTANCE hInstance);
BOOL InitWindow( HINSTANCE hInstance, int nCmdShow);
BOOL CALLBACK DialogProc(HWND hwndDlg,UINT UMsg,WPARAM wParam,LPARAM IParam);
HWND hwnd;
HACCEL hAccel;
MSG msg;
int WINAPI WinMain
(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
MSG msg;
if(!InitWindowClass(hInstance))
return false;
if(!InitWindow(hInstance,nCmdShow))
return false;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WinSunProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)

{
switch(uMsg)
{
case WM_COMMAND:
{
switch(wParam)
case IDM_NEW:break;
case IDM_OPEN:
MessageBox(hwnd,"文件打开","文件已经打开",MB_OK);
break;
case IDM_SAVE:
MessageBox(hwnd,"文件保存","文件已经保存",MB_OK);
break;
case IDM_SAVEAS:
break;
case IDM_CLOSE:
break;
case IDM_EXIT:
SendMessage(hwnd,WM_DESTRORYM,0,0);
break;
case IDM_CUT:
break;
case IDM_COPY:
break;
case IDM_PASTE:
break;
case IDM_DELETE:
break;
case IDM_ABOUT:
DialogBox(hlnstance,"About",hwnd,DialogProc);
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
}
BOOL CALLBACK DialogProc(HWND hwndDlg,UINT UMsg,WPARAM wParam,LPARAM IParam);
{
switch(UMsg)
{
case WM_INITDIALOG
return 1;
case WM_COMMAND
switch(wParam)
{
case IDOK:
EndDialog(hDlg,0);
}
case WM_CLOSE:
EndDialog(hDlg,0);
}
}
BOOL InitWindow( HINSTANCE hInstance, int nCmdShow)
{

HACCEL hAccel;
HWND hwnd;
HINSTANCE hInstance;
hwnd=CreateWindow
(
"lavender",
"Winged Monkey",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL);
if(!hwnd)
return FALSE;
hAccel=LoadAccelerators(hInstance,"Menu");
ShowWindow(hwnd,nCmdShow);
UpdateWindow(hwnd);
return true;
}
BOOL InitWindowClass(HINSTANCE hInstance)
{
WNDCLASS wndclass1;
wndclass1.style=0;
wndclass1.lpfnWndProc=WinSunProc;
wndclass1.cbClsExtra=0;
wndclass1.cbWndExtra=0;
wndclass1.hInstance=hInstance;
wndclass1.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndclass1.hCursor=LoadCursor(NULL,IDC_ARROW);
wndclass1.lpszClassName="lavender";
wndclass1.lpszMenuName="Menu";
wndclass1.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
return RegisterClass(&wndclass1);
}
rc文件是:# include<windows.h>
# include<消息框.h>
Menu MENU DISCARDABLE
{ POPUP"文件(&F)"
{
MENUITEM"新建(&N)\t,Ctrl+N", IDM_NEW
MENUITEM"打开(&O)\t,Ctrl+O", IDM_OPEN
MENUITEM"关闭(&C)", IDM_CLOSE
MENUITEM SEPARATOR
MENUITEM"保存(&nS\t,Ctrl+S", IDM_SAVE
MENUITEM"另存为(&A)\t", IDM_SAVEAS
MENUITEM SEPARATOR
MENUITEM"退出(&X)", IDM_EXIT
}
POPUP"编辑(&E)"
{
MENUITEM"剪切(&T)\t,Ctrl+X", IDM_CUT
MENUITEM"复制(&C)\t,Ctrl+C", IDM_COPY
MENUITEM"粘贴(&P)\t,Ctrl+V", IDM_PASTE
MENUITEM"删除(&D)\t,Del", IDM_DELETE
}
POPUP "帮助"
{
M ENUITEM "关于(&A).....", IDM_ABOUT
}
}
Menu ACCELERATORS
{
"^N" , IDM_DELETE
"^O" , IDM_OPEN
"^S" , IDM_SAVE
"^X" , IDM_CUT
"^C" , IDM_COPY
"^V" , IDM_PASYE
VK_DELETE IDM_DELETE, VIRTKEY
}
About DIALOG 10,10,100,50
SITYLE WS_POPUP| WS_CAPTION| WS_SYSMENU
CAPTION"关于"
FONT 18,"楷体"
{
CIEXT "lavenders",1,13,10,80,10
DEFOUSHBUTTON "确定",IDOK,35,30,30,12

}
消息框.h是#define IDM_NEW 10
#define IDM_CLOSE 11
#define IDM_OPEN 12
#define IDM_SAVE 13
#define IDM_COPY 14
#define IDM_SAVEAS 15
#define IDM_EXIT 16
#define IDM_CUT 17
#define IDM_PASTE 18
#define IDM_DELETE 19
#define IDM_ABOUT 20
resource.h为#define IDR_MENU1 101
#define IDM_OPEN 40001
#define IDM_SAVE 40002
#define IDM_SAVEAS 40003
#define IDM_EXIT 40004
#define IDM_CLOSE 40005
#define IDM_COPY 40006
#define IDM_CUT 40007
#define IDM_PASTE 40008
#define IDM_DELETE 40009
#define IDM_ABOUT 40011

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40012
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
不好意思,麻烦给位给改一下,新手,不知道要发哪段代码,就全发上来了。







}
...全文
51 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ouyh12345 2010-11-30
  • 打赏
  • 举报
回复
单步调试,查看变量状态
射下北极星 2010-11-30
  • 打赏
  • 举报
回复
什么意思?有查找文件吗?可以调下代码,具体哪里出的错

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧