/* Return the button with TAG and assigned to INSPECTOR. TAG must be given without the suffix. Returns NULL if not found. */ static LPDISPATCH get_button (LPDISPATCH inspector, const char *tag) { LPDISPATCH result = NULL; inspector_info_t iinfo; button_list_t ol; lock_all_inspectors (); for (iinfo = all_inspectors; iinfo; iinfo = iinfo->next) if (iinfo->inspector == inspector) { for (ol = iinfo->buttons; ol; ol = ol->next) if (ol->tag && !strcmp (ol->tag, tag)) { result = ol->button; if (result) result->AddRef (); break; } break; } unlock_all_inspectors (); return result; }
LPDISPATCH Change::GetDocument() { LPDISPATCH lpDisp = NULL; lpDisp = (LPDISPATCH)m_pDoc->GetInterface(&IID_IDispatch); if (lpDisp) lpDisp->AddRef(); return lpDisp; }
/* Search through all objects and find the inspector which has a the window handle HWND. Returns NULL if not found. */ LPDISPATCH get_inspector_from_hwnd (HWND hwnd) { LPDISPATCH result = NULL; inspector_info_t iinfo; lock_all_inspectors (); for (iinfo = all_inspectors; iinfo; iinfo = iinfo->next) if (iinfo->hwnd == hwnd) { result = iinfo->inspector; if (result) result->AddRef (); break; } unlock_all_inspectors (); return result; }
/* Search through all objects and find the inspector which has a button with the instance id INSTID. Returns NULL if not found. */ static LPDISPATCH get_inspector_from_instid (int instid) { LPDISPATCH result = NULL; inspector_info_t iinfo; button_list_t ol; lock_all_inspectors (); for (iinfo = all_inspectors; iinfo; iinfo = iinfo->next) for (ol = iinfo->buttons; ol; ol = ol->next) if (ol->instid == instid) { result = iinfo->inspector; if (result) result->AddRef (); break; } unlock_all_inspectors (); return result; }