This function removed in QM 2.3.4. Instead use __ProcessMemory class. If you have code from QM forum with this function, look here for new version.
Not available in exe.
int* share([window])
window - top-level or child window that belongs to the application with which will be used shared memory.
If you try to use SendMessage function to get or set data in other application (other than QM) using pointer or string, in most cases it will not work, and may crash the application or damage its data. It is because the pointer is in address space of QM, and is invalid in address space of other application. The solution is to use shared memory.
QM provides 1 KB of shared memory that macros can use. Function share returns its address. It returns different value for each application (although physical memory is the same, but applications use different address to access it). Call share twice: Call it without window argument to get shared memory address in QM context. Call it with window argument to get shared memory address in context of the application to which belongs the window. Use the first address (possibly with some offset) to get and/or set data. Pass the second address (possibly with some offset) to that application (usually as lParam of SendMessage).
Always use lock _share when using shared memory. It prevents using shared memory by multiple simultaneously running threads. See examples. Read about lock.
Pass address of a variable of a user-defined type lock _share VARIABLETYPE* variable=+share memset(variable 0 sizeof(VARIABLETYPE)) variable.member1=value1 variable.member2=value2 SendMessage(hwnd message wparam share(hwnd)) out variable.member1 lock- _share Set status bar text int hwnd=child("" "msctls_statusbar32" "Notepad" 0x1) str text="text from QM" lock _share strcpy(+share text) SendMessage(hwnd SB_SETTEXT 0 share(hwnd)) lock- _share Get toolbar button text int hwnd=child("Notification Area" "ToolbarWindow32" "+Shell_TrayWnd" 0x1) int buttonID=0 lock _share SendMessage(hwnd TB_GETBUTTONTEXT buttonID share(hwnd)) str s.get(+share 0) lock- _share out s Get SysListView32 control item text int hwnd=child("FolderView" "SysListView32" "My QM" 0x1) int item=0 lock _share LVITEM* lip=share ;;in QM context LVITEM* lip2=share(hwnd) ;;in hlv context memset(lip 0 sizeof(LVITEM)) int stringoffset=sizeof(LVITEM)+20 lip.pszText=+(lip2+stringoffset) ;;in hlv context lip.cchTextMax=260 lip.mask=LVIF_TEXT SendMessage(hwnd LVM_GETITEMTEXT item lip2) str s.get(+lip stringoffset) lock- _share out s