|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
在win32汇编的第五章的第一个程序,用nmake编译时,编译器对资源脚本的编译出现test.rc(5): fatal error rc1015:cannot open include file 'windows.h'的错误,不知道是怎么回事,哪些大神请帮我看看,应该怎么样对编译器设置。
下面是我的源文件:
这是资源脚本:
// Generated by ResEdit 1.5.10
// Copyright (C) 2006-2012
// http://www.resedit.net
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"
#define IDM_MAIN 0x2000 //菜单
#define IDM_OPEN 0x4101
#define IDM_OPTION 0x4102
#define IDM_EXIT 0x4103
#define IDM_SETFONT 0x4201
#define IDM_SETCOLOR 0x4202
#define IDM_INACT 0x4203
#define IDM_GRAY 0x4204
#define IDM_BIG 0x4205
#define IDM_SMALL 0x4206
#define IDM_LIST 0x4207
#define IDM_DETAIL 0x4208
#define IDM_TOOLBAR 0x4209
#define IDM_TOOLBARTEXT 0x4210
#define IDM_INPUTBAR 0x4211
#define IDM_STATUSBAR 0x4212
#define IDM_HELP 0x4301
#define IDM_ABOUT 0x4302
#define IDA_MAIN 0x2000 //加速键
//
// Menu resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDM_MAIN MENU
{
POPUP "文件(&F)"
{
MENUITEM "打开文件(O)...", IDM_OPEN
MENUITEM "关闭文件(C)...", IDM_OPTION
MENUITEM SEPARATOR
MENUITEM "退出(X)...", IDM_EXIT
}
POPUP "查看(&V)"
{
MENUITEM SEPARATOR
MENUITEM "字体(F)...\tAlt+F", IDM_SETFOUT
MENUITEM "背景色(B)...\tCtrl+Alt+B", IDM_SETCOLOR
MENUITEM SEPARATOR
MENUITEM "被禁用的菜单", IDM_INACT, INACTIVE
MENUITEM "被灰化的菜单", IDM_GARY, GRAYED, INACTIVE
MENUITEM SEPARATOR
MENUITEM "大图标(G)", IDM_BIG
MENUITEM "小图标(M)", IDM_SMALL
MENUITEM "列表(L)", IDM_LIST
MENUITEM "详细资料(D)", IDM_DETAIL
MENUITEM SEPARATOR
POPUP "工具栏(&T)"
{
MENUITEM "标准按钮(S)", IDM_TOOLBAR
MENUITEM "文字标签(C)", IDM_TOOLBARTEXT
MENUITEM "命令栏(I)", IDM_INPUTBAR
}
MENUITEM "状态栏(U)", IDM_STATUSBAR
}
POPUP "帮助(&H)", HELP
{
MENUITEM "帮助主题(H) \tF1", IDM_HELP
MENUITEM "关于本程序(A)...", IDM_ABOUT
}
}
//
// Accelerator resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDA_MAIN ACCELERATORS
{
VK_F1, IDM_HELP, VIRTKEY
"B", IDM_SETCOLOR, VIRTKEY, ALT, CONTROL
"F", IDM_SETFONT, VIRTKEY, ALT
}
这是源文件:
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.model flat,stdcall
option casemap:none
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;资源宏定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
IDM_MAIN equ 2000h ;菜单
IDM_OPEN equ 4101h
IDM_OPTION equ 4102h
IDM_EXIT equ 4103h
IDM_SETFONT equ 4201h
IDM_SETCOLOR equ 4202h
IDM_INACT equ 4203h
IDM_GRAY equ 4204h
IDM_BIG equ 4205h
IDM_SMALL equ 4206h
IDM_LIST equ 4207h
IDM_DETAIL equ 4208h
IDM_TOOLBAR equ 4209h
IDM_TOOLBARTEXT equ 4210h
IDM_INPUTBAR equ 4211h
IDM_STATUSBAR equ 4212h
IDM_HELP equ 4301h
IDM_ABOUT equ 4302h
IDA_MAIN equ 2000h ;加速键
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
include windows.inc
include user32.inc
includelib user32.lib
include gdi32.inc
includelib gdi32.lib
include kernel32.inc
includelib kernel32.lib
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.data
szBuffer db 100 dup(0)
.data?
hInstance dd ?
hWinMain dd ?
hmenu dd ?
hacceler dd ? ;加速键句柄
.const
szClassName db 'MyClass',0
szCaptionMain db 'test',0
szText db '学习Win32汇编程序',0
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.code
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;回调函数,窗口过程
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_ProcWinMain proc uses ebx edi esi ebp,hWnd,uMsg,wParam,lParam
local @ps:PAINTSTRUCT
local @rect:RECT
local @hdc:HDC
mov eax,uMsg
;*****************************************************************************
.if eax == WM_PAINT
invoke BeginPaint,hWnd,addr @ps
mov @hdc,eax
invoke GetClientRect,hWnd,addr @rect
invoke TextOut,@hdc,100,100,addr szBuffer,sizeof szText
invoke EndPaint,hWnd,addr @ps
;*****************************************************************************
.elseif eax == WM_CLOSE
invoke DestroyWindow,hWinMain
invoke PostQuitMessage,NULL
;*****************************************************************************
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
;*****************************************************************************
xor eax,eax
ret
_ProcWinMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
_WinMain proc
local @wndclass:WNDCLASSEX
local @msg:MSG
invoke GetModuleHandle,NULL
mov hInstance,eax
invoke RtlZeroMemory,addr @wndclass,sizeof @wndclass
;****************************************************************************
;注册窗口类
;****************************************************************************
invoke LoadCursor,0,IDC_ARROW
mov @wndclass.hCursor,eax
push hInstance
pop @wndclass.hInstance
mov @wndclass.cbSize,sizeof WNDCLASSEX
mov @wndclass.style,CS_HREDRAW or CS_VREDRAW
mov @wndclass.lpfnWndProc,offset _ProcWinMain
mov @wndclass.hbrBackground,COLOR_WINDOW + 1
mov @wndclass.lpszClassName,offset szClassName
invoke RegisterClassEx,addr @wndclass
;****************************************************************************
;建立窗口
;****************************************************************************
invoke LoadMenu,hInstance,IDM_MAIN
mov hmenu,eax
invoke LoadAccelerators,hInstance,IDA_MAIN
mov hacceler,eax
invoke CreateWindowEx,WS_EX_CLIENTEDGE,\
offset szClassName,offset szCaptionMain,\
WS_OVERLAPPEDWINDOW,\
100,100,600,400,\
NULL,hmenu,hInstance,NULL
mov hWinMain,eax
invoke ShowWindow,hWinMain,SW_SHOWNORMAL
invoke UpdateWindow,hWinMain
;****************************************************************************
;消息循环
;****************************************************************************
.while TRUE
invoke GetMessage,addr @msg,NULL,0,0
.break .if eax == 0
invoke TranslateAccelerator,hInstance,hacceler,addr @msg
.if eax == 0
invoke TranslateMessage,addr @msg
invoke DispatchMessage,addr @msg
.endif
.endw
ret
_WinMain endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
start:
call _WinMain
invoke ExitProcess,NULL
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
end start
|
-
|