Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

register.c

Go to the documentation of this file.
00001 00002 /****************************** Module Header ******************************\ 00003 * Module Name: register.c 00004 * 00005 * Copyright (c) 1985 - 1999, Microsoft Corporation 00006 * 00007 * DDE Manager - server registration module 00008 * 00009 * Created: 4/15/94 sanfords 00010 * to allow interoperability between DDEML16 and DDEML32 00011 \***************************************************************************/ 00012 00013 #include "precomp.h" 00014 #pragma hdrstop 00015 00016 /* 00017 * interoperable DDEML service registration is accomplished via the 00018 * two messages UM_REGISTER and UM_UNREGISTER. (WM_USER range) 00019 * wParam=gaApp, 00020 * lParam=src hwndListen, (for instance specific HSZ generation.) 00021 * These messages are sent and the sender is responsible for freeing 00022 * the gaApp. 00023 */ 00024 00025 00026 /* 00027 * Broadcast-sends the given message to all top-level windows of szClass 00028 * except to hwndSkip. 00029 */ 00030 VOID SendRegisterMessageToClass( 00031 ATOM atomClass, 00032 UINT msg, 00033 GATOM ga, 00034 HWND hwndFrom, 00035 BOOL fPost) 00036 { 00037 HWND hwnd; 00038 PWND pwnd; 00039 PCLS pcls; 00040 00041 hwnd = GetWindow(GetDesktopWindow(), GW_CHILD); 00042 while (hwnd != NULL) { 00043 pwnd=ValidateHwndNoRip(hwnd); 00044 if (pwnd) { 00045 pcls = (PCLS)REBASEALWAYS(pwnd, pcls); 00046 if (pcls->atomClassName == atomClass) { 00047 IncGlobalAtomCount(ga); // receiver frees 00048 if (fPost) { 00049 PostMessage(hwnd, msg, (WPARAM)ga, (LPARAM)hwndFrom); 00050 } else { 00051 SendMessage(hwnd, msg, (WPARAM)ga, (LPARAM)hwndFrom); 00052 } 00053 } 00054 } 00055 hwnd = GetWindow(hwnd, GW_HWNDNEXT); 00056 } 00057 } 00058 00059 00060 /* 00061 * Broadcast-sends a UM_REGISTER or UM_UNREGISTER message to all DDEML16 00062 * and DDEML32 listening windows in the system except hwndListen. 00063 * 00064 * We post Registration messages to prevent DdeConnectList recursion 00065 * and send Unregistration messages to avoid invalid source window 00066 * errors. 00067 */ 00068 VOID RegisterService( 00069 BOOL fRegister, 00070 GATOM gaApp, 00071 HWND hwndListen) 00072 { 00073 CheckDDECritOut; 00074 00075 /* 00076 * Send notification to each DDEML32 listening window. 00077 */ 00078 SendRegisterMessageToClass(gpsi->atomSysClass[ICLS_DDEMLMOTHER], fRegister ? UM_REGISTER : UM_UNREGISTER, 00079 gaApp, hwndListen, fRegister); 00080 /* 00081 * Send notification to each DDEML16 listening window. 00082 */ 00083 SendRegisterMessageToClass(gpsi->atomSysClass[ICLS_DDEML16BIT], fRegister ? UM_REGISTER : UM_UNREGISTER, 00084 gaApp, hwndListen, fRegister); 00085 } 00086 00087 00088 00089 00090 LRESULT ProcessRegistrationMessage( 00091 HWND hwnd, 00092 UINT msg, 00093 WPARAM wParam, 00094 LPARAM lParam) 00095 { 00096 PCL_INSTANCE_INFO pcii; 00097 LRESULT lRet = 0; 00098 00099 CheckDDECritOut; 00100 00101 /* 00102 * wParam = GATOM of app 00103 * lParam = hwndListen of source - may be a WOW DDEML source unthunked. 00104 */ 00105 lParam = (LPARAM)HMValidateHandleNoRip((HWND)lParam, TYPE_WINDOW); 00106 lParam = (LPARAM)PtoH((PVOID)lParam); 00107 00108 if (lParam == 0) { 00109 return(0); 00110 } 00111 00112 EnterDDECrit; 00113 00114 pcii = (PCL_INSTANCE_INFO)GetWindowLongPtr(hwnd, GWLP_INSTANCE_INFO); 00115 if (pcii != NULL && 00116 !((msg == UM_REGISTER) && (pcii->afCmd & CBF_SKIP_REGISTRATIONS)) && 00117 !((msg == UM_UNREGISTER) && (pcii->afCmd & CBF_SKIP_UNREGISTRATIONS))) { 00118 00119 LATOM la, lais; 00120 00121 la = GlobalToLocalAtom((GATOM)wParam); 00122 lais = MakeInstSpecificAtom(la, (HWND)lParam); 00123 00124 DoCallback(pcii, 00125 (WORD)((msg == UM_REGISTER) ? XTYP_REGISTER : XTYP_UNREGISTER), 00126 0, 00127 (HCONV)0L, 00128 (HSZ)NORMAL_HSZ_FROM_LATOM(la), 00129 INST_SPECIFIC_HSZ_FROM_LATOM(lais), 00130 (HDDEDATA)0L, 00131 0L, 00132 0L); 00133 00134 DeleteAtom(la); 00135 DeleteAtom(lais); 00136 lRet = 1; 00137 } 00138 00139 GlobalDeleteAtom((ATOM)wParam); // receiver frees 00140 LeaveDDECrit; 00141 return(1); 00142 }

Generated on Sat May 15 19:41:37 2004 for test by doxygen 1.3.7