Hi all,
I'm trying to create simple window with status bar. My window appears without it. CreateWindowEx returns nothing.
Here is the code:
.486
.model flat, stdcall
option casemap:none
include \masm32\include\comctl32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\comctl32.lib
includelib \masm32\lib\comdlg32.lib
WinMain PROTO STDCALL :DWORD, :DWORD, :DWORD, :DWORD
WndProc PROTO STDCALL :DWORD, :DWORD, :DWORD, :DWORD
.data?
hInstance dd ?
hWndStat dd ?
sbParts dd 4 dup(?)
hwnd dd ?
.data
StatClass db "msctls_statusbar32",0
ClassName db "FirstWindowClass",0
AppName db "StatusBar",0
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
call InitCommonControls
invoke WinMain, hInstance, NULL, NULL, SW_SHOWNORMAL
invoke ExitProcess, NULL
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc
INVOKE CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ClassName,ADDR AppName,\
WS_OVERLAPPEDWINDOW-WS_SIZEBOX-WS_MAXIMIZEBOX,CW_USEDEFAULT,\
CW_USEDEFAULT,400,300,NULL,NULL,\
hInstance,NULL
mov hwnd,eax
; invoke LoadMenu,hInst,600 ; menu ID
; invoke SetMenu,hwnd,eax
invoke ShowWindow, hwnd,SW_SHOWNORMAL
invoke UpdateWindow, hwnd
.WHILE TRUE
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
;mov eax, uMsg
.IF uMsg == WM_CREATE
;---------- Create the status bar window ----------
invoke CreateWindowEx, 0, addr StatClass, 0,\
WS_CHILD or WS_BORDER or WS_VISIBLE or SBS_SIZEGRIP,\
0, 0, 0, 0,hwnd, 0, hInstance, 0
mov hWndStat, eax
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage, NULL
.ELSE
invoke DefWindowProc, hWnd, uMsg, wParam, lParam
ret
.ENDIF
xor eax,eax
ret
WndProc endp
end start
I'm probably missing something :icon_confused:
Waiting for help and critique :icon_redface:
Quote from: vertograd on March 24, 2013, 01:43:45 AM
Waiting for help and critique :icon_redface:
You probably will have to handle the WM_SIZE message. Within this code you'll have to set the size of the statusbar child ( using SetWindowPos() ).
hWnd will do the job. No WM_SIZE handler needed.
Really?!! :shock:
It looks so simple . I'm going to my "developer" machine to fix it right now
Thank you both!
i think that....
if you use CreateStatusWindow, the status bar will size and locate itself
if you use CreateWindowEx to create a status bar, you need to handle size/location of the status bar
After creating the main window, you assign the handle to a global variable:
mov hwnd, eax
That is fine, but in the WM_CREATE handler you have not yet reached that point, so hwnd is still zero, and you get a zero return value plus error "Cannot create top level child window".
In contrast, hWnd is already available at this stage.
Jochen makes a good point
in fact, i often initialize the global hWin variable as the first step of handling WM_CREATE (from hWnd value)
it is the earliest point in the sequence of events that you know the window handle
Thank you, jj2007!
I've just fixed the code.Now all works well!
I've already realized my mistake. I've missed the difference between global hwnd and local hWnd variables.
It's a shame of me.
Then I added WM_SIZE handling routine and my status bar appeared as was expected.
Thanks, Dave
I'll try that function to create a status bar.
And one more question ...
How can I create menu item that can be checked /unchecked?
Quote from: dedndave on March 24, 2013, 02:30:34 AMinitialize the global hWin variable as the first step of handling WM_CREATE (from hWnd value)
Dave,
You are wasting 3 (three!) precious bytes:
mrm hwnd, hWnd ; 8 bytes
mov hwnd, eax ; 5 bytes
:eusa_naughty:
the easiest way to create menus is in the resource file
here is one example that includes accelerators
view the masm32\bin\rc.hlp file for more info
;Simple MDI Window - DednDave - 5, 2012
;#####################################################################################
#include "\masm32\include\resource.h"
#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#endif
#ifndef RT_MANIFEST
#define RT_MANIFEST 24
#endif
#ifndef VS_VERSION_INFO
#define VS_VERSION_INFO 1
#endif
#ifndef VOS_NT_WINDOWS32
#define VOS_NT_WINDOWS32 0x00040004L
#endif
#ifndef VFT_APP
#define VFT_APP 0x00000001L
#endif
;*************************************************************************************
#define IDI_ICON 100
#define IDM_MAINMENU 543
#define IDM_FILENEW 544
#define IDM_FILEEXIT 545
#define IDM_FILEWINDOW_TILEHORZ 549
#define IDM_FILEWINDOW_TILEVERT 550
#define IDM_FILEWINDOW_CASCADE 551
#define IDM_FILEWINDOW_ARRANGE 552
#define IDA_ACC 999
;#####################################################################################
IDI_ICON ICON DISCARDABLE "SimpleMDI.ico"
;#####################################################################################
IDM_MAINMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New\tCtrl+N", IDM_FILENEW
POPUP "&Arrange"
BEGIN
MENUITEM "&Cascade\tCtrl+C", IDM_FILEWINDOW_CASCADE
MENUITEM "Tile &Horizontally\tCtrl+H", IDM_FILEWINDOW_TILEHORZ
MENUITEM "Tile &Vertically\tCtrl+V", IDM_FILEWINDOW_TILEVERT
MENUITEM "Arrange Icons\tCtrl+I", IDM_FILEWINDOW_ARRANGE
END
MENUITEM SEPARATOR
MENUITEM "E&xit\tCtrl+X", IDM_FILEEXIT
END
END
;*************************************************************************************
IDA_ACC ACCELERATORS
BEGIN
"N", IDM_FILENEW, VIRTKEY, CONTROL, NOINVERT
"C", IDM_FILEWINDOW_CASCADE, VIRTKEY, CONTROL, NOINVERT
"H", IDM_FILEWINDOW_TILEHORZ, VIRTKEY, CONTROL, NOINVERT
"V", IDM_FILEWINDOW_TILEVERT, VIRTKEY, CONTROL, NOINVERT
"I", IDM_FILEWINDOW_ARRANGE, VIRTKEY, CONTROL, NOINVERT
"X", IDM_FILEEXIT, VIRTKEY, CONTROL, NOINVERT
END
;#####################################################################################
; manifest file
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "SimpleMDI.xml"
;#####################################################################################
; file version info
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "DednDave\000"
VALUE "FileDescription", "Simple MDI Window\000"
VALUE "FileVersion", "1.0\000"
VALUE "LegalCopyright", "\251 2012 David R. Sheldon\000"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0x4E4
END
END
;#####################################################################################
Quote from: jj2007 on March 24, 2013, 02:39:49 AM
Quote from: dedndave on March 24, 2013, 02:30:34 AMinitialize the global hWin variable as the first step of handling WM_CREATE (from hWnd value)
Dave,
You are wasting 3 (three!) precious bytes:
mrm hwnd, hWnd ; 8 bytes
mov hwnd, eax ; 5 bytes
:eusa_naughty:
not really
i usually load the hWnd value into a register, like EBX, then use it throughout WM_CREATE
so, that is a good time to store it :P
So I can create such checkable menu item by means of resource file, yes?
Going to look into MASM examples and help
yes - that is the easy way
and, ultimately, you will probably want a resource file, anyways
there are a few ways to load a menu from resource
you can use LoadMenu, then place the handle in the class structure
you can use LoadMenu, then pass the handle to CreateWindowEx (this is what i usually do)
or, you can use LoadMenu and SetMenu, after the window has been created
the last 2 have more-or-less the same result
the first one is slightly different in that all windows of that class will have the same menu
there are a number of functions, etc, associated with menus
http://msdn.microsoft.com/en-us/library/windows/desktop/ff468864%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/ff468864%28v=vs.85%29.aspx)
Quote from: vertograd on March 24, 2013, 02:38:48 AM
I've missed the difference between global hWnd and local hwnd variables.
It's a shame of me.
Reserve shame for more serious errors :badgrin:
Besides, hWnd is a passed argument, not a local variable.
QuoteThen I added WM_SIZE handling routine and my status bar appeared as was expected.
The status bar is a grown-up control, it does not need parental assistance to size itself.
QuoteHow can I create menu item that can be checked /unchecked?
Something like this?
mov hMenu, rv(CreateMenu) ; create the main menu (hMenu is a global var)
mov hM1, rv(CreateMenu) ; plus two
mov hM2, rv(CreateMenu) ; sub menus
invoke AppendMenu, hMenu, MF_POPUP, hM1, chr$("&File")
invoke AppendMenu, hM1, MF_STRING, IdMenuNew, chr$("&New",9,"Ctrl+N")
invoke AppendMenu, hM1, MF_STRING, IdMenuSave, chr$("&Save",9,"Ctrl+S")
invoke AppendMenu, hMenu, MF_POPUP, hM2, chr$("&Edit")
invoke AppendMenu, hM2, MF_STRING, IdMenuCopy, chr$("&Copy",9,"Ctrl+C")
Quote from: jj2007 on March 24, 2013, 03:25:06 AM
The status bar is a grown-up control, it does not need parental assistance to size itself.
see my previous post
if you use CreateWindowEx to create a status bar, i think you do have to size and locate it
probably a good argument for using CreateStatusWindow, instead
Quote from: jj2007 on March 24, 2013, 03:25:06 AM
QuoteHow can I create menu item that can be checked /unchecked?
Something like this?
mov hMenu, rv(CreateMenu) ; create the main menu (hMenu is a global var)
mov hM1, rv(CreateMenu) ; plus two
mov hM2, rv(CreateMenu) ; sub menus
invoke AppendMenu, hMenu, MF_POPUP, hM1, chr$("&File")
invoke AppendMenu, hM1, MF_STRING, IdMenuNew, chr$("&New",9,"Ctrl+N")
invoke AppendMenu, hM1, MF_STRING, IdMenuSave, chr$("&Save",9,"Ctrl+S")
invoke AppendMenu, hMenu, MF_POPUP, hM2, chr$("&Edit")
invoke AppendMenu, hM2, MF_STRING, IdMenuCopy, chr$("&Copy",9,"Ctrl+C")
as you can see from all that code, the resource file method is easier :P
Quote from: dedndave on March 24, 2013, 03:37:02 AM
if you use CreateWindowEx to create a status bar, i think you do have to size and locate it
Microsoft thinks you don't have to.
WndProc proc hWnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
.if uMsg == WM_CREATE
mov hWndStat, rv(CreateWindowEx, 0, "msctls_statusbar32", "Hello Dave", WS_CHILD or WS_VISIBLE, 0, 0, 0, 0, hWnd, 0, 0, 0)
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage, NULL
.endif
invoke DefWindowProc, hWnd, uMsg, wParam, lParam
ret
WndProc endp
I found an example of CHECKED MENUITEM in masm32\examples\exampl01\showdib
Then I took a glance to rc.hlp
I use MENUEX in my resource file and making one of the menuitems CHECKED caused compilation error.
#include "\masm32\include\resource.h"
600 MENUEX MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
POPUP "&File", , , 0
BEGIN
MENUITEM "&Open\tCtrl+O", 1000
MENUITEM "", , 0x0800 /*MFT_SEPARATOR*/
MENUITEM "&Exit\tEsc", 1001
END
POPUP "&View" ,,,0
BEGIN
MENUITEM "Toolbar",1100
MENUITEM "Status bar",1101
MENUITEM "", , 0x0800 /*MFT_SEPARATOR*/
MENUITEM "Font",1102
MENUITEM "Options",1103
END
POPUP "&Debug",,,0
BEGIN
MENUITEM "&Go\tF5", 1200
MENUITEM "&Restart\tCtrl+Shift+F5", 1201
MENUITEM "Stop debugging\tShift+F5", 1202
MENUITEM "Break\tCtrl+Break", 1203
MENUITEM "Step\tF8",1204
MENUITEM "", , 0x0800 /*MFT_SEPARATOR*/
MENUITEM "Source mode", 1205,CHECKED
END
POPUP "&Help", , , 0
BEGIN
MENUITEM "&About", 1900
END
END
Now you see I'm writing my "Hello World Debugger" :biggrin:
It's my first "big" project
And I want to add an option to choose from source and assembly mode debugging .
it would help if you showed us the error(s)
but, i think i know where one is :P
CHECKED is not defined
try using MF_CHECKED or, more appropriately, MFS_CHECKED (same value)
MENUEX is a little harder to use than MENU
Jochen - did you try that in a program
and - try sizing the main window
Quote from: dedndave on March 24, 2013, 06:26:19 AM
Jochen - did you try that in a program
and - try sizing the main window
Of course I tried it before posting :biggrin:
Just take the OP's original code, replace in line 93 hwnd with hWnd, and see the result.
But you are right about sizing. If the main window is sizable, then you better handle WM_SIZE also for the status bar. If it's fixed size, no need for that.
whew - thought i was doing something wrong - lol
i played with it a little bit
and, even when using CreateStatusWindow, i have to set the size when WM_SIZE on the main window
so, on the bright side, i was also wrong :biggrin:
What is going on?
I've wrote two posts but cant see them
About errors - MAKEIT.BAT quits quickly and silently producing only MineDbg.obj
My status bar is divided into four equal parts and while sizing the window all of them stay equal.
please attach the project, all the files, including makeit.bat
Just tried MF_CHECKED and MFS_CHECKED with MENUEX
All compiles but my window starts without menu at all!
MineDbg.asm
.486
.model flat, stdcall
option casemap:none
include \masm32\include\comctl32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\gdi32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\comctl32.lib
includelib \masm32\lib\comdlg32.lib
WinMain PROTO STDCALL :DWORD, :DWORD, :DWORD, :DWORD
WndProc PROTO STDCALL :DWORD, :DWORD, :DWORD, :DWORD
.data?
hInstance dd ?
hWndStat dd ?
sbParts dd 4 dup(?)
hWnd dd ?
.data
StatClass db "msctls_statusbar32",0
ClassName db "FirstWindowClass",0
AppName db "MineDbg",0
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
call InitCommonControls
invoke WinMain, hInstance, NULL, NULL, SW_SHOWNORMAL
invoke ExitProcess, NULL
WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OFFSET WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_WINDOW
mov wc.lpszMenuName,NULL
mov wc.lpszClassName,OFFSET ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon, eax
mov wc.hIconSm, eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, addr wc
INVOKE CreateWindowEx,WS_EX_CLIENTEDGE,ADDR ClassName,ADDR AppName,\
WS_OVERLAPPEDWINDOW or WS_SIZEBOX or WS_MAXIMIZEBOX,CW_USEDEFAULT,\
CW_USEDEFAULT,400,300,NULL,NULL,\
hInstance,NULL
mov hWnd,eax
invoke LoadMenu,hInst,600 ; menu ID
invoke SetMenu,hWnd,eax
invoke ShowWindow, hWnd,SW_SHOWNORMAL
invoke UpdateWindow, hWnd
.WHILE TRUE
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.ENDW
mov eax,msg.wParam
ret
WinMain endp
WndProc proc hwnd:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
;mov eax, uMsg
.IF uMsg == WM_CREATE
;---------- Create the status bar window ----------
invoke CreateWindowEx, 0, addr StatClass, 0,\
WS_CHILD or WS_BORDER or WS_VISIBLE or SBS_SIZEGRIP,\
0, 0, 0, 0,hwnd, 0, hInstance, 0
mov hWndStat, eax
;---------- [Move and Size the Control(s)] ----------
.elseif uMsg == WM_SIZE
;---------- [Size the Statusbar Control] ----------
mov eax, lParam ; Get width
and eax, 0ffffh ; Lowword
shr eax, 2 ; /4
mov ecx, eax ; Save factor
mov sbParts, eax ; Make part 1 1/4 the width
add eax, ecx
mov [sbParts+4], eax ; and also part2, .. etc
add eax, ecx
mov [sbParts+8], eax
mov [sbParts+12], -1 ; The last part extends to the end
INVOKE SendMessage, hWndStat, SB_SETPARTS, 4, addr sbParts
INVOKE MoveWindow, hWndStat, 0, 0, 0, 0, TRUE
.elseif uMsg == WM_DESTROY
invoke PostQuitMessage, NULL
.ELSE
invoke DefWindowProc, hwnd, uMsg, wParam, lParam
ret
.ENDIF
xor eax,eax
ret
WndProc endp
end start
rsrc.rc
#include "\masm32\include\resource.h"
600 MENUEX MOVEABLE IMPURE LOADONCALL DISCARDABLE
BEGIN
POPUP "&File", , , 0
BEGIN
MENUITEM "&Open\tCtrl+O", 1000
MENUITEM "", , 0x0800 /*MFT_SEPARATOR*/
MENUITEM "&Exit\tEsc", 1001
END
POPUP "&View" ,,,0
BEGIN
MENUITEM "Toolbar",1100
MENUITEM "Status bar",1101
MENUITEM "", , 0x0800 /*MFT_SEPARATOR*/
MENUITEM "Font",1102
MENUITEM "Options",1103
END
POPUP "&Debug",,,0
BEGIN
MENUITEM "&Go\tF5", 1200
MENUITEM "&Restart\tCtrl+Shift+F5", 1201
MENUITEM "Stop debugging\tShift+F5", 1202
MENUITEM "Break\tCtrl+Break", 1203
MENUITEM "Step\tF8",1204
MENUITEM "", , 0x0800 /*MFT_SEPARATOR*/
MENUITEM "Source mode", 1205,MFS_CHECKED
END
POPUP "&Help", , , 0
BEGIN
MENUITEM "&About", 1900
END
END
MAKEIT.BAT
@echo off
: -------------------------------
: if resources exist, build them
: -------------------------------
if not exist rsrc.rc goto over1
\MASM32\BIN\Rc.exe /v rsrc.rc
\MASM32\BIN\Cvtres.exe /machine:ix86 rsrc.res
:over1
if exist %1.obj del MineDbg.obj
if exist %1.exe del MineDbg.exe
: -----------------------------------------
: assemble MineDbg.asm into an OBJ file
: -----------------------------------------
\MASM32\BIN\Ml.exe /c /coff /Zi MineDbg.asm
if errorlevel 1 goto errasm
if not exist rsrc.obj goto nores
: --------------------------------------------------
: link the main OBJ file with the resource OBJ file
: --------------------------------------------------
\MASM32\BIN\Link.exe /DEBUG /DEBUGTYPE:CV /SUBSYSTEM:WINDOWS MineDbg.obj rsrc.obj
if errorlevel 1 goto errlink
dir MineDbg.*
goto TheEnd
:errlink
: ----------------------------------------------------
: display message if there is an error during linking
: ----------------------------------------------------
echo.
echo There has been an error while linking this project.
echo.
goto TheEnd
:errasm
: -----------------------------------------------------
: display message if there is an error during assembly
: -----------------------------------------------------
echo.
echo There has been an error while assembling this project.
echo.
goto TheEnd
:TheEnd
pause
That's only the skeleton of MineDbg
invoke LoadMenu,hInst,600 ; menu ID
Error "Invalid data"... now have fun chasing that problem. There is a reason why I avoid rc files ;-)
(hint: it's a comma :biggrin:)
OK, I won't be mean: MENUITEM "Source mode", 1205,, MFS_CHECKED
(and don't ask me why, there is no logic in it but it works :bgrin:)
:greenclp:
But how did you find it ?!!
Or you already knew it, didn't you?
Anyway, thank you , Jochen!
I wish I found this hidden comma :-)
I think the resource statement is actually supposed to be:
MENUITEM "Source mode", 1205, MFT_STRING, MFS_CHECKED
Because whether I use MFT_STRING in the statement or leave the space between the commas empty, in this test app the menu displays correctly, GetMenuItemInfo returns the MFT_STRING type, and returns a pointer to the menu item string in the dwTypeData member:
;==============================================================================
; Build as a console app.
;==============================================================================
include \masm32\include\masm32rt.inc
;==============================================================================
.data
hInst HMODULE 0
hMenu HMENU 0
buffer db 100 dup(0)
FMASK = MIIM_FTYPE or MIIM_STATE or MIIM_STRING
mii MENUITEMINFO <SIZEOF MENUITEMINFO, FMASK,,,,,,,, OFFSET buffer, 100>
.code
;==============================================================================
DlgProc proc hwndDlg:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
SWITCH uMsg
CASE WM_INITDIALOG
invoke LoadMenu, hInst, 600
mov hMenu, eax
invoke SetMenu, hwndDlg, hMenu
invoke GetMenuItemInfo, hMenu, 1205, FALSE, ADDR mii
printf("%d\n", eax)
printf("fType %d\t%d\n", mii.MENUITEMINFO.fType, MFT_STRING )
printf("fState %d\t%d\n", mii.MENUITEMINFO.fState, MFS_CHECKED)
printf("dwTypeData %s\n", mii.MENUITEMINFO.dwTypeData)
CASE WM_COMMAND
SWITCH wParam
CASE IDCANCEL
invoke EndDialog, hwndDlg, 0
ENDSW
CASE WM_CLOSE
invoke EndDialog, hwndDlg, 0
ENDSW
return 0
DlgProc endp
;==============================================================================
start:
;==============================================================================
invoke GetModuleHandle, NULL
mov hInst, eax
Dialog "test", \
"MS Sans Serif",10, \
WS_VISIBLE or WS_OVERLAPPED or WS_SYSMENU or DS_CENTER, \
0,0,0,100,75,1024
CallModalDialog NULL,0,DlgProc,NULL
exit
;==============================================================================
end start
1
fType 0 0
fState 8 8
dwTypeData Source mode
Thank you, Michael!
Quote from: vertograd on March 24, 2013, 04:27:20 PM
Thank you, Michael!
Thanks from me, too, for showing me the missing logic :biggrin:
MENUITEM "text", ID, MFT_xxx, MFS_xxx
notice that the value of MFT_STRING is 0
so, you can use .... ,MFT_STRING, ....
or .... ,0, ....
or .... ,, ....
The old Win32.hlp is still very helpful.
Gone reading ...
Enforced by knowledge
I'll be back 8)
you can try this link, as well
http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms632680%28v=vs.85%29.aspx)
it also mentions the CreateWindow function, which i think is actually a c-compiler macro
CreateWindow calls CreateWindowEx, with lParam = 0
I want to upload an avatar. What size/format is allowed for it?
i use 130x130
not sure if there is a format requirement, but i think i used a PNG
i think there is a file size limit, but i forget what it is
as long as you don't try to use a hi-def BMP, you'll probably be alright - lol
I've tried to upload 209x209 jpeg but received an error "picture is either too large or is not an avatar"
looks like you got it :biggrin:
i was going to say - use Paint or something to convert it to a PNG file
Yes, I did :biggrin:
It was Paint I used to convert the picture