News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

DialogboxParam

Started by RedXVII, November 22, 2005, 10:41:04 AM

Previous topic - Next topic

RedXVII

Now - i have just done something stupid here;

its late, but mabe someone can help.

Ive made (or tried) a simple dialogue box, with the aid of iczillions: trouble is, when i compile it, it just doesnt show a close, minimise or maximise box as standard. can someone point out my stupid error?

Thanks alot guys, ive been staring at this for hours and trying to figure this out  :eek

Ta  :U

Hear it is

.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

DlgProc PROTO :DWORD,:DWORD,:DWORD,:DWORD

.data

.data?
hInstance HINSTANCE ?
CommandLine LPSTR ?
hWndMCI HINSTANCE ?

.const
IDC_GO       equ 3001
IDC_EXIT    equ 3002
ID_DLG equ 3003

.code
start:
invoke GetModuleHandle, NULL
mov    hInstance,eax
invoke DialogBoxParam, hInstance, ID_DLG ,NULL,addr DlgProc,NULL
invoke ExitProcess,eax

DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
.IF uMsg==WM_INITDIALOG
invoke GetDlgItem, hWnd,IDC_GO
invoke SetFocus,eax
.ELSEIF uMsg==WM_CLOSE
invoke EndDialog, hWnd,NULL
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
mov edx,wParam
shr edx,16
.if dx==BN_CLICKED
.IF ax==IDC_GO
invoke Beep, 1000, 100
.ELSEIF ax==IDC_EXIT
invoke EndDialog, hWnd,NULL
.ENDIF
.ENDIF
.ELSE
mov eax,FALSE
ret
.ENDIF
mov eax,TRUE
ret
DlgProc endp
end start


and resource

#include "resource.h"

#define IDC_GO          3001
#define IDC_EXIT 3002
#define ID_DLG 3003


ID_DLG DIALOG 10, 10, 104, 55
STYLE 0x0004 | DS_CENTER | WS_CAPTION | WS_MINIMIZEBOX |
WS_VISIBLE | WS_OVERLAPPED | DS_MODALFRAME | DS_3DLOOK
CAPTION "My Coolness"
BEGIN
    DEFPUSHBUTTON   "YAY!", IDC_GO,    25,10,52,13
    PUSHBUTTON      "E&xit", IDC_EXIT,  25,26,52,13
END

tenkey

Probably need to add WS_SYSMENU to the style options.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

RedXVII

OooooH, there it is! hahaha, at last!!!


Thanks tenkey, i feel like an idiot now  :bg  :U

tenkey

Don't feel like an idiot for this one.

It irked me that the buttons and the system menu are tied together this tightly. Think! What if I wanted the buttons but not the menu?
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

RedXVII

Aye - it does seem strange that they are so closely related. The menu's not appearing because i removed it from the resource  :8)

Cheeky me   :P

:U

tenkey

The menu bar or the system menu?

The system menu is the menu you get when you click on the icon in the upper left corner of the window. What if you don't want the icon or the menu?
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8