|
|
1.1 ! root 1: /***************************************************************************\ ! 2: * ! 3: * Sample file open, save, saveas dialog functions for PM ! 4: * ! 5: * Created by Microsoft, IBM Corporation 1990 ! 6: * ! 7: * DISCLAIMER OF WARRANTIES. The following [enclosed] code is ! 8: * sample code created by Microsoft Corporation and/or IBM ! 9: * Corporation. This sample code is not part of any standard ! 10: * Microsoft or IBM product and is provided to you solely for ! 11: * the purpose of assisting you in the development of your ! 12: * applications. The code is provided "AS IS", without ! 13: * warranty of any kind. Neither Microsoft nor IBM shall be ! 14: * liable for any damages arising out of your use of the sample ! 15: * code, even if they have been advised of the possibility of ! 16: * such damages. ! 17: * ! 18: \***************************************************************************/ ! 19: ! 20: #include "tool.h" ! 21: /****************************************************************************\ ! 22: * This function initializes the file dialog library (by loading strings). ! 23: * ! 24: * Note: Initialization will fail if CCHSTRINGSMAX is smaller than the ! 25: * space taken up by all strings in the .rc file. Fix by increasing ! 26: * CCHSTRINGSMAX in wintool.h and maybe also the initial heap size ! 27: * in wintool.def. ! 28: * ! 29: * Returns: ! 30: * TRUE if initialization successful ! 31: * FALSE otherwise ! 32: \***************************************************************************/ ! 33: ! 34: ULONG EXPENTRY InitLibrary(hPDLL, hmod) ! 35: ULONG hPDLL; ! 36: HMODULE hmod; ! 37: { ! 38: int i; ! 39: int cch; ! 40: PSTR pch; ! 41: PSTR pmem; ! 42: int cchRemaining; ! 43: ! 44: vhModule = hmod; ! 45: ! 46: /* allocate memory for strings */ ! 47: if (DosAllocMem((PPVOID)&pmem,cchRemaining=CCHSTRINGSMAX,fPERM|PAG_COMMIT)) ! 48: return FALSE; ! 49: pch = pmem; ! 50: ! 51: /* load strings from resource file */ ! 52: for (i = 0; i < CSTRINGS; i++) { ! 53: cch = 1 + WinLoadString(HABX, vhModule, i, cchRemaining, (PSZ)pch); ! 54: if (cch < 2) ! 55: /* loadstring failed */ ! 56: return FALSE; ! 57: vrgsz[i] = pch; ! 58: pch += cch; ! 59: ! 60: if ((cchRemaining -= cch) <= 0) ! 61: /* ran out of space */ ! 62: return FALSE; ! 63: } ! 64: hPDLL; /* to suppress warnings */ ! 65: return TRUE; ! 66: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.