| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 728 人关注过本帖
标题:invoke LoadMenu, hInstance, IDM_MAIN
取消只看楼主 加入收藏
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
结帖率:96.55%
收藏
已结贴  问题点数:0 回复次数:3 
invoke LoadMenu, hInstance, IDM_MAIN
有问题
    问题是  和没有加载之前是一样
2011-08-11 12:56
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
程序代码:
;MASMPlus 代码模板 - 普通的 Windows 程序代码
.386
.model flat, stdcall
option casemap:none
include windows.inc
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib

IDM_MAIN equ    1000h
;//#define IDM_FILE    2001h//
IDM_OPEN equ 2011h
IDM_CLOS equ 2012h
IDM_SAVE equ 2013h

;//#define IDM_ICO_CUR    2002h
IDM_BIG_ICO    equ 2101h
IDM_SML_ICO    equ 2102h
IDM_CUR_A    equ 2103h
IDM_CUR_B     equ 2104h

.data?
hInstance dd ?;实例句柄
hMenu    dd ?;菜单句柄
hWnd    dd ?;窗口句柄
.const
szClassName db 'the first windows!', 0
szCaptionName db 'Icon and Cursor Example', 0
.code
;回调过程
MainProc_ proc uses esi edx ebx, hwnd, umsg, lParam, wParam
    mov eax, umsg

    .if eax == WM_CLOSE
        invoke DestroyWindow, hwnd
        invoke PostQuitMessage, 0
   
    .else
        invoke DefWindowProc, hwnd, umsg, lParam, wParam
        ret
    .endif
    xor eax, eax

    ret
MainProc_ endp
;创建窗口
WinMain_ proc
    local @wndclass:WNDCLASSEX
    local @msg:MSG

    invoke GetModuleHandle, NULL
    mov hInstance, eax
    invoke LoadMenu, hInstance, IDM_MAIN
    mov hMenu, eax

    invoke RtlZeroMemory, addr @wndclass, sizeof WNDCLASSEX
    mov @wndclass.cbSize, sizeof WNDCLASSEX
    mov @wndclass.style, CS_HREDRAW or CS_VREDRAW
    push  offset MainProc_
    pop @wndclass.lpfnWndProc
    push hInstance
    pop @wndclass.hInstance
    mov @wndclass.hbrBackground, COLOR_WINDOW+1
    mov @wndclass.lpszClassName, offset szClassName
    invoke LoadCursor, hInstance, IDC_ARROW
    mov @wndclass.hIcon, eax

    ;设置窗口属性
    invoke RegisterClassEx, addr @wndclass

    invoke CreateWindowEx,WS_EX_CLIENTEDGE,offset szClassName,\
        offset szCaptionName, WS_OVERLAPPEDWINDOW,\
        100, 100, 400, 300,\
        NULL, hMenu, hInstance, NULL
    mov hWnd, eax

    invoke ShowWindow, hWnd, SW_NORMAL
    invoke UpdateWindow, hWnd

    .while TRUE
        invoke GetMessage, addr @msg, 0, 0, 0
        .break .if eax == 0
        invoke TranslateMessage, addr @msg
        invoke DispatchMessage, addr @msg
    .endw

    ret
WinMain_ endp
Begine:
    invoke WinMain_
    invoke ExitProcess, NULL

    end Begine
2011-08-11 12:56
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
程序代码:
#include <resource.h>
#define IDM_MAIN    1000h//菜单
//#define IDM_FILE    2001h//
    #define IDM_OPEN 2011h
    #define IDM_CLOS 2012h
    #define IDM_SAVE 2013h

//#define IDM_ICO_CUR    2002h
    #define IDM_BIG_ICO    2101h
    #define IDM_SML_ICO    2102h
    #define IDM_CUR_A    2103h
    #define IDM_CUR_B 2104h


IDM_MAIN menu discardable
begin
    popup "文件(&F)"
    begin
        menuitem "打开(&Open)", IDM_OPEN
        menuitem "保存(&Save)", IDM_SAVE
        menuitem separator
        menuitem "关闭(&Close)", IDM_CLOS
    end

    popup "图标和光标(&I)"
    begin
        menuitem "大图标(&G)", IDM_BIG_ICO
        menuitem "小图标(&M)", IDM_SML_ICO
        menuitem separator
        menuitem "光标A(&A)", IDM_CUR_A
        menuitem "光标B(&B)", IDM_CUR_B
    end
end
2011-08-11 12:57
诸葛修勤
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:11
帖 子:549
专家分:1955
注 册:2010-10-28
收藏
得分:0 
感谢 啊 相当之。。。
2011-08-11 18:04
快速回复:invoke LoadMenu, hInstance, IDM_MAIN
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017506 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved