How do I calculate the size of each element in a structure? For example, there is a structure called _NOTIFYICONDATA and I'm trying to know the sizes for the 64 bit build. MSDN says, ( <!-- m -->http://msdn.microsof... ... 73352.aspx<!-- m --> )
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;Assuming there is hIcon already and the script is trying to set it as the tray icon. How do I set the offsets of each NumPut command? I'd like to know how the offets are calculated such as 4, 8, 12, 20. And what numbers are supposed to be put for the 64 bit build?By the way I put "uint" for the type parameter since most x64 compatible scripts do it.
#NoTrayIcon #Persistent Type := (A_PtrSize=8) ? "uint" : "" VarSetCapacity( NID, 444, 0 ) NumPut( 444, NID, Type ) NumPut( A_ScriptHwnd, NID, 4 + ((A_PtrSize=8) ? 4 : 0), Type) NumPut( 1028, NID, 8 + ((A_PtrSize=8) ? 4 : 0), Type) NumPut( 2, NID, 12 + ((A_PtrSize=8) ? 4 : 0), Type ) NumPut( hIcon, NID, 20 + ((A_PtrSize=8) ? 4 : 0), Type) Menu, Tray, Icon ; Show the default Tray icon .. DllCall( "shell32\Shell_NotifyIcon", Ptr,0x1, Ptr, &NID ) ; .. and immediately modify itThanks.




