Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygendde.cpp
Go to the documentation of this file.
00001 /* 00002 * Shell DDE Handling 00003 * 00004 * Copyright 2004 Robert Shearman 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include <precomp.h> 00022 00023 WINE_DEFAULT_DEBUG_CHANNEL(shell); 00024 00025 /* String handles */ 00026 static HSZ hszProgmanTopic; 00027 static HSZ hszProgmanService; 00028 static HSZ hszAsterisk; 00029 static HSZ hszShell; 00030 static HSZ hszAppProperties; 00031 static HSZ hszFolders; 00032 /* DDE Instance ID */ 00033 static DWORD dwDDEInst; 00034 00035 00036 static BOOL __inline Dde_OnConnect(HSZ hszTopic, HSZ hszService) 00037 { 00038 if ((hszTopic == hszProgmanTopic) && (hszService == hszProgmanService)) 00039 return TRUE; 00040 if ((hszTopic == hszProgmanTopic) && (hszService == hszAppProperties)) 00041 return TRUE; 00042 if ((hszTopic == hszShell) && (hszService == hszFolders)) 00043 return TRUE; 00044 if ((hszTopic == hszShell) && (hszService == hszAppProperties)) 00045 return TRUE; 00046 return FALSE; 00047 } 00048 00049 static void __inline Dde_OnConnectConfirm(HCONV hconv, HSZ hszTopic, HSZ hszService) 00050 { 00051 FIXME("stub\n"); 00052 } 00053 00054 static BOOL __inline Dde_OnWildConnect(HSZ hszTopic, HSZ hszService) 00055 { 00056 FIXME("stub\n"); 00057 return FALSE; 00058 } 00059 00060 static HDDEDATA __inline Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, 00061 HSZ hszItem) 00062 { 00063 FIXME("stub\n"); 00064 return NULL; 00065 } 00066 00067 static DWORD __inline Dde_OnExecute(HCONV hconv, HSZ hszTopic, HDDEDATA hdata) 00068 { 00069 BYTE * pszCommand; 00070 00071 pszCommand = DdeAccessData(hdata, NULL); 00072 if (!pszCommand) 00073 return DDE_FNOTPROCESSED; 00074 00075 FIXME("stub: %s\n", pszCommand); 00076 00077 DdeUnaccessData(hdata); 00078 00079 return DDE_FNOTPROCESSED; 00080 } 00081 00082 static void __inline Dde_OnDisconnect(HCONV hconv) 00083 { 00084 FIXME("stub\n"); 00085 } 00086 00087 static HDDEDATA CALLBACK DdeCallback( 00088 UINT uType, 00089 UINT uFmt, 00090 HCONV hconv, 00091 HSZ hsz1, 00092 HSZ hsz2, 00093 HDDEDATA hdata, 00094 ULONG_PTR dwData1, 00095 ULONG_PTR dwData2) 00096 { 00097 switch (uType) 00098 { 00099 case XTYP_CONNECT: 00100 return (HDDEDATA)(DWORD_PTR)Dde_OnConnect(hsz1, hsz2); 00101 case XTYP_CONNECT_CONFIRM: 00102 Dde_OnConnectConfirm(hconv, hsz1, hsz2); 00103 return NULL; 00104 case XTYP_WILDCONNECT: 00105 return (HDDEDATA)(DWORD_PTR)Dde_OnWildConnect(hsz1, hsz2); 00106 case XTYP_REQUEST: 00107 return Dde_OnRequest(uFmt, hconv, hsz1, hsz2); 00108 case XTYP_EXECUTE: 00109 return (HDDEDATA)(DWORD_PTR)Dde_OnExecute(hconv, hsz1, hdata); 00110 case XTYP_DISCONNECT: 00111 Dde_OnDisconnect(hconv); 00112 return NULL; 00113 default: 00114 return NULL; 00115 } 00116 } 00117 00118 /************************************************************************* 00119 * ShellDDEInit (SHELL32.@) 00120 * 00121 * Registers the Shell DDE services with the system so that applications 00122 * can use them. 00123 * 00124 * PARAMS 00125 * bInit [I] TRUE to initialize the services, FALSE to uninitalize. 00126 * 00127 * RETURNS 00128 * Nothing. 00129 */ 00130 EXTERN_C void WINAPI ShellDDEInit(BOOL bInit) 00131 { 00132 TRACE("bInit = %s\n", bInit ? "TRUE" : "FALSE"); 00133 00134 if (bInit) 00135 { 00136 static const WCHAR wszProgman[] = {'P','r','o','g','m','a','n',0}; 00137 static const WCHAR wszAsterisk[] = {'*',0}; 00138 static const WCHAR wszShell[] = {'S','h','e','l','l',0}; 00139 static const WCHAR wszAppProperties[] = 00140 {'A','p','p','P','r','o','p','e','r','t','i','e','s',0}; 00141 static const WCHAR wszFolders[] = {'F','o','l','d','e','r','s',0}; 00142 00143 DdeInitializeW(&dwDDEInst, DdeCallback, CBF_FAIL_ADVISES | CBF_FAIL_POKES, 0); 00144 00145 hszProgmanTopic = DdeCreateStringHandleW(dwDDEInst, wszProgman, CP_WINUNICODE); 00146 hszProgmanService = DdeCreateStringHandleW(dwDDEInst, wszProgman, CP_WINUNICODE); 00147 hszAsterisk = DdeCreateStringHandleW(dwDDEInst, wszAsterisk, CP_WINUNICODE); 00148 hszShell = DdeCreateStringHandleW(dwDDEInst, wszShell, CP_WINUNICODE); 00149 hszAppProperties = DdeCreateStringHandleW(dwDDEInst, wszAppProperties, CP_WINUNICODE); 00150 hszFolders = DdeCreateStringHandleW(dwDDEInst, wszFolders, CP_WINUNICODE); 00151 00152 DdeNameService(dwDDEInst, hszFolders, 0, DNS_REGISTER); 00153 DdeNameService(dwDDEInst, hszProgmanService, 0, DNS_REGISTER); 00154 DdeNameService(dwDDEInst, hszShell, 0, DNS_REGISTER); 00155 } 00156 else 00157 { 00158 /* unregister all services */ 00159 DdeNameService(dwDDEInst, 0, 0, DNS_UNREGISTER); 00160 00161 DdeFreeStringHandle(dwDDEInst, hszFolders); 00162 DdeFreeStringHandle(dwDDEInst, hszAppProperties); 00163 DdeFreeStringHandle(dwDDEInst, hszShell); 00164 DdeFreeStringHandle(dwDDEInst, hszAsterisk); 00165 DdeFreeStringHandle(dwDDEInst, hszProgmanService); 00166 DdeFreeStringHandle(dwDDEInst, hszProgmanTopic); 00167 00168 DdeUninitialize(dwDDEInst); 00169 } 00170 } Generated on Sun May 27 2012 04:26:16 for ReactOS by
1.7.6.1
|