News:

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

How fill structure in data block?

Started by bomz, July 01, 2011, 08:34:33 PM

Previous topic - Next topic

bomz

wc WNDCLASSEX <sizeof wc, NULL, \
offset WndProc, 0, 0, 0, \
0, 0, COLOR_WINDOW+1, 0, \
offset ClassName, 0>


.data
note1 NOTIFYICONDATA <sizeof NOTIFYICONDATA, 0, IDI_TRAY, \
NIF_ICON+NIF_MESSAGE+NIF_TIP, WM_SHELLNOTIFY, 0,
db 'AppName',0
0,0,\
TCHAR[256], 0, TCHAR[64], 0, 0>


jj2007

Quote from: bomz on July 01, 2011, 08:34:33 PM
.data
note1 NOTIFYICONDATA <sizeof NOTIFYICONDATA, 0, IDI_TRAY, \
NIF_ICON+NIF_MESSAGE+NIF_TIP, WM_SHELLNOTIFY, 0,
db 'AppName'>


Windows.inc:

NOTIFYICONDATAA STRUCT
  cbSize            DWORD      ?
  hwnd              DWORD      ?
  uID               DWORD      ?
  uFlags            DWORD      ?
  uCallbackMessage  DWORD      ?
  hIcon             DWORD      ?
  szTip             BYTE 64 dup (?)
NOTIFYICONDATAA ENDS

bomz

typedef struct _NOTIFYICONDATA {
  DWORD cbSize;
  HWND  hWnd;
  UINT  uID;
  UINT  uFlags;
  UINT  uCallbackMessage;
  HICON hIcon;
  TCHAR szTip[64];
  DWORD dwState;
  DWORD dwStateMask;
  TCHAR szInfo[256];
  union {
    UINT uTimeout;
    UINT uVersion;
  };
  TCHAR szInfoTitle[64];
  DWORD dwInfoFlags;
  GUID  guidItem;
  HICON hBalloonIcon;
} NOTIFYICONDATA, *PNOTIFYICONDATA;


http://msdn.microsoft.com/en-us/library/bb773352%28v=vs.85%29.aspx
I saw here. My mistake


bomz

note NOTIFYICONDATA <sizeof NOTIFYICONDATA, 0, IDI_TRAY, \
NIF_ICON+NIF_MESSAGE+NIF_TIP, WM_SHELLNOTIFY, 0, \
'ClipBoard'>



jj2007

Sometimes Windows.inc contains a simpler structure version, compatible with older OS versions such as Win 98 or Win 2000.
The cbSize member allows the newer Windows versions to recognise how to treat the structure, and to apply e.g. default values to new members that are not present in the legacy version.

bomz



I am making hard optimizing of code

qWord

Quote from: bomz on July 01, 2011, 09:22:11 PM
I am making hard optimizing of code
sry to say, but this optimization is sensless and may be also dangerous  ::)
(BTW: it is a very bad idea to combine (style-)flags using '+')
FPU in a trice: SmplMath
It's that simple!

bomz

+ no equal OR? I use + for economy places in string

bomz

dangerous?

what sence in fill structure inside code?

qWord

Quote from: bomz on July 01, 2011, 09:42:38 PM
+ no equal OR?
0101y or 0100y = 0101y
0101y +  0100y = 1001y


Quote from: bomz on July 01, 2011, 09:44:56 PM
dangerous?

what sence in fill structure inside code?
it is not thread save - there is no problem, as long as not using this structure from more than one thread.
FPU in a trice: SmplMath
It's that simple!

bomz

what difference if I use one variable in two threads I fill it in code or in data?

jj2007

Quote from: bomz on July 01, 2011, 09:59:54 PM
what difference if I use one variable in two threads I fill it in code or in data?

Actually, it is "thread safer" in the .code section because it will be read-only anyway...

bomz

wc WNDCLASSEX <sizeof wc, NULL, \
offset WndProc, 0, 0, 0, \
0, 0, COLOR_WINDOW+1, 0, \
offset ClassName, 0>
note NOTIFYICONDATA <sizeof NOTIFYICONDATA, 0, IDI_TRAY, \
NIF_ICON+NIF_MESSAGE+NIF_TIP, WM_SHELLNOTIFY, 0, \
'ClipBoard'>
ofn OPENFILENAME <sizeof OPENFILENAME, 0, 0, offset FileFilter,\
0, 0, 0, offset SaveAs, MAX_PATH, 0, 0, 0, offset AppName, \
OFN_PATHMUSTEXIST OR OFN_LONGNAMES OR OFN_EXPLORER OR OFN_HIDEREADONLY OR OFN_OVERWRITEPROMPT,\
0, 0, 0, 0, 0, 0>
findtext FINDREPLACE <sizeof FINDREPLACE, 0, 0, \
FR_FINDNEXT+FR_HIDEWHOLEWORD+FR_DOWN+FR_DIALOGTERM,\
offset FindBuffer, 0, sizeof FindBuffer, 0, 0, 0, \
offset AppName>
shellinfo SHELLEXECUTEINFO <sizeof shellinfo, 40h, 0, offset edit, \
offset EditFile, 0, 0, 1, 0, 0, 0, 0, 0>
EDITOR GUITHREADINFO < sizeof GUITHREADINFO, 0, 0, 0, 0, 0, 0, 0, <0, 0> >


This do - all works

bomz

read only if you do so:

jmp @F
string db 'kolbasa-seledka',0
@@:

This String you can't change. Ypu may use it only in code under this strings