| 1 | /* $Id: comdlg32.cpp,v 1.19 1999-11-10 12:18:28 phaller Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * COMDLG32 implementation
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright 1998 Sander van Leeuwen
|
|---|
| 7 | * Copyright 1999 Patrick Haller
|
|---|
| 8 | *
|
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 10 | *
|
|---|
| 11 | */
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | /****************************************************************************
|
|---|
| 15 | * Includes *
|
|---|
| 16 | ****************************************************************************/
|
|---|
| 17 |
|
|---|
| 18 | #include <os2win.h>
|
|---|
| 19 | #include <stdarg.h>
|
|---|
| 20 | #include <stdlib.h>
|
|---|
| 21 | #include <string.h>
|
|---|
| 22 | #include <misc.h>
|
|---|
| 23 | #include <odinwrap.h>
|
|---|
| 24 | #include <wndproc.h>
|
|---|
| 25 | #include <win32wnd.h>
|
|---|
| 26 |
|
|---|
| 27 | ODINDEBUGCHANNEL(COMDLG32-COMDLG32)
|
|---|
| 28 |
|
|---|
| 29 | #if 0
|
|---|
| 30 | #define COMDLG32_CHECKHOOK(a,b,c) \
|
|---|
| 31 | if(a->Flags & b) \
|
|---|
| 32 | { \
|
|---|
| 33 | wndproc = CreateWindowProc((WNDPROC)a->lpfnHook);\
|
|---|
| 34 | if(wndproc == NULL) \
|
|---|
| 35 | return(FALSE); \
|
|---|
| 36 | \
|
|---|
| 37 | a->lpfnHook = (c)Win32WindowProc::GetOS2Callback();\
|
|---|
| 38 | } \
|
|---|
| 39 | a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
|
|---|
| 40 |
|
|---|
| 41 | #define COMDLG32_CHECKHOOK2(a,b,c,d) \
|
|---|
| 42 | if(a->Flags & b) \
|
|---|
| 43 | { \
|
|---|
| 44 | wndproc = CreateWindowProc((WNDPROC)a->d);\
|
|---|
| 45 | if(wndproc == NULL) \
|
|---|
| 46 | return(FALSE); \
|
|---|
| 47 | \
|
|---|
| 48 | a->d = (c)Win32WindowProc::GetOS2Callback();\
|
|---|
| 49 | } \
|
|---|
| 50 | a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
|
|---|
| 51 | #else
|
|---|
| 52 | #define COMDLG32_CHECKHOOK(a,b,c) \
|
|---|
| 53 | if(a->Flags & b) \
|
|---|
| 54 | { \
|
|---|
| 55 | a->lpfnHook = 0; \
|
|---|
| 56 | } \
|
|---|
| 57 | a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
|
|---|
| 58 |
|
|---|
| 59 | #define COMDLG32_CHECKHOOK2(a,b,c,d) \
|
|---|
| 60 | if(a->Flags & b) \
|
|---|
| 61 | { \
|
|---|
| 62 | a->d = 0; \
|
|---|
| 63 | } \
|
|---|
| 64 | a->hwndOwner = Win32ToOS2Handle(a->hwndOwner);
|
|---|
| 65 | #endif
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | /*****************************************************************************
|
|---|
| 69 | * Name : iFileDlg_ScanFilterToken
|
|---|
| 70 | * Purpose : scan for valid / invalid filter tokens and
|
|---|
| 71 | * advance array pointer
|
|---|
| 72 | * Parameters:
|
|---|
| 73 | * Variables :
|
|---|
| 74 | * Result :
|
|---|
| 75 | * Remark :
|
|---|
| 76 | * Status :
|
|---|
| 77 | *
|
|---|
| 78 | * Author :
|
|---|
| 79 | *****************************************************************************/
|
|---|
| 80 |
|
|---|
| 81 | // scan filter tokens for validity
|
|---|
| 82 | static BOOL iFileDlg_ScanFilterToken( LPSTR *plpstrPair )
|
|---|
| 83 | {
|
|---|
| 84 | LPSTR lpstrTemp;
|
|---|
| 85 | LPSTR lpstrNext;
|
|---|
| 86 | BOOL fOK = TRUE;
|
|---|
| 87 |
|
|---|
| 88 | lpstrTemp = *plpstrPair;
|
|---|
| 89 | if (lpstrTemp[0] != 0)
|
|---|
| 90 | {
|
|---|
| 91 | // get filter description
|
|---|
| 92 | lpstrTemp = lpstrTemp + strlen(lpstrTemp);
|
|---|
| 93 | lpstrNext = lpstrTemp + 1;
|
|---|
| 94 | if (lpstrNext[0] == 0)
|
|---|
| 95 | fOK = FALSE;
|
|---|
| 96 | else
|
|---|
| 97 | {
|
|---|
| 98 | // get filter mask
|
|---|
| 99 | lpstrTemp = lpstrNext;
|
|---|
| 100 | lpstrTemp = lpstrTemp + strlen(lpstrTemp);
|
|---|
| 101 | lpstrTemp++;
|
|---|
| 102 | }
|
|---|
| 103 |
|
|---|
| 104 | if (fOK)
|
|---|
| 105 | *plpstrPair = lpstrTemp;
|
|---|
| 106 | }
|
|---|
| 107 | return fOK;
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 | /*****************************************************************************
|
|---|
| 112 | * Name : iFileDlg_CleanFilterArray
|
|---|
| 113 | * Purpose : remove erroneous array entries at the end to prevent
|
|---|
| 114 | * Open32 complain about them but open the file dialog
|
|---|
| 115 | * instead.
|
|---|
| 116 | * Parameters:
|
|---|
| 117 | * Variables :
|
|---|
| 118 | * Result :
|
|---|
| 119 | * Remark :
|
|---|
| 120 | * Status :
|
|---|
| 121 | *
|
|---|
| 122 | * Author :
|
|---|
| 123 | *****************************************************************************/
|
|---|
| 124 |
|
|---|
| 125 | static DWORD iFileDlg_CleanFilterArray( LPSTR lpstrFilters)
|
|---|
| 126 | {
|
|---|
| 127 | DWORD dwCount = 0;
|
|---|
| 128 | LPSTR lpstrTemp;
|
|---|
| 129 |
|
|---|
| 130 | if (lpstrFilters && *lpstrFilters)
|
|---|
| 131 | {
|
|---|
| 132 | lpstrTemp = lpstrFilters;
|
|---|
| 133 | while (lpstrTemp[0] != 0)
|
|---|
| 134 | {
|
|---|
| 135 | // if an invalid filter token is found, such as found
|
|---|
| 136 | // in NT4's Regedit e. g., return number of proper
|
|---|
| 137 | // filter tokens.
|
|---|
| 138 | // Here however, as were calling Open32, we need
|
|---|
| 139 | // to correct the filter array.
|
|---|
| 140 | if (iFileDlg_ScanFilterToken(&lpstrTemp) == FALSE)
|
|---|
| 141 | {
|
|---|
| 142 | //@@@PH two alternative methods:
|
|---|
| 143 | // - copy array to new, corrected array while scanning tokens
|
|---|
| 144 | // - just overwrite bogus characters at the end of the array
|
|---|
| 145 | *lpstrTemp++ = 0; // try string termination
|
|---|
| 146 | *lpstrTemp = 0;
|
|---|
| 147 | return dwCount;
|
|---|
| 148 | }
|
|---|
| 149 |
|
|---|
| 150 | dwCount++;
|
|---|
| 151 | }
|
|---|
| 152 | }
|
|---|
| 153 | return dwCount;
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 |
|
|---|
| 157 | /*****************************************************************************
|
|---|
| 158 | * Name :
|
|---|
| 159 | * Purpose :
|
|---|
| 160 | * Parameters:
|
|---|
| 161 | * Variables :
|
|---|
| 162 | * Result :
|
|---|
| 163 | * Remark :
|
|---|
| 164 | * Status :
|
|---|
| 165 | *
|
|---|
| 166 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 167 | *****************************************************************************/
|
|---|
| 168 |
|
|---|
| 169 | ODINFUNCTION1(BOOL, GetSaveFileNameA,
|
|---|
| 170 | LPOPENFILENAMEA, lpofn)
|
|---|
| 171 | {
|
|---|
| 172 | Win32WindowProc *wndproc;
|
|---|
| 173 |
|
|---|
| 174 | if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) {
|
|---|
| 175 | return GetFileDialog95A(lpofn, SAVE_DIALOG);
|
|---|
| 176 | }
|
|---|
| 177 |
|
|---|
| 178 | COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
|
|---|
| 179 |
|
|---|
| 180 | //Note: fix IBM's proper error checking for NT's lazy check
|
|---|
| 181 | if (lpofn->lpstrFilter != NULL)
|
|---|
| 182 | iFileDlg_CleanFilterArray((LPSTR)lpofn->lpstrFilter);
|
|---|
| 183 |
|
|---|
| 184 | return(O32_GetSaveFileName(lpofn));
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 |
|
|---|
| 188 | /*****************************************************************************
|
|---|
| 189 | * Name :
|
|---|
| 190 | * Purpose :
|
|---|
| 191 | * Parameters:
|
|---|
| 192 | * Variables :
|
|---|
| 193 | * Result :
|
|---|
| 194 | * Remark :
|
|---|
| 195 | * Status :
|
|---|
| 196 | *
|
|---|
| 197 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 198 | *****************************************************************************/
|
|---|
| 199 |
|
|---|
| 200 | ODINFUNCTION1(BOOL, GetSaveFileNameW,
|
|---|
| 201 | LPOPENFILENAMEW, lpofn)
|
|---|
| 202 | {
|
|---|
| 203 | Win32WindowProc *wndproc;
|
|---|
| 204 | OPENFILENAMEA ofn;
|
|---|
| 205 | char* szFile;
|
|---|
| 206 | char* szFileTitle;
|
|---|
| 207 | char* szCustFilter;
|
|---|
| 208 | BOOL bResult;
|
|---|
| 209 |
|
|---|
| 210 | if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) {
|
|---|
| 211 | return GetFileDialog95W(lpofn, SAVE_DIALOG);
|
|---|
| 212 | }
|
|---|
| 213 |
|
|---|
| 214 | memcpy(&ofn, // make binary copy first to save all the fields
|
|---|
| 215 | lpofn,
|
|---|
| 216 | sizeof(ofn));
|
|---|
| 217 |
|
|---|
| 218 | // convert to ASCII string
|
|---|
| 219 | if ((lpofn->Flags && OFN_ENABLETEMPLATE) &&
|
|---|
| 220 | (lpofn->lpTemplateName != NULL))
|
|---|
| 221 | ofn.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpofn->lpTemplateName);
|
|---|
| 222 | else
|
|---|
| 223 | ofn.lpTemplateName = NULL;
|
|---|
| 224 |
|
|---|
| 225 | if (lpofn->lpstrFilter != NULL)
|
|---|
| 226 | ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
|
|---|
| 227 |
|
|---|
| 228 | if (lpofn->lpstrInitialDir != NULL)
|
|---|
| 229 | ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
|
|---|
| 230 |
|
|---|
| 231 | if (lpofn->lpstrTitle != NULL)
|
|---|
| 232 | ofn.lpstrTitle = UnicodeToAsciiString((WCHAR*)lpofn->lpstrTitle);
|
|---|
| 233 |
|
|---|
| 234 | if (lpofn->lpstrDefExt != NULL)
|
|---|
| 235 | ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
|
|---|
| 236 |
|
|---|
| 237 | szFile = (char*)malloc(lpofn->nMaxFile);
|
|---|
| 238 | szFile[0] = 0;
|
|---|
| 239 |
|
|---|
| 240 | if (*lpofn->lpstrFile != 0)
|
|---|
| 241 | UnicodeToAscii(lpofn->lpstrFile,
|
|---|
| 242 | szFile);
|
|---|
| 243 |
|
|---|
| 244 | if (lpofn->lpstrFileTitle != NULL)
|
|---|
| 245 | {
|
|---|
| 246 | szFileTitle = (char*)malloc(lpofn->nMaxFileTitle);
|
|---|
| 247 | szFileTitle[0] = 0;
|
|---|
| 248 |
|
|---|
| 249 | if (*lpofn->lpstrFileTitle != 0)
|
|---|
| 250 | UnicodeToAscii(lpofn->lpstrFileTitle,
|
|---|
| 251 | szFileTitle);
|
|---|
| 252 | }
|
|---|
| 253 | else
|
|---|
| 254 | szFileTitle = NULL;
|
|---|
| 255 |
|
|---|
| 256 | if (lpofn->lpstrCustomFilter != NULL)
|
|---|
| 257 | {
|
|---|
| 258 | szCustFilter = (char*)malloc(lpofn->nMaxCustFilter);
|
|---|
| 259 | szCustFilter[0] = 0;
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 | if (*lpofn->lpstrCustomFilter != 0)
|
|---|
| 263 | UnicodeToAscii(lpofn->lpstrCustomFilter,
|
|---|
| 264 | szCustFilter);
|
|---|
| 265 | }
|
|---|
| 266 | else
|
|---|
| 267 | szCustFilter = NULL;
|
|---|
| 268 |
|
|---|
| 269 | ofn.lpstrFile = szFile;
|
|---|
| 270 | ofn.lpstrFileTitle = szFileTitle;
|
|---|
| 271 | ofn.lpstrCustomFilter = szCustFilter;
|
|---|
| 272 |
|
|---|
| 273 | // call ascii variant of function
|
|---|
| 274 | // @@@PH switch to ODIN_GetSaveFileNameA later
|
|---|
| 275 | bResult = GetSaveFileNameA(&ofn);
|
|---|
| 276 |
|
|---|
| 277 | if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
|
|---|
| 278 | if (ofn.lpstrFilter != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
|
|---|
| 279 | if (ofn.lpstrInitialDir != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
|
|---|
| 280 | if (ofn.lpstrTitle != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
|
|---|
| 281 | if (ofn.lpstrDefExt != NULL) FreeAsciiString((char*)ofn.lpstrDefExt);
|
|---|
| 282 |
|
|---|
| 283 | // transform back the result
|
|---|
| 284 | AsciiToUnicode(ofn.lpstrFile,
|
|---|
| 285 | lpofn->lpstrFile);
|
|---|
| 286 | free(szFile);
|
|---|
| 287 |
|
|---|
| 288 | if (lpofn->lpstrFileTitle != NULL)
|
|---|
| 289 | {
|
|---|
| 290 | AsciiToUnicode(ofn.lpstrFileTitle,
|
|---|
| 291 | lpofn->lpstrFileTitle);
|
|---|
| 292 | free(szFileTitle);
|
|---|
| 293 | }
|
|---|
| 294 |
|
|---|
| 295 | if (lpofn->lpstrCustomFilter != NULL)
|
|---|
| 296 | {
|
|---|
| 297 | AsciiToUnicode(ofn.lpstrCustomFilter,
|
|---|
| 298 | lpofn->lpstrCustomFilter);
|
|---|
| 299 | free(szCustFilter);
|
|---|
| 300 | }
|
|---|
| 301 |
|
|---|
| 302 | // copy over some altered flags
|
|---|
| 303 | lpofn->nFilterIndex = ofn.nFilterIndex;
|
|---|
| 304 | lpofn->Flags = ofn.Flags;
|
|---|
| 305 | lpofn->nFileOffset = ofn.nFileOffset;
|
|---|
| 306 | lpofn->nFileExtension = ofn.nFileExtension;
|
|---|
| 307 |
|
|---|
| 308 | return bResult;
|
|---|
| 309 | }
|
|---|
| 310 |
|
|---|
| 311 | /*****************************************************************************
|
|---|
| 312 | * Name :
|
|---|
| 313 | * Purpose :
|
|---|
| 314 | * Parameters:
|
|---|
| 315 | * Variables :
|
|---|
| 316 | * Result :
|
|---|
| 317 | * Remark :
|
|---|
| 318 | * Status :
|
|---|
| 319 | *
|
|---|
| 320 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 321 | *****************************************************************************/
|
|---|
| 322 |
|
|---|
| 323 | ODINFUNCTION1(BOOL, GetOpenFileNameA,
|
|---|
| 324 | LPOPENFILENAMEA, lpofn)
|
|---|
| 325 | {
|
|---|
| 326 | Win32WindowProc *wndproc;
|
|---|
| 327 |
|
|---|
| 328 | if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE))
|
|---|
| 329 | {
|
|---|
| 330 | return GetFileDialog95A(lpofn, OPEN_DIALOG);
|
|---|
| 331 | }
|
|---|
| 332 | COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC)
|
|---|
| 333 |
|
|---|
| 334 | //Note: fix IBM's proper error checking for NT's lazy check
|
|---|
| 335 | if (lpofn->lpstrFilter != NULL)
|
|---|
| 336 | iFileDlg_CleanFilterArray((LPSTR)lpofn->lpstrFilter);
|
|---|
| 337 |
|
|---|
| 338 | return(O32_GetOpenFileName(lpofn));
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | /*****************************************************************************
|
|---|
| 342 | * Name :
|
|---|
| 343 | * Purpose :
|
|---|
| 344 | * Parameters:
|
|---|
| 345 | * Variables :
|
|---|
| 346 | * Result :
|
|---|
| 347 | * Remark :
|
|---|
| 348 | * Status :
|
|---|
| 349 | *
|
|---|
| 350 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 351 | *****************************************************************************/
|
|---|
| 352 |
|
|---|
| 353 | ODINFUNCTION1(BOOL, GetOpenFileNameW,
|
|---|
| 354 | LPOPENFILENAMEW, lpofn)
|
|---|
| 355 | {
|
|---|
| 356 | Win32WindowProc *wndproc;
|
|---|
| 357 | OPENFILENAMEA ofn;
|
|---|
| 358 | char* szFile;
|
|---|
| 359 | char* szFileTitle;
|
|---|
| 360 | char* szCustFilter;
|
|---|
| 361 | BOOL bResult;
|
|---|
| 362 |
|
|---|
| 363 | if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) {
|
|---|
| 364 | return GetFileDialog95W(lpofn, OPEN_DIALOG);
|
|---|
| 365 | }
|
|---|
| 366 |
|
|---|
| 367 | memcpy(&ofn, // make binary copy first to save all the fields
|
|---|
| 368 | lpofn,
|
|---|
| 369 | sizeof(ofn));
|
|---|
| 370 |
|
|---|
| 371 | // convert to ASCII string
|
|---|
| 372 | if ((lpofn->Flags && OFN_ENABLETEMPLATE) &&
|
|---|
| 373 | (lpofn->lpTemplateName != NULL))
|
|---|
| 374 | ofn.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpofn->lpTemplateName);
|
|---|
| 375 | else
|
|---|
| 376 | ofn.lpTemplateName = NULL;
|
|---|
| 377 |
|
|---|
| 378 | if (lpofn->lpstrFilter != NULL)
|
|---|
| 379 | ofn.lpstrFilter = UnicodeToAsciiString((WCHAR*)lpofn->lpstrFilter);
|
|---|
| 380 |
|
|---|
| 381 | if (lpofn->lpstrInitialDir != NULL)
|
|---|
| 382 | ofn.lpstrInitialDir = UnicodeToAsciiString((WCHAR*)lpofn->lpstrInitialDir);
|
|---|
| 383 |
|
|---|
| 384 | if (lpofn->lpstrTitle != NULL)
|
|---|
| 385 | ofn.lpstrTitle = UnicodeToAsciiString((WCHAR*)lpofn->lpstrTitle);
|
|---|
| 386 |
|
|---|
| 387 | if (lpofn->lpstrDefExt != NULL)
|
|---|
| 388 | ofn.lpstrDefExt = UnicodeToAsciiString((WCHAR*)lpofn->lpstrDefExt);
|
|---|
| 389 |
|
|---|
| 390 | szFile = (char*)malloc(lpofn->nMaxFile);
|
|---|
| 391 | szFile[0] = 0;
|
|---|
| 392 |
|
|---|
| 393 | if (*lpofn->lpstrFile != 0)
|
|---|
| 394 | UnicodeToAscii(lpofn->lpstrFile,
|
|---|
| 395 | szFile);
|
|---|
| 396 |
|
|---|
| 397 | if (lpofn->lpstrFileTitle != NULL)
|
|---|
| 398 | {
|
|---|
| 399 | szFileTitle = (char*)malloc(lpofn->nMaxFileTitle);
|
|---|
| 400 | szFileTitle[0] = 0;
|
|---|
| 401 |
|
|---|
| 402 | if (*lpofn->lpstrFileTitle != 0)
|
|---|
| 403 | UnicodeToAscii(lpofn->lpstrFileTitle,
|
|---|
| 404 | szFileTitle);
|
|---|
| 405 | }
|
|---|
| 406 | else
|
|---|
| 407 | szFileTitle = NULL;
|
|---|
| 408 |
|
|---|
| 409 | if (lpofn->lpstrCustomFilter != NULL)
|
|---|
| 410 | {
|
|---|
| 411 | szCustFilter = (char*)malloc(lpofn->nMaxCustFilter);
|
|---|
| 412 | szCustFilter[0] = 0;
|
|---|
| 413 |
|
|---|
| 414 |
|
|---|
| 415 | if (*lpofn->lpstrCustomFilter != 0)
|
|---|
| 416 | UnicodeToAscii(lpofn->lpstrCustomFilter,
|
|---|
| 417 | szCustFilter);
|
|---|
| 418 | }
|
|---|
| 419 | else
|
|---|
| 420 | szCustFilter = NULL;
|
|---|
| 421 |
|
|---|
| 422 | ofn.lpstrFile = szFile;
|
|---|
| 423 | ofn.lpstrFileTitle = szFileTitle;
|
|---|
| 424 | ofn.lpstrCustomFilter = szCustFilter;
|
|---|
| 425 |
|
|---|
| 426 | // call ascii variant of function
|
|---|
| 427 | // @@@PH switch to ODIN_GetOpenFileNameA later
|
|---|
| 428 | bResult = GetOpenFileNameA(&ofn);
|
|---|
| 429 |
|
|---|
| 430 | if (ofn.lpTemplateName != NULL) FreeAsciiString((char*)ofn.lpTemplateName);
|
|---|
| 431 | if (ofn.lpstrFilter != NULL) FreeAsciiString((char*)ofn.lpstrFilter);
|
|---|
| 432 | if (ofn.lpstrInitialDir != NULL) FreeAsciiString((char*)ofn.lpstrInitialDir);
|
|---|
| 433 | if (ofn.lpstrTitle != NULL) FreeAsciiString((char*)ofn.lpstrTitle);
|
|---|
| 434 | if (ofn.lpstrDefExt != NULL) FreeAsciiString((char*)ofn.lpstrDefExt);
|
|---|
| 435 |
|
|---|
| 436 | // transform back the result
|
|---|
| 437 | AsciiToUnicode(ofn.lpstrFile,
|
|---|
| 438 | lpofn->lpstrFile);
|
|---|
| 439 | free(szFile);
|
|---|
| 440 |
|
|---|
| 441 | if (lpofn->lpstrFileTitle != NULL)
|
|---|
| 442 | {
|
|---|
| 443 | AsciiToUnicode(ofn.lpstrFileTitle,
|
|---|
| 444 | lpofn->lpstrFileTitle);
|
|---|
| 445 | free(szFileTitle);
|
|---|
| 446 | }
|
|---|
| 447 |
|
|---|
| 448 | if (lpofn->lpstrCustomFilter != NULL)
|
|---|
| 449 | {
|
|---|
| 450 | AsciiToUnicode(ofn.lpstrCustomFilter,
|
|---|
| 451 | lpofn->lpstrCustomFilter);
|
|---|
| 452 | free(szCustFilter);
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 | // copy over some altered flags
|
|---|
| 456 | lpofn->nFilterIndex = ofn.nFilterIndex;
|
|---|
| 457 | lpofn->Flags = ofn.Flags;
|
|---|
| 458 | lpofn->nFileOffset = ofn.nFileOffset;
|
|---|
| 459 | lpofn->nFileExtension = ofn.nFileExtension;
|
|---|
| 460 |
|
|---|
| 461 | return bResult;
|
|---|
| 462 | }
|
|---|
| 463 |
|
|---|
| 464 | /*****************************************************************************
|
|---|
| 465 | * Name :
|
|---|
| 466 | * Purpose :
|
|---|
| 467 | * Parameters:
|
|---|
| 468 | * Variables :
|
|---|
| 469 | * Result :
|
|---|
| 470 | * Remark :
|
|---|
| 471 | * Status :
|
|---|
| 472 | *
|
|---|
| 473 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 474 | *****************************************************************************/
|
|---|
| 475 |
|
|---|
| 476 | ODINFUNCTION3(INT16, GetFileTitleA32,
|
|---|
| 477 | LPCSTR, lpFile,
|
|---|
| 478 | LPSTR, lpTitle,
|
|---|
| 479 | UINT, cbBuf)
|
|---|
| 480 | {
|
|---|
| 481 | return O32_GetFileTitle(lpFile,
|
|---|
| 482 | lpTitle,
|
|---|
| 483 | cbBuf);
|
|---|
| 484 | }
|
|---|
| 485 |
|
|---|
| 486 |
|
|---|
| 487 | /*****************************************************************************
|
|---|
| 488 | * Name :
|
|---|
| 489 | * Purpose :
|
|---|
| 490 | * Parameters:
|
|---|
| 491 | * Variables :
|
|---|
| 492 | * Result :
|
|---|
| 493 | * Remark :
|
|---|
| 494 | * Status :
|
|---|
| 495 | *
|
|---|
| 496 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 497 | *****************************************************************************/
|
|---|
| 498 |
|
|---|
| 499 | ODINFUNCTION1(BOOL, ChooseColorA,
|
|---|
| 500 | LPCHOOSECOLORA, lpcc)
|
|---|
| 501 | {
|
|---|
| 502 | Win32WindowProc *wndproc;
|
|---|
| 503 |
|
|---|
| 504 | COMDLG32_CHECKHOOK(lpcc, CC_ENABLEHOOK, LPCCHOOKPROC)
|
|---|
| 505 |
|
|---|
| 506 | return O32_ChooseColor(lpcc);
|
|---|
| 507 | }
|
|---|
| 508 |
|
|---|
| 509 |
|
|---|
| 510 | /*****************************************************************************
|
|---|
| 511 | * Name :
|
|---|
| 512 | * Purpose :
|
|---|
| 513 | * Parameters:
|
|---|
| 514 | * Variables :
|
|---|
| 515 | * Result :
|
|---|
| 516 | * Remark : casting is a little hot, should work however
|
|---|
| 517 | * assuming lpcc->lpTemplateName is READONLY pointer!
|
|---|
| 518 | * Status :
|
|---|
| 519 | *
|
|---|
| 520 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 521 | *****************************************************************************/
|
|---|
| 522 |
|
|---|
| 523 | ODINFUNCTION1(BOOL, ChooseColorW,
|
|---|
| 524 | LPCHOOSECOLORW, lpcc)
|
|---|
| 525 | {
|
|---|
| 526 | Win32WindowProc *wndproc;
|
|---|
| 527 | BOOL bResult;
|
|---|
| 528 | LPCWSTR lpTemplateNameBackup = lpcc->lpTemplateName;
|
|---|
| 529 |
|
|---|
| 530 | // if no template is to convert, we can take this shortcut
|
|---|
| 531 | if (!(lpcc->Flags & CC_ENABLETEMPLATE))
|
|---|
| 532 | return O32_ChooseColor( (LPCHOOSECOLORA)lpcc );
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 | // convert to ASCII string
|
|---|
| 536 | if (lpcc->lpTemplateName != NULL)
|
|---|
| 537 | lpcc->lpTemplateName = (LPCWSTR)UnicodeToAsciiString((WCHAR*)lpcc->lpTemplateName);
|
|---|
| 538 |
|
|---|
| 539 | COMDLG32_CHECKHOOK(lpcc, CC_ENABLEHOOK, LPCCHOOKPROC)
|
|---|
| 540 |
|
|---|
| 541 | bResult = O32_ChooseColor((LPCHOOSECOLORA)lpcc); // call ASCII version
|
|---|
| 542 |
|
|---|
| 543 | // free temporary ASCII string and restore UNICODE string
|
|---|
| 544 | if (lpcc->lpTemplateName != NULL)
|
|---|
| 545 | {
|
|---|
| 546 | FreeAsciiString((char*)lpcc->lpTemplateName);
|
|---|
| 547 | lpcc->lpTemplateName = lpTemplateNameBackup;
|
|---|
| 548 | }
|
|---|
| 549 |
|
|---|
| 550 | return bResult;
|
|---|
| 551 | }
|
|---|
| 552 |
|
|---|
| 553 |
|
|---|
| 554 | /*****************************************************************************
|
|---|
| 555 | * Name :
|
|---|
| 556 | * Purpose :
|
|---|
| 557 | * Parameters:
|
|---|
| 558 | * Variables :
|
|---|
| 559 | * Result :
|
|---|
| 560 | * Remark :
|
|---|
| 561 | * Status :
|
|---|
| 562 | *
|
|---|
| 563 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 564 | *****************************************************************************/
|
|---|
| 565 |
|
|---|
| 566 | ODINFUNCTION1(BOOL, ChooseFontA,
|
|---|
| 567 | LPCHOOSEFONTA, lpcf)
|
|---|
| 568 | {
|
|---|
| 569 | Win32WindowProc *wndproc;
|
|---|
| 570 |
|
|---|
| 571 | COMDLG32_CHECKHOOK(lpcf, CF_ENABLEHOOK, WNDPROC)
|
|---|
| 572 |
|
|---|
| 573 | return O32_ChooseFont(lpcf);
|
|---|
| 574 | }
|
|---|
| 575 |
|
|---|
| 576 |
|
|---|
| 577 | /*****************************************************************************
|
|---|
| 578 | * Name :
|
|---|
| 579 | * Purpose :
|
|---|
| 580 | * Parameters:
|
|---|
| 581 | * Variables :
|
|---|
| 582 | * Result :
|
|---|
| 583 | * Remark : unknown yet, what is INPUT and what is OUTPUT string
|
|---|
| 584 | * Status :
|
|---|
| 585 | *
|
|---|
| 586 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 587 | * Edgar Buerkle [Mon, 1999/06/28 19:35]
|
|---|
| 588 | *****************************************************************************/
|
|---|
| 589 |
|
|---|
| 590 | ODINFUNCTION1(BOOL, ChooseFontW,
|
|---|
| 591 | LPCHOOSEFONTW, lpcf)
|
|---|
| 592 | {
|
|---|
| 593 | Win32WindowProc *wndproc;
|
|---|
| 594 | BOOL bResult;
|
|---|
| 595 | CHOOSEFONTA asciicf;
|
|---|
| 596 | LOGFONTA asciilf;
|
|---|
| 597 | char szAsciiStyle[64];
|
|---|
| 598 |
|
|---|
| 599 | // NOTE: LOGFONTW/A is NOT converted !
|
|---|
| 600 | dprintf(("COMDLG32: ChooseFontW not correctly implemented.\n"));
|
|---|
| 601 |
|
|---|
| 602 | if (!lpcf)
|
|---|
| 603 | {
|
|---|
| 604 | SetLastError(ERROR_INVALID_PARAMETER);
|
|---|
| 605 |
|
|---|
| 606 | return FALSE;
|
|---|
| 607 | }
|
|---|
| 608 |
|
|---|
| 609 | // convert to ASCII string
|
|---|
| 610 | memcpy(&asciicf, // make binary copy of CHOOSEFONTW
|
|---|
| 611 | lpcf, // to save the flags
|
|---|
| 612 | sizeof(asciicf));
|
|---|
| 613 |
|
|---|
| 614 | memcpy (&asciilf,
|
|---|
| 615 | lpcf->lpLogFont,
|
|---|
| 616 | sizeof(LOGFONTA));
|
|---|
| 617 |
|
|---|
| 618 | asciicf.lpLogFont = &asciilf; // update pointer
|
|---|
| 619 |
|
|---|
| 620 | // lpTemplatenName bug in open32 ? This doesn't work.
|
|---|
| 621 | // TODO: CF_ENABLETEMPLATEHANDLE
|
|---|
| 622 | if (lpcf->Flags & CF_ENABLETEMPLATE)
|
|---|
| 623 | if((int)asciicf.lpTemplateName >> 16 != 0)
|
|---|
| 624 | asciicf.lpTemplateName = UnicodeToAsciiString((LPWSTR)lpcf->lpTemplateName);
|
|---|
| 625 |
|
|---|
| 626 | //CB: NT's clock.exe traps here!
|
|---|
| 627 | if (lpcf->lpszStyle)
|
|---|
| 628 | {
|
|---|
| 629 | UnicodeToAsciiN(lpcf->lpszStyle,
|
|---|
| 630 | szAsciiStyle,
|
|---|
| 631 | sizeof(szAsciiStyle));
|
|---|
| 632 |
|
|---|
| 633 | asciicf.lpszStyle = szAsciiStyle;
|
|---|
| 634 | }
|
|---|
| 635 |
|
|---|
| 636 | UnicodeToAsciiN(lpcf->lpLogFont->lfFaceName,
|
|---|
| 637 | asciilf.lfFaceName,
|
|---|
| 638 | LF_FACESIZE-1);
|
|---|
| 639 |
|
|---|
| 640 | // LPCFHOOKPROC != WNDPROC ?
|
|---|
| 641 | COMDLG32_CHECKHOOK((&asciicf), CF_ENABLEHOOK, WNDPROC)
|
|---|
| 642 |
|
|---|
| 643 | // switch strings
|
|---|
| 644 | bResult = O32_ChooseFont((LPCHOOSEFONTA)&asciicf); // call ASCII version
|
|---|
| 645 |
|
|---|
| 646 | if (bResult)
|
|---|
| 647 | {
|
|---|
| 648 | // transfer BACK resulting strings !!!
|
|---|
| 649 | AsciiToUnicodeN(asciicf.lpLogFont->lfFaceName,
|
|---|
| 650 | lpcf->lpLogFont->lfFaceName,
|
|---|
| 651 | LF_FACESIZE-1);
|
|---|
| 652 |
|
|---|
| 653 | if (lpcf->lpszStyle) AsciiToUnicode(asciicf.lpszStyle,lpcf->lpszStyle);
|
|---|
| 654 | }
|
|---|
| 655 |
|
|---|
| 656 | if (lpcf->Flags & CF_ENABLETEMPLATE)
|
|---|
| 657 | if((int)asciicf.lpTemplateName >> 16 != 0)
|
|---|
| 658 | FreeAsciiString((char*)asciicf.lpTemplateName);
|
|---|
| 659 |
|
|---|
| 660 | // copy back fields
|
|---|
| 661 | lpcf->Flags = asciicf.Flags;
|
|---|
| 662 |
|
|---|
| 663 | return bResult;
|
|---|
| 664 | }
|
|---|
| 665 |
|
|---|
| 666 |
|
|---|
| 667 | /*****************************************************************************
|
|---|
| 668 | * Name :
|
|---|
| 669 | * Purpose :
|
|---|
| 670 | * Parameters:
|
|---|
| 671 | * Variables :
|
|---|
| 672 | * Result :
|
|---|
| 673 | * Remark :
|
|---|
| 674 | * Status :
|
|---|
| 675 | *
|
|---|
| 676 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 677 | *****************************************************************************/
|
|---|
| 678 |
|
|---|
| 679 | ODINFUNCTION0(DWORD, CommDlgExtendedError32)
|
|---|
| 680 | {
|
|---|
| 681 | return O32_CommDlgExtendedError();
|
|---|
| 682 | }
|
|---|
| 683 |
|
|---|
| 684 |
|
|---|
| 685 | /*****************************************************************************
|
|---|
| 686 | * Name :
|
|---|
| 687 | * Purpose :
|
|---|
| 688 | * Parameters:
|
|---|
| 689 | * Variables :
|
|---|
| 690 | * Result :
|
|---|
| 691 | * Remark :
|
|---|
| 692 | * Status :
|
|---|
| 693 | *
|
|---|
| 694 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 695 | *****************************************************************************/
|
|---|
| 696 |
|
|---|
| 697 | ODINFUNCTION1(HWND, FindTextA32,
|
|---|
| 698 | LPFINDREPLACEA, lpfr)
|
|---|
| 699 | {
|
|---|
| 700 | Win32WindowProc *wndproc;
|
|---|
| 701 |
|
|---|
| 702 | COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)
|
|---|
| 703 |
|
|---|
| 704 | return O32_FindText(lpfr);
|
|---|
| 705 | }
|
|---|
| 706 |
|
|---|
| 707 |
|
|---|
| 708 | /*****************************************************************************
|
|---|
| 709 | * Name :
|
|---|
| 710 | * Purpose :
|
|---|
| 711 | * Parameters:
|
|---|
| 712 | * Variables :
|
|---|
| 713 | * Result :
|
|---|
| 714 | * Remark :
|
|---|
| 715 | * Status :
|
|---|
| 716 | *
|
|---|
| 717 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 718 | *****************************************************************************/
|
|---|
| 719 |
|
|---|
| 720 | ODINFUNCTION1(HWND, FindTextW32,
|
|---|
| 721 | LPFINDREPLACEW, lpfr)
|
|---|
| 722 | {
|
|---|
| 723 | Win32WindowProc *wndproc;
|
|---|
| 724 | BOOL bResult;
|
|---|
| 725 | FINDREPLACEA fr;
|
|---|
| 726 |
|
|---|
| 727 | memcpy(&fr, // make binary copy first to save all the fields
|
|---|
| 728 | lpfr,
|
|---|
| 729 | sizeof(fr));
|
|---|
| 730 |
|
|---|
| 731 | // convert to ASCII string
|
|---|
| 732 | if ((lpfr->Flags & FR_ENABLETEMPLATE) &&
|
|---|
| 733 | (lpfr->lpTemplateName != NULL))
|
|---|
| 734 | fr.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpfr->lpTemplateName);
|
|---|
| 735 | else
|
|---|
| 736 | fr.lpTemplateName = NULL;
|
|---|
| 737 |
|
|---|
| 738 | if (lpfr->lpstrFindWhat != NULL)
|
|---|
| 739 | fr.lpstrFindWhat = UnicodeToAsciiString((WCHAR*)lpfr->lpstrFindWhat);
|
|---|
| 740 |
|
|---|
| 741 | if (lpfr->lpstrReplaceWith != NULL)
|
|---|
| 742 | fr.lpstrReplaceWith = UnicodeToAsciiString((WCHAR*)lpfr->lpstrReplaceWith);
|
|---|
| 743 |
|
|---|
| 744 |
|
|---|
| 745 | COMDLG32_CHECKHOOK((&fr), FR_ENABLEHOOK, WNDPROC)
|
|---|
| 746 |
|
|---|
| 747 | bResult = O32_FindText(&fr); // call ASCII version
|
|---|
| 748 |
|
|---|
| 749 | // @@@PH: Note -- we might have to transfer BACK resulting strings !!!
|
|---|
| 750 | // free temporary ASCII string and restore UNICODE string
|
|---|
| 751 | if (fr.lpTemplateName != NULL)
|
|---|
| 752 | FreeAsciiString((char*)fr.lpTemplateName);
|
|---|
| 753 |
|
|---|
| 754 | // free temporary ASCII string and restore UNICODE string
|
|---|
| 755 | if (fr.lpstrFindWhat != NULL)
|
|---|
| 756 | {
|
|---|
| 757 | AsciiToUnicode(fr.lpstrFindWhat,
|
|---|
| 758 | lpfr->lpstrFindWhat);
|
|---|
| 759 |
|
|---|
| 760 | FreeAsciiString((char*)fr.lpstrFindWhat);
|
|---|
| 761 | }
|
|---|
| 762 |
|
|---|
| 763 | if (fr.lpstrReplaceWith != NULL)
|
|---|
| 764 | {
|
|---|
| 765 | AsciiToUnicode(fr.lpstrReplaceWith,
|
|---|
| 766 | lpfr->lpstrReplaceWith);
|
|---|
| 767 |
|
|---|
| 768 | FreeAsciiString((char*)fr.lpstrReplaceWith);
|
|---|
| 769 | }
|
|---|
| 770 |
|
|---|
| 771 | // copy back fields
|
|---|
| 772 | lpfr->Flags = fr.Flags;
|
|---|
| 773 |
|
|---|
| 774 | return bResult;
|
|---|
| 775 | }
|
|---|
| 776 |
|
|---|
| 777 |
|
|---|
| 778 | /*****************************************************************************
|
|---|
| 779 | * Name :
|
|---|
| 780 | * Purpose :
|
|---|
| 781 | * Parameters:
|
|---|
| 782 | * Variables :
|
|---|
| 783 | * Result :
|
|---|
| 784 | * Remark :
|
|---|
| 785 | * Status :
|
|---|
| 786 | *
|
|---|
| 787 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 788 | *****************************************************************************/
|
|---|
| 789 |
|
|---|
| 790 | ODINFUNCTION3(INT16, GetFileTitleW32,
|
|---|
| 791 | LPCWSTR, lpFile,
|
|---|
| 792 | LPWSTR, lpTitle,
|
|---|
| 793 | UINT, cbBuf)
|
|---|
| 794 | {
|
|---|
| 795 | LPSTR lpFileBackup;
|
|---|
| 796 | char szTitle[256];
|
|---|
| 797 | INT16 iResult;
|
|---|
| 798 |
|
|---|
| 799 | lpFileBackup = UnicodeToAsciiString((LPWSTR)lpFile);
|
|---|
| 800 | iResult = O32_GetFileTitle(lpFileBackup,
|
|---|
| 801 | szTitle,
|
|---|
| 802 | cbBuf);
|
|---|
| 803 |
|
|---|
| 804 | FreeAsciiString(lpFileBackup);
|
|---|
| 805 |
|
|---|
| 806 | // transform result into Unicode
|
|---|
| 807 | AsciiToUnicode(szTitle,
|
|---|
| 808 | lpTitle);
|
|---|
| 809 |
|
|---|
| 810 | return iResult;
|
|---|
| 811 | }
|
|---|
| 812 |
|
|---|
| 813 | /*****************************************************************************
|
|---|
| 814 | * Name :
|
|---|
| 815 | * Purpose :
|
|---|
| 816 | * Parameters:
|
|---|
| 817 | * Variables :
|
|---|
| 818 | * Result :
|
|---|
| 819 | * Remark :
|
|---|
| 820 | * Status :
|
|---|
| 821 | *
|
|---|
| 822 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 823 | *****************************************************************************/
|
|---|
| 824 |
|
|---|
| 825 | ODINFUNCTION1(BOOL, PrintDlgA,
|
|---|
| 826 | LPPRINTDLGA, lppd)
|
|---|
| 827 | {
|
|---|
| 828 | Win32WindowProc *wndproc;
|
|---|
| 829 |
|
|---|
| 830 | COMDLG32_CHECKHOOK2(lppd, PD_ENABLEPRINTHOOK, LPPRINTHOOKPROC,lpfnPrintHook)
|
|---|
| 831 | COMDLG32_CHECKHOOK2(lppd, PD_ENABLESETUPHOOK, LPSETUPHOOKPROC,lpfnSetupHook)
|
|---|
| 832 |
|
|---|
| 833 | return O32_PrintDlg(lppd);
|
|---|
| 834 | }
|
|---|
| 835 |
|
|---|
| 836 |
|
|---|
| 837 | /*****************************************************************************
|
|---|
| 838 | * Name :
|
|---|
| 839 | * Purpose :
|
|---|
| 840 | * Parameters:
|
|---|
| 841 | * Variables :
|
|---|
| 842 | * Result :
|
|---|
| 843 | * Remark :
|
|---|
| 844 | * Status :
|
|---|
| 845 | *
|
|---|
| 846 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 847 | *****************************************************************************/
|
|---|
| 848 |
|
|---|
| 849 | ODINFUNCTION1(BOOL, PrintDlgW,
|
|---|
| 850 | LPPRINTDLGW, lppd)
|
|---|
| 851 | {
|
|---|
| 852 | Win32WindowProc *wndproc;
|
|---|
| 853 |
|
|---|
| 854 | PRINTDLGA pd;
|
|---|
| 855 | BOOL bResult;
|
|---|
| 856 |
|
|---|
| 857 | memcpy(&pd, // make binary copy first to save all the fields
|
|---|
| 858 | lppd,
|
|---|
| 859 | sizeof(pd));
|
|---|
| 860 |
|
|---|
| 861 | // convert to ASCII string
|
|---|
| 862 | if ((lppd->Flags & PD_ENABLEPRINTTEMPLATE) &&
|
|---|
| 863 | (lppd->lpPrintTemplateName != NULL))
|
|---|
| 864 | pd.lpPrintTemplateName = UnicodeToAsciiString((WCHAR*)lppd->lpPrintTemplateName);
|
|---|
| 865 | else
|
|---|
| 866 | pd.lpPrintTemplateName = NULL;
|
|---|
| 867 |
|
|---|
| 868 | if ((lppd->Flags & PD_ENABLESETUPTEMPLATE) &&
|
|---|
| 869 | (lppd->lpSetupTemplateName != NULL))
|
|---|
| 870 | pd.lpSetupTemplateName = UnicodeToAsciiString((WCHAR*)lppd->lpSetupTemplateName);
|
|---|
| 871 | else
|
|---|
| 872 | pd.lpSetupTemplateName = NULL;
|
|---|
| 873 |
|
|---|
| 874 | COMDLG32_CHECKHOOK2((&pd), PD_ENABLEPRINTHOOK, LPPRINTHOOKPROC,lpfnPrintHook)
|
|---|
| 875 | COMDLG32_CHECKHOOK2((&pd), PD_ENABLESETUPHOOK, LPSETUPHOOKPROC,lpfnSetupHook)
|
|---|
| 876 |
|
|---|
| 877 | bResult = O32_PrintDlg(&pd); // call ASCII API
|
|---|
| 878 |
|
|---|
| 879 | if (pd.lpPrintTemplateName != NULL) FreeAsciiString((char*)pd.lpPrintTemplateName);
|
|---|
| 880 | if (pd.lpSetupTemplateName != NULL) FreeAsciiString((char*)pd.lpSetupTemplateName);
|
|---|
| 881 |
|
|---|
| 882 | // copy back result
|
|---|
| 883 | lppd->Flags = pd.Flags;
|
|---|
| 884 | lppd->nFromPage = pd.nFromPage;
|
|---|
| 885 | lppd->nToPage = pd.nToPage;
|
|---|
| 886 | lppd->nMinPage = pd.nMinPage;
|
|---|
| 887 | lppd->nMaxPage = pd.nMaxPage;
|
|---|
| 888 | lppd->nCopies = pd.nCopies;
|
|---|
| 889 | //@@@PH: all pass-back fields ?
|
|---|
| 890 |
|
|---|
| 891 | return bResult;
|
|---|
| 892 | }
|
|---|
| 893 |
|
|---|
| 894 |
|
|---|
| 895 | /*****************************************************************************
|
|---|
| 896 | * Name :
|
|---|
| 897 | * Purpose :
|
|---|
| 898 | * Parameters:
|
|---|
| 899 | * Variables :
|
|---|
| 900 | * Result :
|
|---|
| 901 | * Remark :
|
|---|
| 902 | * Status :
|
|---|
| 903 | *
|
|---|
| 904 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 905 | *****************************************************************************/
|
|---|
| 906 |
|
|---|
| 907 | ODINFUNCTION1(HWND, ReplaceTextA32,
|
|---|
| 908 | LPFINDREPLACEA, lpfr)
|
|---|
| 909 | {
|
|---|
| 910 | Win32WindowProc *wndproc;
|
|---|
| 911 |
|
|---|
| 912 | COMDLG32_CHECKHOOK(lpfr, FR_ENABLEHOOK, WNDPROC)
|
|---|
| 913 |
|
|---|
| 914 | return O32_ReplaceText(lpfr);
|
|---|
| 915 | }
|
|---|
| 916 |
|
|---|
| 917 |
|
|---|
| 918 | /*****************************************************************************
|
|---|
| 919 | * Name :
|
|---|
| 920 | * Purpose :
|
|---|
| 921 | * Parameters:
|
|---|
| 922 | * Variables :
|
|---|
| 923 | * Result :
|
|---|
| 924 | * Remark :
|
|---|
| 925 | * Status :
|
|---|
| 926 | *
|
|---|
| 927 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 928 | *****************************************************************************/
|
|---|
| 929 |
|
|---|
| 930 | ODINFUNCTION1(HWND, ReplaceTextW32,
|
|---|
| 931 | LPFINDREPLACEW, lpfr)
|
|---|
| 932 | {
|
|---|
| 933 | Win32WindowProc *wndproc;
|
|---|
| 934 | BOOL bResult;
|
|---|
| 935 | FINDREPLACEA fr;
|
|---|
| 936 |
|
|---|
| 937 | dprintf(("COMDLG32: ReplaceTextW(%08xh)\n",
|
|---|
| 938 | lpfr));
|
|---|
| 939 |
|
|---|
| 940 | memcpy(&fr, // make binary copy first to save all the fields
|
|---|
| 941 | lpfr,
|
|---|
| 942 | sizeof(fr));
|
|---|
| 943 |
|
|---|
| 944 | // convert to ASCII string
|
|---|
| 945 | if ((lpfr->Flags & FR_ENABLETEMPLATE) &&
|
|---|
| 946 | (lpfr->lpTemplateName != NULL))
|
|---|
| 947 | fr.lpTemplateName = UnicodeToAsciiString((WCHAR*)lpfr->lpTemplateName);
|
|---|
| 948 | else
|
|---|
| 949 | fr.lpTemplateName = NULL;
|
|---|
| 950 |
|
|---|
| 951 | if (lpfr->lpstrFindWhat != NULL)
|
|---|
| 952 | fr.lpstrFindWhat = UnicodeToAsciiString((WCHAR*)lpfr->lpstrFindWhat);
|
|---|
| 953 |
|
|---|
| 954 | if (lpfr->lpstrReplaceWith != NULL)
|
|---|
| 955 | fr.lpstrReplaceWith = UnicodeToAsciiString((WCHAR*)lpfr->lpstrReplaceWith);
|
|---|
| 956 |
|
|---|
| 957 |
|
|---|
| 958 | COMDLG32_CHECKHOOK((&fr), FR_ENABLEHOOK, WNDPROC)
|
|---|
| 959 |
|
|---|
| 960 | bResult = O32_ReplaceText(&fr); // call ASCII version
|
|---|
| 961 |
|
|---|
| 962 | // @@@PH: Note -- we might have to transfer BACK resulting strings !!!
|
|---|
| 963 | // free temporary ASCII string and restore UNICODE string
|
|---|
| 964 | if (fr.lpTemplateName != NULL)
|
|---|
| 965 | FreeAsciiString((char*)fr.lpTemplateName);
|
|---|
| 966 |
|
|---|
| 967 | // free temporary ASCII string and restore UNICODE string
|
|---|
| 968 | if (fr.lpstrFindWhat != NULL)
|
|---|
| 969 | {
|
|---|
| 970 | AsciiToUnicode(fr.lpstrFindWhat,
|
|---|
| 971 | lpfr->lpstrFindWhat);
|
|---|
| 972 |
|
|---|
| 973 | FreeAsciiString((char*)fr.lpstrFindWhat);
|
|---|
| 974 | }
|
|---|
| 975 |
|
|---|
| 976 | if (fr.lpstrReplaceWith != NULL)
|
|---|
| 977 | {
|
|---|
| 978 | AsciiToUnicode(fr.lpstrReplaceWith,
|
|---|
| 979 | lpfr->lpstrReplaceWith);
|
|---|
| 980 |
|
|---|
| 981 | FreeAsciiString((char*)fr.lpstrReplaceWith);
|
|---|
| 982 | }
|
|---|
| 983 |
|
|---|
| 984 | // copy back fields
|
|---|
| 985 | lpfr->Flags = fr.Flags;
|
|---|
| 986 |
|
|---|
| 987 | return bResult;
|
|---|
| 988 | }
|
|---|
| 989 |
|
|---|
| 990 |
|
|---|
| 991 | /*****************************************************************************
|
|---|
| 992 | * Name :
|
|---|
| 993 | * Purpose :
|
|---|
| 994 | * Parameters:
|
|---|
| 995 | * Variables :
|
|---|
| 996 | * Result :
|
|---|
| 997 | * Remark :
|
|---|
| 998 | * Status :
|
|---|
| 999 | *
|
|---|
| 1000 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 1001 | *****************************************************************************/
|
|---|
| 1002 |
|
|---|
| 1003 | ODINFUNCTION1(BOOL, PageSetupDlgA,
|
|---|
| 1004 | LPPAGESETUPDLGA, lppsd)
|
|---|
| 1005 | {
|
|---|
| 1006 | Win32WindowProc *wndproc;
|
|---|
| 1007 |
|
|---|
| 1008 | dprintf(("COMDLG32: PageSetupDlgA not implemented.\n"));
|
|---|
| 1009 |
|
|---|
| 1010 | //COMDLG32_CHECKHOOK2(lppsd, PSD_ENABLESETUPHOOK, LPPAGESETUPHOOK, lpfnPageSetupHook)
|
|---|
| 1011 |
|
|---|
| 1012 | return(FALSE);
|
|---|
| 1013 | }
|
|---|
| 1014 |
|
|---|
| 1015 |
|
|---|
| 1016 | /*****************************************************************************
|
|---|
| 1017 | * Name :
|
|---|
| 1018 | * Purpose :
|
|---|
| 1019 | * Parameters:
|
|---|
| 1020 | * Variables :
|
|---|
| 1021 | * Result :
|
|---|
| 1022 | * Remark :
|
|---|
| 1023 | * Status :
|
|---|
| 1024 | *
|
|---|
| 1025 | * Author : Patrick Haller [Tue, 1998/02/10 01:55]
|
|---|
| 1026 | *****************************************************************************/
|
|---|
| 1027 |
|
|---|
| 1028 | ODINFUNCTION1(BOOL, PageSetupDlgW,
|
|---|
| 1029 | LPPAGESETUPDLGW, lppsd)
|
|---|
| 1030 | {
|
|---|
| 1031 | Win32WindowProc *wndproc;
|
|---|
| 1032 |
|
|---|
| 1033 | dprintf(("COMDLG32: PageSetupDlgW(%08xh) not implemented.\n"));
|
|---|
| 1034 |
|
|---|
| 1035 | //COMDLG32_CHECKHOOK2(lppsd, PSD_ENABLESETUPHOOK, LPPAGESETUPHOOK, lpfnPageSetupHook)
|
|---|
| 1036 |
|
|---|
| 1037 | return(FALSE);
|
|---|
| 1038 | }
|
|---|
| 1039 |
|
|---|