News:

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

Script Engine Beta 8

Started by hutch--, February 24, 2006, 01:56:27 AM

Previous topic - Next topic

hutch--

I have fixed the problem that Tim reported and this version has the beginning of console capacity.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Timbo

Hutch,

I have a concern regarding  structure simulation.  I know that this is not a feature of the script engine per se, but the problem I have encountered may be indicative of a problem with your allocation scheme.


;structure simulation: NOTIFYICONDATA
INTEGER  nid_cbSize           
INTEGER  nid_hwnd             
INTEGER  nid_uID             
INTEGER  nid_uFlags           
INTEGER  nid_uCallbackMessage
INTEGER  nid_hIcon           
STRING  $nid_szTip           

$nid_szTip = buffer$ 64
INTEGER &pIconData            ;pointer to NOTIFYICON struct
&pIconData = ptr nid_cbSize   ;initialization

INTEGER hScriptWin
AllocConsole                   
SetConsoleTitle "ConsoleDemo" ;we name the window so that it can be found by...
hScriptWin = dll "user32" "FindWindowA" 0 "ConsoleDemo" ;...a call to FindWindow
nid_cbSize = 88               ;structure is 88 bytes wide
nid_hwnd = hScriptWin
nid_uID = 1
nid_uFlags = 6                ;NIF_ICON + NIF_TIP
nid_uCallbackMessage = 0     
nid_hIcon = dll "user32" "LoadIconA" 0 32512 ;IDI_APPLICATION
; I suspect the problem is with the following line, althought it should work.
#1 = dll "kernel32" "lstrcpy" $nid_szTip "Console Demo"
#1 = dll "shell32" "Shell_NotifyIconA" 0 &pIconData

pause                         
#1 = dll "shell32" "Shell_NotifyIconA" 2 &pIconData
end


Is there anyway to provide syntax for arrays upon declaration?

Keep up the good work,

Tim

EDIT:  Syntax correction.

hutch--

Tim,

The types will not align at all. Integer arrays are sequential by design but string data is stored in seperate arrays of variable length strings so mixed integer and string structures will not work.

With the variable "$nid_szTip = buffer$ 64" I would try making it an integer variable then placing a sequence of dummy members after it to get the 64 byte buffer which will give you the correct buffer size of continuous memory but it then may be a problem adressing the space to write string data to it.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Timbo

Hutch,

Thanks.  It works flawlessly now. :U

;structure simulation: NOTIFYICONDATA
INTEGER  nid_cbSize           
INTEGER  nid_hwnd             
INTEGER  nid_uID             
INTEGER  nid_uFlags           
INTEGER  nid_uCallbackMessage
INTEGER  nid_hIcon           
INTEGER  nid_szTip;-----\     
INTEGER  nid_dummy1    ;|
INTEGER  nid_dummy2    ;|
INTEGER  nid_dummy3    ;|
INTEGER  nid_dummy4    ;|
INTEGER  nid_dummy5    ;|
INTEGER  nid_dummy6    ;|
INTEGER  nid_dummy7    ;| 64 byte string buffer
INTEGER  nid_dummy8    ;|
INTEGER  nid_dummy9    ;|
INTEGER  nid_dummy10   ;|
INTEGER  nid_dummy11   ;|
INTEGER  nid_dummy12   ;|
INTEGER  nid_dummy13   ;|
INTEGER  nid_dummy14   ;|
INTEGER  nid_dummy15;---/

INTEGER &pTipText
&pTipText = ptr nid_szTip
#1 = dll "kernel32" "RtlZeroMemory" &pTipText 64 ;zero the text buffer
INTEGER &pIconData            ;pointer to NOTIFYICONDATA struct
&pIconData = ptr nid_cbSize   ;initialization

INTEGER hScriptWin
AllocConsole                   
SetConsoleTitle "ConsoleDemo" ;we name the window so that it can be found by...
hScriptWin = dll "user32" "FindWindowA" 0 "ConsoleDemo" ;...a call to FindWindow
nid_cbSize = 88               ;structure is 88 bytes wide
nid_hwnd = hScriptWin
nid_uID = 1
nid_uFlags = 6                ;NIF_ICON + NIF_TIP
nid_uCallbackMessage = 0     
nid_hIcon = dll "user32" "LoadIconA" 0 32512 ;IDI_APPLICATION
#1 = dll "kernel32" "lstrcpy" &pTipText "Console Demo"
#1 = dll "shell32" "Shell_NotifyIconA" 0 &pIconData
pause                         
#1 = dll "shell32" "Shell_NotifyIconA" 2 &pIconData
end


Regards,

Tim

hutch--

#4
This works fine Tim. One thing, leave a space for any comment as it gives the wrong result otherwise.


INTEGER  nid_szTip;-----\  ; fails

INTEGER  nid_szTip ;-----\  ; works fine


LATER :

This works OK as well.


    INTEGER hInstance
    hInstance = dll "kernel32" "GetModuleHandleA" 0
    nid_hIcon = dll "shell32" "ExtractIconA" hInstance "cmd.exe" 0

    ;; nid_hIcon = dll "user32" "LoadIconA" 0 32512 ;IDI_APPLICATION
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php