test: srvmsg.c Source File

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

# srvmsg.c

Go to the documentation of this file.

    00001 /****************************** Module Header ******************************\
    00002 * Module Name: srvmsg.c
    00003 *
    00004 * Copyright (c) 1985 - 1999, Microsoft Corporation
    00005 *
    00006 * Includes the mapping table for messages when calling the client.
    00007 *
    00008 * 04-11-91 ScottLu      Created.
    00009 \***************************************************************************/
    00010
    00011 #include "precomp.h"
    00012 #pragma hdrstop
    00013
    00014 #define SfnDDEINIT               SfnDWORD
    00015 #define SfnKERNELONLY            SfnDWORD
    00016
    00017 #ifdef FE_SB
    00018 /*
    00019  * SfnEMGETSEL, SfnSETSEL, SfnGBGETEDITSEL
    00020  */
    00021 #define SfnEMGETSEL              SfnOPTOUTLPDWORDOPTOUTLPDWORD
    00022 #define SfnEMSETSEL              SfnDWORD
    00023 #define SfnCBGETEDITSEL          SfnOPTOUTLPDWORDOPTOUTLPDWORD
    00024 #endif // FE_SB
    00025
    00026 #define MSGFN(func) Sfn ## func
    00027 #define FNSCSENDMESSAGE SFNSCSENDMESSAGE
    00028 #include <messages.h>
    00029
    00030 /***************************************************************************\
    00031 * fnINLBOXSTRING
    00032 *
    00033 * Takes a lbox string - a string that treats lParam as a string pointer or
    00034 * a DWORD depending on LBS_HASSTRINGS and ownerdraw.
    00035 *
    00036 * 04-12-91 ScottLu      Created.
    00037 \***************************************************************************/
    00038
    00039 LRESULT SfnINLBOXSTRING(
    00040     PWND pwnd,
    00041     UINT msg,
    00042     WPARAM wParam,
    00043     LPARAM lParam,
    00044     ULONG_PTR xParam,
    00045     PROC xpfn,
    00046     DWORD dwSCMSFlags,
    00047     PSMS psms)
    00048 {
    00049     DWORD dw;
    00050
    00051     /*
    00052      * See if the control is ownerdraw and does not have the LBS_HASSTRINGS
    00053      * style.  If so, treat lParam as a DWORD.
    00054      */
    00055     if (!RevalidateHwnd(HW(pwnd))) {
    00056         return 0L;
    00057     }
    00058     dw = pwnd->style;
    00059
    00060     if (!(dw & LBS_HASSTRINGS) &&
    00061             (dw & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE))) {
    00062
    00063         /*
    00064          * Treat lParam as a dword.
    00065          */
    00066         return SfnDWORD(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms);
    00067     }
    00068
    00069     /*
    00070      * Treat as a string pointer.   Some messages allowed or had certain
    00071      * error codes for NULL so send them through the NULL allowed thunk.
    00072      * Ventura Publisher does this
    00073      */
    00074     switch (msg) {
    00075         default:
    00076             return SfnINSTRING(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms);
    00077             break;
    00078
    00079         case LB_FINDSTRING:
    00080             return SfnINSTRINGNULL(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms);
    00081             break;
    00082     }
    00083 }
    00084
    00085
    00086 /***************************************************************************\
    00087 * SfnOUTLBOXSTRING
    00088 *
    00089 * Returns an lbox string - a string that treats lParam as a string pointer or
    00090 * a DWORD depending on LBS_HASSTRINGS and ownerdraw.
    00091 *
    00092 * 04-12-91 ScottLu      Created.
    00093 \***************************************************************************/
    00094
    00095 LRESULT SfnOUTLBOXSTRING(
    00096     PWND pwnd,
    00097     UINT msg,
    00098     WPARAM wParam,
    00099     LPARAM lParam,
    00100     ULONG_PTR xParam,
    00101     PROC xpfn,
    00102     DWORD dwSCMSFlags,
    00103     PSMS psms)
    00104 {
    00105     DWORD dw;
    00106     BOOL bNotString;
    00107     DWORD dwRet;
    00108     TL tlpwnd;
    00109
    00110     /*
    00111      * See if the control is ownerdraw and does not have the LBS_HASSTRINGS
    00112      * style.  If so, treat lParam as a DWORD.
    00113      */
    00114     if (!RevalidateHwnd(HW(pwnd))) {
    00115         return 0L;
    00116     }
    00117     dw = pwnd->style;
    00118
    00119     /*
    00120      * See if the control is ownerdraw and does not have the LBS_HASSTRINGS
    00121      * style.  If so, treat lParam as a DWORD.
    00122      */
    00123     bNotString =  (!(dw & LBS_HASSTRINGS) &&
    00124             (dw & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE)));
    00125
    00126     /*
    00127      * Make this special call which'll know how to copy this string.
    00128      */
    00129     ThreadLock(pwnd, &tlpwnd);
    00130     dwRet = ClientGetListboxString(pwnd, msg, wParam,
    00131             (PLARGE_UNICODE_STRING)lParam,
    00132             xParam, xpfn, dwSCMSFlags, bNotString, psms);
    00133     ThreadUnlock(&tlpwnd);
    00134     return dwRet;
    00135 }
    00136
    00137
    00138 /***************************************************************************\
    00139 * fnINCBOXSTRING
    00140 *
    00141 * Takes a lbox string - a string that treats lParam as a string pointer or
    00142 * a DWORD depending on CBS_HASSTRINGS and ownerdraw.
    00143 *
    00144 * 04-12-91 ScottLu      Created.
    00145 \***************************************************************************/
    00146
    00147 LRESULT SfnINCBOXSTRING(
    00148     PWND pwnd,
    00149     UINT msg,
    00150     WPARAM wParam,
    00151     LPARAM lParam,
    00152     ULONG_PTR xParam,
    00153     PROC xpfn,
    00154     DWORD dwSCMSFlags,
    00155     PSMS psms)
    00156 {
    00157     DWORD dw;
    00158
    00159     /*
    00160      * See if the control is ownerdraw and does not have the CBS_HASSTRINGS
    00161      * style.  If so, treat lParam as a DWORD.
    00162      */
    00163     if (!RevalidateHwnd(HW(pwnd))) {
    00164         return 0L;
    00165     }
    00166     dw = pwnd->style;
    00167
    00168     if (!(dw & CBS_HASSTRINGS) &&
    00169             (dw & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))) {
    00170
    00171         /*
    00172          * Treat lParam as a dword.
    00173          */
    00174         return SfnDWORD(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms);
    00175     }
    00176
    00177     /*
    00178      * Treat as a string pointer.   Some messages allowed or had certain
    00179      * error codes for NULL so send them through the NULL allowed thunk.
    00180      * Ventura Publisher does this
    00181      */
    00182     switch (msg) {
    00183         default:
    00184             return SfnINSTRING(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms);
    00185             break;
    00186
    00187         case CB_FINDSTRING:
    00188             return SfnINSTRINGNULL(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms);
    00189             break;
    00190     }
    00191 }
    00192
    00193
    00194 /***************************************************************************\
    00195 * fnOUTCBOXSTRING
    00196 *
    00197 * Returns an lbox string - a string that treats lParam as a string pointer or
    00198 * a DWORD depending on CBS_HASSTRINGS and ownerdraw.
    00199 *
    00200 * 04-12-91 ScottLu      Created.
    00201 \***************************************************************************/
    00202
    00203 LRESULT SfnOUTCBOXSTRING(
    00204     PWND pwnd,
    00205     UINT msg,
    00206     WPARAM wParam,
    00207     LPARAM lParam,
    00208     ULONG_PTR xParam,
    00209     PROC xpfn,
    00210     DWORD dwSCMSFlags,
    00211     PSMS psms)
    00212 {
    00213     DWORD dw;
    00214     BOOL bNotString;
    00215     DWORD dwRet;
    00216     TL tlpwnd;
    00217
    00218     /*
    00219      * See if the control is ownerdraw and does not have the CBS_HASSTRINGS
    00220      * style.  If so, treat lParam as a DWORD.
    00221      */
    00222
    00223     if (!RevalidateHwnd(HW(pwnd))) {
    00224         return 0L;
    00225     }
    00226     dw = pwnd->style;
    00227
    00228     bNotString = (!(dw & CBS_HASSTRINGS) &&
    00229             (dw & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)));
    00230
    00231     /*
    00232      * Make this special call which'll know how to copy this string.
    00233      */
    00234     ThreadLock(pwnd, &tlpwnd);
    00235     dwRet = ClientGetListboxString(pwnd, msg, wParam,
    00236             (PLARGE_UNICODE_STRING)lParam,
    00237             xParam, xpfn, dwSCMSFlags, bNotString, psms);
    00238     ThreadUnlock(&tlpwnd);
    00239     return dwRet;
    00240 }
    00241
    00242
    00243 /***************************************************************************\
    00244 * fnPOWERBROADCAST
    00245 *
    00246 * Make sure we send the correct message when we resume.
    00247 *
    00248 * History:
    00249 * 02-Dec-1996 JerrySh   Created.
    00250 \***************************************************************************/
    00251
    00252 LRESULT SfnPOWERBROADCAST(
    00253     PWND pwnd,
    00254     UINT msg,
    00255     WPARAM wParam,
    00256     LPARAM lParam,
    00257     ULONG_PTR xParam,
    00258     PROC xpfn,
    00259     DWORD dwSCMSFlags,
    00260     PSMS psms)
    00261 {
    00262     switch (wParam) {
    00263     case PBT_APMQUERYSUSPEND:
    00264         SetWF(pwnd, WFGOTQUERYSUSPENDMSG);
    00265         break;
    00266     case PBT_APMQUERYSUSPENDFAILED:
    00267         if (!TestWF(pwnd, WFGOTQUERYSUSPENDMSG))
    00268             return 0;
    00269         ClrWF(pwnd, WFGOTQUERYSUSPENDMSG);
    00270         break;
    00271     case PBT_APMSUSPEND:
    00272         ClrWF(pwnd, WFGOTQUERYSUSPENDMSG);
    00273         SetWF(pwnd, WFGOTSUSPENDMSG);
    00274         break;
    00275     case PBT_APMRESUMESUSPEND:
    00276         if (TestWF(pwnd, WFGOTSUSPENDMSG)) {
    00277             break;
    00278         }
    00279         wParam = PBT_APMRESUMECRITICAL;
    00280         // FALL THRU
    00281     case PBT_APMRESUMECRITICAL:
    00282         ClrWF(pwnd, WFGOTQUERYSUSPENDMSG);
    00283         ClrWF(pwnd, WFGOTSUSPENDMSG);
    00284         break;
    00285     }
    00286
    00287     return SfnDWORD(pwnd, msg, wParam, lParam, xParam, xpfn, dwSCMSFlags, psms);
    00288 }
    00289
    00290