4 * Copyright 2004 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
26 static HSZ hszProgmanTopic
;
27 static HSZ hszProgmanService
;
28 static HSZ hszAsterisk
;
30 static HSZ hszAppProperties
;
31 static HSZ hszFolders
;
33 static DWORD dwDDEInst
;
36 static BOOL __inline
Dde_OnConnect(HSZ hszTopic
, HSZ hszService
)
38 if ((hszTopic
== hszProgmanTopic
) && (hszService
== hszProgmanService
))
40 if ((hszTopic
== hszProgmanTopic
) && (hszService
== hszAppProperties
))
42 if ((hszTopic
== hszShell
) && (hszService
== hszFolders
))
44 if ((hszTopic
== hszShell
) && (hszService
== hszAppProperties
))
49 static void __inline
Dde_OnConnectConfirm(HCONV hconv
, HSZ hszTopic
, HSZ hszService
)
54 static BOOL __inline
Dde_OnWildConnect(HSZ hszTopic
, HSZ hszService
)
60 static HDDEDATA __inline
Dde_OnRequest(UINT uFmt
, HCONV hconv
, HSZ hszTopic
,
67 static DWORD __inline
Dde_OnExecute(HCONV hconv
, HSZ hszTopic
, HDDEDATA hdata
)
71 pszCommand
= DdeAccessData(hdata
, NULL
);
73 return DDE_FNOTPROCESSED
;
75 FIXME("stub: %s\n", pszCommand
);
77 DdeUnaccessData(hdata
);
79 return DDE_FNOTPROCESSED
;
82 static void __inline
Dde_OnDisconnect(HCONV hconv
)
87 static HDDEDATA CALLBACK
DdeCallback(
100 return (HDDEDATA
)(DWORD_PTR
)Dde_OnConnect(hsz1
, hsz2
);
101 case XTYP_CONNECT_CONFIRM
:
102 Dde_OnConnectConfirm(hconv
, hsz1
, hsz2
);
104 case XTYP_WILDCONNECT
:
105 return (HDDEDATA
)(DWORD_PTR
)Dde_OnWildConnect(hsz1
, hsz2
);
107 return Dde_OnRequest(uFmt
, hconv
, hsz1
, hsz2
);
109 return (HDDEDATA
)(DWORD_PTR
)Dde_OnExecute(hconv
, hsz1
, hdata
);
110 case XTYP_DISCONNECT
:
111 Dde_OnDisconnect(hconv
);
118 /*************************************************************************
119 * ShellDDEInit (SHELL32.@)
121 * Registers the Shell DDE services with the system so that applications
125 * bInit [I] TRUE to initialize the services, FALSE to uninitialize.
130 EXTERN_C
void WINAPI
ShellDDEInit(BOOL bInit
)
132 TRACE("bInit = %s\n", bInit
? "TRUE" : "FALSE");
136 static const WCHAR wszProgman
[] = {'P','r','o','g','m','a','n',0};
137 static const WCHAR wszAsterisk
[] = {'*',0};
138 static const WCHAR wszShell
[] = {'S','h','e','l','l',0};
139 static const WCHAR wszAppProperties
[] =
140 {'A','p','p','P','r','o','p','e','r','t','i','e','s',0};
141 static const WCHAR wszFolders
[] = {'F','o','l','d','e','r','s',0};
143 DdeInitializeW(&dwDDEInst
, DdeCallback
, CBF_FAIL_ADVISES
| CBF_FAIL_POKES
, 0);
145 hszProgmanTopic
= DdeCreateStringHandleW(dwDDEInst
, wszProgman
, CP_WINUNICODE
);
146 hszProgmanService
= DdeCreateStringHandleW(dwDDEInst
, wszProgman
, CP_WINUNICODE
);
147 hszAsterisk
= DdeCreateStringHandleW(dwDDEInst
, wszAsterisk
, CP_WINUNICODE
);
148 hszShell
= DdeCreateStringHandleW(dwDDEInst
, wszShell
, CP_WINUNICODE
);
149 hszAppProperties
= DdeCreateStringHandleW(dwDDEInst
, wszAppProperties
, CP_WINUNICODE
);
150 hszFolders
= DdeCreateStringHandleW(dwDDEInst
, wszFolders
, CP_WINUNICODE
);
152 DdeNameService(dwDDEInst
, hszFolders
, 0, DNS_REGISTER
);
153 DdeNameService(dwDDEInst
, hszProgmanService
, 0, DNS_REGISTER
);
154 DdeNameService(dwDDEInst
, hszShell
, 0, DNS_REGISTER
);
158 /* unregister all services */
159 DdeNameService(dwDDEInst
, 0, 0, DNS_UNREGISTER
);
161 DdeFreeStringHandle(dwDDEInst
, hszFolders
);
162 DdeFreeStringHandle(dwDDEInst
, hszAppProperties
);
163 DdeFreeStringHandle(dwDDEInst
, hszShell
);
164 DdeFreeStringHandle(dwDDEInst
, hszAsterisk
);
165 DdeFreeStringHandle(dwDDEInst
, hszProgmanService
);
166 DdeFreeStringHandle(dwDDEInst
, hszProgmanTopic
);
168 DdeUninitialize(dwDDEInst
);