flat assembler
Message board for the users of flat assembler.
Index
> IDE Development > SysTray template bug? |
Author |
|
madmatt 26 Dec 2005, 01:25
are you writing this with the Fresh IDE? You need to include the windows headers.
|
|||
26 Dec 2005, 01:25 |
|
shism2 26 Dec 2005, 02:44
That was the frm code... This is the.asm code
Code: format PE GUI 4.0 entry Start include '%finc%\win32\win32a.inc' include '%finc%\libs\msgutils.inc' include '%finc%\libs\strlib.inc' include '%finc%\libs\templates.inc' include '%finc%\libs\TForm.inc' include '%finc%\libs\parents.inc' section '.code' code readable executable ..ShowSizes = 1 ..ShowSkipped = 0 include '%finc%\libs\msgutils.asm' include '%finc%\libs\strlib.asm' include '%finc%\libs\templates.asm' include '%finc%\libs\TForm.asm' include '%finc%\libs\parents.asm' include 'mainwindow.frm' uglobal hMainForm dd ? hInstance dd ? endg Start: invoke GetModuleHandle, 0 mov [hInstance], eax InitializeAll stdcall CreateForm, frmMainWindow, NULL mov [hMainForm],ebx include '%finc%\libs\mainloop.asm' push eax FinalizeAll invoke ExitProcess section '.idata' data import readable writeable ImportTable: include '%finc%\win32\allimports.asm' DispSize 'ImportTable', $ - ImportTable section '.data' data readable writeable IncludeAllGlobals |
|||
26 Dec 2005, 02:44 |
|
Madis731 26 Dec 2005, 10:36
Code: mov dword[nid.szTip],"Tray" mov dword[nid.szTip+4], "Demo" I see you have nid defined, but how does FASM know what is this szTip? I'm sorry if I'm misleading you because I haven't coded with Fresh, but this part feels suspicious. |
|||
26 Dec 2005, 10:36 |
|
shism2 26 Dec 2005, 17:52
because it's in the shell32 equates..For some reason it just doesn't want to except it... I think it's a bug. Can anyone please help me with this sigh...
|
|||
26 Dec 2005, 17:52 |
|
madmatt 26 Dec 2005, 22:26
The variables are not getting defined. I looked in the fresh includes, and noticed a macro called 'IncludeAllGlobals'. I think this macro defines all the data in there proper place. Somewhere in your code put a single line of code:
Code: IncludeAllGlobals I don't use fresh, but I've read the information in some of the threads and think this will fix the problem. |
|||
26 Dec 2005, 22:26 |
|
shism2 26 Dec 2005, 23:54
still didn't fix it
|
|||
26 Dec 2005, 23:54 |
|
decard 27 Dec 2005, 08:22
Sorry, it was my fault. I didn't update win32a.inc file properly, and SysTray template wasn't updated to new macros too. Here's valid win32a.inc for Fresh:
Code: ; Win32 programming headers (ASCII) ;======================================================================== ; Macro library options ;======================================================================== ..ShowSizes = 1 ; if 1 - displays the messages passed through ; DispSize macro. ..ShowUserMessages = 1 ; if 1 - displays list with user defined Windows ; messages - names and values, created by "message" ; macro. include '../macro/struct.inc' include '../macro/exceptions.inc' include '../macro/proc32.inc' include '../macro/proc32ex.inc' include '../macro/import32.inc' include '../macro/export.inc' include '../macro/display.inc' include '../macro/globals.inc' struc CHAR val { match any, val \{ . db val \} match , val \{ . db ? \} } include 'equates/kernel32.inc' include 'equates/user32.inc' include 'equates/gdi32.inc' include 'equates/comctl32.inc' include 'equates/comdlg32.inc' include 'equates/shell32.inc' include 'equates/wsock32.inc' and mainwindow.fpr (just paste and replace all): Code: PM_SHELLNOTIFY = WM_USER + 1 IDI_TRAY = 0 IDM_EXIT = 100 IDM_SHOWHIDE = 101 iglobal szShowHide db "&Show/Hide", 0 szExit db "&Exit", 0 endg uglobal nid NOTIFYICONDATA uVisibleFlag dd ? hTrayMenu dd ? endg winproc MainWindowProc ondefault stc ret onmessage FM_AFTERCREATE mov [nid.cbSize],sizeof.NOTIFYICONDATA ; prepare tray icon push [hwnd] pop [nid.hWnd] mov [nid.uID],IDI_TRAY mov [nid.uFlags],NIF_ICON+NIF_MESSAGE+NIF_TIP mov [nid.uCallbackMessage],PM_SHELLNOTIFY invoke LoadIcon, NULL,IDI_WINLOGO mov [nid.hIcon],eax mov dword[nid.szTip],"Tray" mov dword[nid.szTip+4], "Demo" invoke Shell_NotifyIcon, NIM_ADD,nid invoke CreatePopupMenu ; create tray popup menu - here you mov [hTrayMenu],eax ; can add your own menu items invoke AppendMenu, eax,MF_STRING,IDM_SHOWHIDE,szShowHide invoke AppendMenu, [hTrayMenu],MF_STRING,IDM_EXIT,szExit clc ret onmessage WM_DESTROY invoke Shell_NotifyIcon, NIM_DELETE,nid invoke DestroyMenu, [hTrayMenu] invoke PostQuitMessage, 0 clc ret onmessage WM_COMMAND cmp [lparam],0 jne .ondefault mov eax,[wparam] ; handle tray popup menu actions cmp eax,IDM_SHOWHIDE ; je .showhide cmp eax,IDM_EXIT je .idm_exit stc ret .idm_exit: invoke DestroyWindow, [hwnd] clc ret onmessage WM_CLOSE jmp .hide onmessage PM_SHELLNOTIFY ; handle tray icons actions: locals ; left mouse button - show/hide window .pt POINT ; right mouse button - show tray popup menu endl cmp [lparam],WM_LBUTTONDOWN je .showhide cmp [lparam],WM_RBUTTONDOWN je .show_tray_popup jmp .finish .showhide: cmp [uVisibleFlag],0 je .show .hide: invoke ShowWindow, [hwnd],SW_HIDE mov [uVisibleFlag], 0 jmp .finish .show: invoke ShowWindow, [hwnd],SW_SHOW mov [uVisibleFlag], 1 invoke SetActiveWindow, [hwnd] jmp .finish .show_tray_popup: lea eax,[.pt] invoke GetCursorPos, eax invoke SetForegroundWindow, [hwnd] invoke TrackPopupMenu, [hTrayMenu],TPM_RIGHTALIGN,[.pt.x],[.pt.y],\ NULL,[hwnd],NULL invoke PostMessage, [hwnd],WM_NULL,0,0 .finish: clc ret endwp Now it compiles OK. |
|||
27 Dec 2005, 08:22 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.