0. Are there any good masm win32 gui tutorials out there? for creating gui objects like a tabbed settings window etc ...


1. What is the difference between variables in the uninitialized data section [.data?] having just a ? after them, versus a <?> ...

2. How can all of this data fit within a byte?


teststuff  DB  "blahhhhh",0
              DB "edffgefersaSSSSSSSSSSSS",00


?

3. I am using some code i found in iczeleons tutorial for a tray icon.


IDM_RESTORE EQU 1000
IDM_EXIT EQU 1010

....

INVOKE AppendMenu, hPopupMenu, MF_STRING, IDM_RESTORE, ADDR szRestore
INVOKE AppendMenu, hPopupMenu, MF_STRING, MyIP, ADDR szIP
INVOKE AppendMenu, hPopupMenu, MF_SEPARATOR, NULL, NULL
INVOKE AppendMenu, hPopupMenu, MF_GRAYED, IDM_RESTORE, ADDR szWebsite
INVOKE AppendMenu, hPopupMenu, MF_GRAYED, IDM_RESTORE, ADDR szAbout
INVOKE AppendMenu, hPopupMenu, MF_SEPARATOR, NULL, NULL
INVOKE AppendMenu, hPopupMenu, MF_GRAYED, IDM_RESTORE, ADDR szSettings
INVOKE AppendMenu, hPopupMenu, MF_SEPARATOR, NULL, NULL
INVOKE AppendMenu, hPopupMenu, MF_STRING, IDM_EXIT, ADDR szExit



I want to be able to somehow call a function instead of IDM_RESTORE or IDM_EXIT ...
Are those EQU just codes somewhere in an include file for exiting or restoring a program from the tray?
Posted on 2006-07-20 17:10:56 by p0wder
1. generally you use < and > when dealing with structures, but they are defined to be used for any literal string definition. In any account, the ? is commonly used by certain assemblers because it signafies that the data is unknown. In the uninitialized data section, the data doesn't always end up being 0, and the initial value is unknown.

2. That data isn't fitting into one byte. The code is creating an array of bytes. One byte per character. Therefore, using:

mytext DB "HELLO", 0


Is exactly the same as typing:

mytext DB 'H', 'E', 'L', 'L', 'O', 0


or:

mytext DB 48H
      DB 45H
      DB 4CH
      DB 4CH
      DB 4FH
      DB 00h


3. AppendMenu API sets what identifier will be used to reference the menu item. This gets checked during the WM_COMMAND message handler in the WndProc. In short, no you can't set that to be just a procedure. What you can do, is check the WM_COMMAND message, and call your procedure from there.
Posted on 2006-07-20 17:36:14 by Synfire
0. PlatformSDK documentation has some samples (any many snippets) inside. Every Windows control is the same: (1) You create it just like any other window (of course you properly set any control-specific parameters), (2) you send it messeges via SendMessage, or equivalent, (3) you respond to its messages via your message queue. In Platform SDK documentation every control has its 'functions', 'messages' and 'notifications' described thoroughly.

1. The main difference is that uninitialized data doesn't occupy the exe. It is all summed up and declared as "this exe requires XXX KBs of RAM". This memory is allocated when you start your exe and is -well- uninitialized (may contain garbage before you set it to any meaningful values). In practice, however, it's filled with zeros, but every documentation says that you must not depend on this behavior (you must assume that it contains garbage). Try allocating 3072 bytes in the uninitialized section and the same in the initialized section. The final exe will grow by 3KB because it'll contain 3072 bytes from initialized section.

2. As Synfire has already said: DB is special, because it allows you to create strings of bytes. db "blah"    is 4 bytes. It is just for convenience. Otherwise it would be overkill if you wanted to copy Hamlet to your program :P
Posted on 2006-07-20 23:02:19 by ti_mo_n
Alright what exactly does "IDM" stand for?

I tried to implement what you suggested ...


IDM_MYIP EQU 3


		INVOKE AppendMenu, hPopupMenu, MF_STRING, IDM_MYIP, ADDR szIP


	.ELSEIF uMsg == WM_COMMAND
.IF lParam == 0
INVOKE Shell_NotifyIcon, NIM_DELETE, ADDR note
MOV EAX, wParam
.IF AX == IDM_RESTORE
INVOKE ShowWindow, hWnd, SW_RESTORE
.ELSE
INVOKE DestroyWindow, hWnd
.ENDIF
.ENDIF
.IF lParam == 3
INVOKE MyIP
.ENDIF


Shouldnt it be checking if the IDM_MYIP matches the message send to WM_COMMAND, then executing my function MyIP?
Posted on 2006-07-21 11:17:45 by p0wder
Usually IDM is used in conjunction with Menu's IDM(enu) or with Controls IDC(ontrol) and Static Controls IDS(tatic). It's just a way to organize your Identifiers.

Also the ID of the control gets sent in the LOWORD of the lParam parameter. So therefore you should use it as follows:

.ELSEIF uMsg == WM_COMMAND
mov eax, lParam
and eax, 0FFFFh ;keep only lower 2 bytes of eax : Lower word of lParam
.IF eax == 0 ;what exactly is 0?
INVOKE Shell_NotifyIcon, NIM_DELETE, ADDR note
MOV EAX, wParam
.IF AX == IDM_RESTORE
INVOKE ShowWindow, hWnd, SW_RESTORE
.ELSE
INVOKE DestroyWindow, hWnd
.ENDIF
.ELSEIF eax == IDM_MYIP
INVOKE MyIP
.ENDIF
Posted on 2006-07-21 11:36:18 by JimmyClif
;what exactly is 0?


When a WM_COMMAND message is recieved, lParam will contain the handle to the control which sent the message. If the message was sent by something other than a control, like a menu or accelerator, then the value of lParam will be NULL.


I tried to implement what you suggested ...

	.ELSEIF uMsg == WM_COMMAND
.IF lParam == 0
INVOKE Shell_NotifyIcon, NIM_DELETE, ADDR note
MOV EAX, wParam
.IF AX == IDM_RESTORE
INVOKE ShowWindow, hWnd, SW_RESTORE
.ELSE
INVOKE DestroyWindow, hWnd
.ENDIF
.ENDIF
.IF lParam == 3
INVOKE MyIP
.ENDIF


Shouldnt it be checking if the IDM_MYIP matches the message send to WM_COMMAND, then executing my function MyIP?


The notification code is sent through wParam not lParam.


.ELSEIF uMsg == WM_COMMAND
.IF lParam == 0
INVOKE Shell_NotifyIcon, NIM_DELETE, ADDR note
MOV EAX, wParam
.IF AX == IDM_RESTORE
INVOKE ShowWindow, hWnd, SW_RESTORE
.ELSEIF AX == IDM_MYIP
INVOKE MyIP
.ELSE
INVOKE DestroyWindow, hWnd
.ENDIF
.ENDIF


Regards,
Bryant Keller
Posted on 2006-07-22 04:18:54 by Synfire
You're absolutely right. Sorry for my misleading and confusing post. It must have been late for me ;)
Posted on 2006-07-22 07:46:22 by JimmyClif
Just curious ... when my function is invoked (it is a function to display a popup) it pops a window up, then instead of staying in the tray, the program just stays in the background with no tray icon ...?
Posted on 2006-07-22 13:11:33 by p0wder