Changeset 17
- Timestamp:
- Dec 16, 2000, 10:09:53 PM (25 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/animate.h
r14 r17 37 37 ULONG ulAnimationTime); 38 38 39 VOID anmPowerOff(HPS hps, ULONG ulSteps); 39 VOID anmPowerOff(HPS hps, 40 ULONG ulMaxTime1, 41 ULONG ulMaxTime2, 42 ULONG ulMaxTime3, 43 ULONG ulWaitEnd); 40 44 41 45 #endif -
trunk/include/helpers/cnrh.h
r15 r17 482 482 PRECORDCORE precc); 483 483 484 BOOL cnrhIsChildOf(HWND hwndCnr, 485 PRECORDCORE precTest, 486 PRECORDCORE precParent); 487 484 488 typedef ULONG EXPENTRY FNCBRECC(HWND, PRECORDCORE, ULONG, ULONG); 485 489 typedef FNCBRECC *PFNCBRECC; -
trunk/include/helpers/dosh.h
r15 r17 178 178 /* ****************************************************************** 179 179 * 180 * File helpers 181 * 182 ********************************************************************/ 183 184 PSZ doshGetExtension(const char *pcszFilename); 185 186 BOOL doshIsFileOnFAT(const char* pcszFileName); 187 188 APIRET doshIsValidFileName(const char* pcszFile, 189 BOOL fFullyQualified); 190 191 BOOL doshMakeRealName(PSZ pszTarget, PSZ pszSource, CHAR cReplace, BOOL fIsFAT); 192 193 ULONG doshQueryFileSize(HFILE hFile); 194 195 ULONG doshQueryPathSize(PSZ pszFile); 196 197 APIRET doshQueryPathAttr(const char* pcszFile, 198 PULONG pulAttr); 199 200 APIRET doshSetPathAttr(const char* pcszFile, 201 ULONG ulAttr); 202 203 APIRET doshReadTextFile(PSZ pszFile, 204 PSZ* ppszContent); 205 206 PSZ doshCreateBackupFileName(const char* pszExisting); 207 208 APIRET doshWriteTextFile(const char* pszFile, 209 const char* pszContent, 210 PULONG pulWritten, 211 PSZ pszBackup); 212 213 HFILE doshOpenLogFile(const char* pcszFilename); 214 215 APIRET doshWriteToLogFile(HFILE hfLog, const char* pcsz); 216 217 /* ****************************************************************** 218 * 219 * Directory helpers 220 * 221 ********************************************************************/ 222 223 BOOL doshQueryDirExist(PSZ pszDir); 224 225 APIRET doshCreatePath(PSZ pszPath, 226 BOOL fHidden); 227 228 APIRET doshQueryCurrentDir(PSZ pszBuf); 229 230 APIRET doshSetCurrentDir(const char *pcszDir); 231 232 #define DOSHDELDIR_RECURSE 0x0001 233 #define DOSHDELDIR_DELETEFILES 0x0002 234 235 APIRET doshDeleteDir(const char *pcszDir, 236 ULONG flFlags, 237 PULONG pulDirs, 238 PULONG pulFiles); 180 * Module handling helpers 181 * 182 ********************************************************************/ 183 184 /* 185 *@@ RESOLVEFUNCTION: 186 * one of these structures each define 187 * a single function import to doshResolveImports. 188 * 189 *@@added V0.9.3 (2000-04-25) [umoeller] 190 */ 191 192 typedef struct _RESOLVEFUNCTION 193 { 194 const char *pcszFunctionName; 195 PFN *ppFuncAddress; 196 } RESOLVEFUNCTION, *PRESOLVEFUNCTION; 197 198 APIRET doshResolveImports(PSZ pszModuleName, 199 HMODULE *phmod, 200 PRESOLVEFUNCTION paResolves, 201 ULONG cResolves); 239 202 240 203 /* ****************************************************************** … … 304 267 /* ****************************************************************** 305 268 * 269 * File helpers 270 * 271 ********************************************************************/ 272 273 PSZ doshGetExtension(const char *pcszFilename); 274 275 BOOL doshIsFileOnFAT(const char* pcszFileName); 276 277 APIRET doshIsValidFileName(const char* pcszFile, 278 BOOL fFullyQualified); 279 280 BOOL doshMakeRealName(PSZ pszTarget, PSZ pszSource, CHAR cReplace, BOOL fIsFAT); 281 282 ULONG doshQueryFileSize(HFILE hFile); 283 284 ULONG doshQueryPathSize(PSZ pszFile); 285 286 APIRET doshQueryPathAttr(const char* pcszFile, 287 PULONG pulAttr); 288 289 APIRET doshSetPathAttr(const char* pcszFile, 290 ULONG ulAttr); 291 292 APIRET doshReadTextFile(PSZ pszFile, 293 PSZ* ppszContent); 294 295 PSZ doshCreateBackupFileName(const char* pszExisting); 296 297 APIRET doshWriteTextFile(const char* pszFile, 298 const char* pszContent, 299 PULONG pulWritten, 300 PSZ pszBackup); 301 302 HFILE doshOpenLogFile(const char* pcszFilename); 303 304 APIRET doshWriteToLogFile(HFILE hfLog, const char* pcsz); 305 306 /* ****************************************************************** 307 * 308 * Directory helpers 309 * 310 ********************************************************************/ 311 312 BOOL doshQueryDirExist(PSZ pszDir); 313 314 APIRET doshCreatePath(PSZ pszPath, 315 BOOL fHidden); 316 317 APIRET doshQueryCurrentDir(PSZ pszBuf); 318 319 APIRET doshSetCurrentDir(const char *pcszDir); 320 321 #define DOSHDELDIR_RECURSE 0x0001 322 #define DOSHDELDIR_DELETEFILES 0x0002 323 324 APIRET doshDeleteDir(const char *pcszDir, 325 ULONG flFlags, 326 PULONG pulDirs, 327 PULONG pulFiles); 328 329 /* ****************************************************************** 330 * 306 331 * Process helpers 307 332 * … … 356 381 357 382 APIRET doshFreeEnvironment(PDOSENVIRONMENT pEnv); 358 359 /* ******************************************************************360 *361 * Module handling helpers362 *363 ********************************************************************/364 365 /*366 *@@ RESOLVEFUNCTION:367 * one of these structures each define368 * a single function import to doshResolveImports.369 *370 *@@added V0.9.3 (2000-04-25) [umoeller]371 */372 373 typedef struct _RESOLVEFUNCTION374 {375 const char *pcszFunctionName;376 PFN *ppFuncAddress;377 } RESOLVEFUNCTION, *PRESOLVEFUNCTION;378 379 APIRET doshResolveImports(PSZ pszModuleName,380 HMODULE *phmod,381 PRESOLVEFUNCTION paResolves,382 ULONG cResolves);383 383 384 384 /******************************************************************** -
trunk/include/helpers/linklist.h
r14 r17 159 159 typedef LSTITEMFROMINDEX *PLSTITEMFROMINDEX; 160 160 161 unsigned long lstIndexFromItem(PLINKLIST pList, void *pItemData); 162 typedef unsigned long LSTINDEXFROMITEM(PLINKLIST pList, void *pItemData); 163 typedef LSTINDEXFROMITEM *PLSTINDEXFROMITEM; 164 161 165 #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c 162 166 PLISTNODE XWPENTRY lstAppendItemDebug(PLINKLIST pList, -
trunk/src/helpers/animate.c
r15 r17 44 44 #define INCL_DOSERRORS 45 45 46 #define INCL_WINWINDOWMGR 46 47 #define INCL_WINPOINTERS 47 48 #define INCL_WINSYS … … 55 56 #include <string.h> 56 57 57 #include "setup.h" // code generation and debugging options58 59 #include "helpers\animate.h"60 61 #include "helpers\winh.h"62 #include "helpers\gpih.h"58 // #include "setup.h" // code generation and debugging options 59 60 // #include "helpers\animate.h" 61 62 // #include "helpers\winh.h" 63 // #include "helpers\gpih.h" 63 64 64 65 /* … … 165 166 } 166 167 167 #define LAST_WIDTH 2 168 #define LAST_STEPS 50 169 #define WAIT_TIME 10 168 #define LAST_LINE_WIDTH 2 170 169 171 170 /* ****************************************************************** … … 179 178 * displays an animation that looks like a 180 179 * monitor being turned off; hps must have 181 * been acquired using WinGetScreenPS, 182 * ulSteps should be around 40-50. 180 * been acquired using WinGetScreenPS. 183 181 * 184 182 *@@changed V0.9.7 (2000-12-08) [umoeller]: got rid of dtGetULongTime 185 183 */ 186 184 187 VOID anmPowerOff(HPS hps, ULONG ulSteps) 185 VOID anmPowerOff(HPS hps, 186 ULONG ulMaxTime1, // = 500, 187 ULONG ulMaxTime2, // = 800, 188 ULONG ulMaxTime3, // = 200, 189 ULONG ulWaitEnd) // = 300 188 190 { 189 RECTL rclScreen, rclNow, rclLast, rclDraw; 190 ULONG ul = ulSteps; 191 ULONG ulPhase = 1; 191 RECTL rclScreen, 192 rclNow, 193 rclLast, 194 rclDraw; 195 ULONG ulPhase = 1, 196 ulCXLastLine; 197 198 ULONG ulStartTime = 0, 199 ulTimeNow = 0; 192 200 193 201 WinQueryWindowRect(HWND_DESKTOP, &rclScreen); 202 ulCXLastLine = rclScreen.xRight / 3; 194 203 195 204 WinShowPointer(HWND_DESKTOP, FALSE); … … 200 209 // "phases", signified by the ulPhase variable. While 201 210 // ulPhase != 99, we stay in a do-while loop. 202 ul = 0;203 211 ulPhase = 1; 204 212 205 213 do 206 214 { 207 ULONG ulFromTime, ulTime2;215 // get current time 208 216 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, 209 &ulFromTime, 210 sizeof(ulFromTime)); 217 &ulTimeNow, 218 sizeof(ulTimeNow)); 219 220 // get start time 221 if (ulStartTime == 0) 222 // this is reset when we enter a new phase 223 ulStartTime = ulTimeNow; 211 224 212 225 if (ulPhase == 1) … … 218 231 // the center is black too. Sort of like this: 219 232 220 // *************************** 221 // * black * 222 // * * 223 // * ............. * 224 // * . rclNow: . * 225 // * -> . untouched . <- * 226 // * ............. * 227 // * ^ * 228 // * ! * 229 // *************************** 233 // ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 234 // º black º 235 // º º 236 // º ÚÄÄÄÄÄÄÄÄÄÄÄ¿ º 237 // º ³ rclNow: ³ º 238 // º -> ³ untouched ³ <- º 239 // º ÀÄÄÄÄÄÄÄÄÄÄÄÙ º 240 // º ^ º 241 // º | º 242 // ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ 243 244 // This part lasts exactly (ulMaxTime1) milliseconds. 230 245 231 246 // rclNow contains the rectangle _around_ which 232 247 // the black rectangles are to be drawn. With 233 248 // every iteration, rclNow is reduced in size. 234 rclNow.xLeft = ((rclScreen.yTop / 2) * ul / ulSteps ); 249 ULONG ulMaxX = (rclScreen.xRight - ulCXLastLine) / 2, 250 ulMaxY = rclScreen.yTop / 2 - LAST_LINE_WIDTH; 251 ULONG ulTimePassed = (ulTimeNow - ulStartTime); 252 if (ulTimePassed >= ulMaxTime1) 253 { 254 // time has elapsed: 255 ulTimePassed = ulMaxTime1; 256 // enter next phase on next loop 257 ulPhase++; 258 // reget start time 259 ulStartTime = 0; 260 } 261 rclNow.xLeft = ulMaxX * ulTimePassed / ulMaxTime1; 262 rclNow.yBottom = ulMaxY * ulTimePassed / ulMaxTime1; 263 rclNow.xRight = (rclScreen.xRight) - rclNow.xLeft; 264 rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom; 265 266 /* rclNow.xLeft = ((rclScreen.yTop / 2) * ul / ulSteps ); 235 267 rclNow.xRight = (rclScreen.xRight) - rclNow.xLeft; 236 268 rclNow.yBottom = ((rclScreen.yTop / 2) * ul / ulSteps ); 237 rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom; 238 239 if (rclNow.yBottom > (rclNow.yTop - LAST_WIDTH) )269 rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom; */ 270 271 /* if (rclNow.yBottom > (rclNow.yTop - LAST_WIDTH) ) 240 272 { 241 273 rclNow.yBottom = (rclScreen.yTop / 2) - LAST_WIDTH; 242 274 rclNow.yTop = (rclScreen.yTop / 2) + LAST_WIDTH; 243 } 275 } */ 244 276 245 277 // draw black rectangle on top of rclNow … … 275 307 276 308 // done with "shrinking"? 277 if ( rclNow.xRight < ((rclScreen.xRight / 2) + LAST_WIDTH) ) 309 /* if ( rclNow.xRight < ((rclScreen.xRight / 2) + LAST_WIDTH) ) 310 { 278 311 ulPhase = 2; // exit 312 // reget start time 313 ulStartTime = 0; 314 } */ 315 316 if (ulPhase == 2) 317 { 318 // this was the last step in this phase: 319 memcpy(&rclLast, &rclScreen, sizeof(RECTL)); 320 } 279 321 } 280 322 else if (ulPhase == 2) 281 323 { 282 324 // Phase 2: draw a horizontal white line about 283 // where the last rclNow was. This is only 284 // executed once. 285 286 // *************************** 287 // * black * 288 // * * 289 // * * 290 // * ----------- * 291 // * * 292 // * * 293 // * * 294 // *************************** 295 296 rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_WIDTH; 297 rclDraw.xRight = (rclScreen.xRight / 2) + LAST_WIDTH; 298 rclDraw.yBottom = (rclScreen.yTop * 1 / 4); 299 rclDraw.yTop = (rclScreen.yTop * 3 / 4); 300 WinFillRect(hps, &rclDraw, CLR_WHITE); 301 302 ulPhase = 3; 303 ul = 0; 304 325 // where the last rclNow was. and shrink it 326 // towards the middle. This ends with a white 327 // dot in the middle of the screen. 328 329 // ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 330 // º black º 331 // º º 332 // º º 333 // º --> ÄwhiteÄÄÄÄ <-- º 334 // º º 335 // º º 336 // º º 337 // ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ 338 339 // This part lasts exactly (ulMaxTime2) milliseconds. 340 341 // start is same as max in step 1 342 ULONG ulStartX = (rclScreen.xRight - ulCXLastLine) / 2, 343 ulY = rclScreen.yTop / 2 - LAST_LINE_WIDTH; 344 ULONG ulMaxX = (rclScreen.xRight) / 2 - LAST_LINE_WIDTH; // center 345 ULONG ulTimePassed = (ulTimeNow - ulStartTime); 346 if (ulTimePassed >= ulMaxTime2) 347 { 348 // time has elapsed: 349 ulTimePassed = ulMaxTime2; 350 // enter next phase on next loop 351 ulPhase++; 352 // reget start time 353 ulStartTime = 0; 354 } 355 356 rclNow.xLeft = ulStartX 357 + ( (ulMaxX - ulStartX) * ulTimePassed / ulMaxTime2 ); 358 rclNow.yBottom = ulY; 359 rclNow.xRight = (rclScreen.xRight) - rclNow.xLeft; 360 rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom; 361 362 // draw black rectangle left of rclNow 363 rclDraw.xLeft = rclLast.xLeft; 364 rclDraw.xRight = rclNow.xLeft; 365 rclDraw.yBottom = rclLast.yBottom; 366 rclDraw.yTop = rclLast.yTop; 367 WinFillRect(hps, &rclDraw, CLR_BLACK); 368 369 // draw black rectangle right of rclNow 370 rclDraw.xLeft = rclNow.xRight; 371 rclDraw.xRight = rclLast.xRight; 372 rclDraw.yBottom = rclLast.yBottom; 373 rclDraw.yTop = rclLast.yTop; 374 WinFillRect(hps, &rclDraw, CLR_BLACK); 375 376 // WinFillRect(hps, &rclNow, CLR_WHITE); 377 378 // remember rclNow for next iteration 379 memcpy(&rclLast, &rclNow, sizeof(RECTL)); 380 381 if (ulPhase == 3) 382 { 383 // this was the last step in this phase: 384 // keep the dot visible for a while 385 DosSleep(ulMaxTime3); 386 387 // draw a white line for phase 3 388 rclLast.xLeft = ulMaxX; 389 rclLast.yBottom = rclScreen.yTop / 4; 390 rclLast.xRight = rclScreen.xRight - rclLast.xLeft; 391 rclLast.yTop = rclScreen.yTop - rclLast.yBottom; 392 393 WinFillRect(hps, &rclLast, CLR_WHITE); 394 } 305 395 } 306 396 else if (ulPhase == 3) … … 308 398 // Phase 3: make the white line shorter with 309 399 // every iteration by drawing black rectangles 310 // above it. These are drawn closer to the 311 // center with each iteration. 312 313 // *************************** 314 // * black * 315 // * * 316 // * * 317 // * -> ---- <- * 318 // * * 319 // * * 320 // * * 321 // *************************** 322 323 rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_WIDTH; 324 rclDraw.xRight = (rclScreen.xRight / 2) + LAST_WIDTH; 400 // above and below it. These are drawn closer 401 // to the center with each iteration. 402 403 // ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» 404 // º º 405 // º º 406 // º | º 407 // º | º 408 // º | º 409 // º º 410 // º º 411 // ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ 412 413 // This part lasts exactly ulMaxTime3 milliseconds. 414 ULONG ulX = (rclScreen.xRight) / 2 - LAST_LINE_WIDTH, // center 415 ulStartY = rclScreen.yTop / 4; 416 ULONG ulMaxY = (rclScreen.yTop) / 2 - LAST_LINE_WIDTH; // center 417 ULONG ulTimePassed = (ulTimeNow - ulStartTime); 418 if (ulTimePassed >= ulMaxTime3) 419 { 420 // time has elapsed: 421 ulTimePassed = ulMaxTime3; 422 // stop 423 ulPhase = 99; 424 } 425 426 rclNow.xLeft = ulX; 427 rclNow.yBottom = ulStartY 428 + ( (ulMaxY - ulStartY) * ulTimePassed / ulMaxTime3 ); 429 rclNow.xRight = (rclScreen.xRight) - rclNow.xLeft; 430 rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom; 431 432 // draw black rectangle on top of rclNow 433 rclDraw.xLeft = rclLast.xLeft; 434 rclDraw.xRight = rclLast.xRight; 435 rclDraw.yBottom = rclNow.yTop; 436 rclDraw.yTop = rclLast.yTop; 437 WinFillRect(hps, &rclDraw, CLR_BLACK); 438 439 // draw black rectangle at the bottom of rclNow 440 rclDraw.xLeft = rclLast.xLeft; 441 rclDraw.xRight = rclLast.xRight; 442 rclDraw.yBottom = rclLast.yBottom; 443 rclDraw.yTop = rclNow.yBottom; 444 WinFillRect(hps, &rclDraw, CLR_BLACK); 445 446 // remember rclNow for next iteration 447 memcpy(&rclLast, &rclNow, sizeof(RECTL)); 448 449 /* rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_LINE_WIDTH; 450 rclDraw.xRight = (rclScreen.xRight / 2) + LAST_LINE_WIDTH; 325 451 rclDraw.yTop = (rclScreen.yTop * 3 / 4); 326 452 rclDraw.yBottom = (rclScreen.yTop * 3 / 4) - ((rclScreen.yTop * 1 / 4) * ul / LAST_STEPS); 327 if (rclDraw.yBottom < ((rclScreen.yTop / 2) + LAST_ WIDTH))328 rclDraw.yBottom = ((rclScreen.yTop / 2) + LAST_ WIDTH);329 WinFillRect(hps, &rclDraw, CLR_BLACK); 330 331 rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_ WIDTH;332 rclDraw.xRight = (rclScreen.xRight / 2) + LAST_ WIDTH;453 if (rclDraw.yBottom < ((rclScreen.yTop / 2) + LAST_LINE_WIDTH)) 454 rclDraw.yBottom = ((rclScreen.yTop / 2) + LAST_LINE_WIDTH); 455 WinFillRect(hps, &rclDraw, CLR_BLACK); 456 457 rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_LINE_WIDTH; 458 rclDraw.xRight = (rclScreen.xRight / 2) + LAST_LINE_WIDTH; 333 459 rclDraw.yBottom = (rclScreen.yTop * 1 / 4); 334 460 rclDraw.yTop = (rclScreen.yTop * 1 / 4) + ((rclScreen.yTop * 1 / 4) * ul / LAST_STEPS); 335 if (rclDraw.yTop > ((rclScreen.yTop / 2) - LAST_ WIDTH))336 rclDraw.yBottom = ((rclScreen.yTop / 2) - LAST_ WIDTH);461 if (rclDraw.yTop > ((rclScreen.yTop / 2) - LAST_LINE_WIDTH)) 462 rclDraw.yBottom = ((rclScreen.yTop / 2) - LAST_LINE_WIDTH); 337 463 338 464 WinFillRect(hps, &rclDraw, CLR_BLACK); 339 465 340 466 ul++; 341 if (ul > LAST_STEPS) 342 ulPhase = 99;467 if (ul > LAST_STEPS) */ 468 // ulPhase = 99; 343 469 } 344 470 345 ul++;346 347 DosSleep(WAIT_TIME);348 349 /* do350 {351 DosSleep(0);352 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,353 &ulTime2,354 sizeof(ulTime2));355 } while (ulTime2 < ulFromTime + WAIT_TIME); */356 471 } while (ulPhase != 99); 357 472 358 473 // sleep a while 359 DosSleep( 500);474 DosSleep(ulWaitEnd / 2); 360 475 WinFillRect(hps, &rclScreen, CLR_BLACK); 361 DosSleep( 500);476 DosSleep(ulWaitEnd / 2); 362 477 363 478 WinShowPointer(HWND_DESKTOP, TRUE); … … 365 480 366 481 367 482 // testcase 483 484 /* int main(int argc, char* argp) 485 { 486 HENUM henum; 487 HWND hwndTop; 488 HAB hab = WinInitialize(0); 489 HMQ hmq = WinCreateMsgQueue(hab, 0); 490 HPS hps = WinGetScreenPS(HWND_DESKTOP); 491 492 anmPowerOff(hps); 493 494 henum = WinBeginEnumWindows(HWND_DESKTOP); 495 while ((hwndTop = WinGetNextWindow(henum))) 496 if (WinIsWindowShowing(hwndTop)) 497 WinInvalidateRect(hwndTop, NULL, TRUE); 498 WinEndEnumWindows(henum); 499 500 WinShowPointer(HWND_DESKTOP, TRUE); 501 502 WinDestroyMsgQueue(hmq); 503 WinTerminate(hab); 504 505 return (0); 506 } */ -
trunk/src/helpers/cnrh.c
r15 r17 1376 1376 1377 1377 /* 1378 *@@ cnrhIsChildOf: 1379 * returns TRUE only if precTest is a child record 1380 * of precParent in a tree view. 1381 * 1382 *@@added V0.9.7 (2000-12-13) [umoeller] 1383 */ 1384 1385 BOOL cnrhIsChildOf(HWND hwndCnr, 1386 PRECORDCORE precTest, // in: recc to test 1387 PRECORDCORE precParent) // in: parent to test 1388 { 1389 BOOL brc = FALSE; 1390 if ((precTest) && (precParent)) 1391 { 1392 PRECORDCORE precParentThis = precTest; 1393 1394 while (precParentThis) 1395 { 1396 // first call: get parent of precTest; 1397 // subsequent calls: climb up 1398 precParentThis = WinSendMsg(hwndCnr, 1399 CM_QUERYRECORD, 1400 precParentThis, 1401 MPFROM2SHORT(CMA_PARENT, 1402 CMA_ITEMORDER)); 1403 if (precParentThis == (PRECORDCORE)-1) 1404 break; 1405 else 1406 if (precParentThis == precParent) 1407 { 1408 brc = TRUE; 1409 break; 1410 } 1411 } 1412 } 1413 1414 return (brc); 1415 } 1416 1417 /* 1378 1418 *@@ cnrhForAllRecords: 1379 1419 * this monster function calls pfnwpCallback … … 1663 1703 * 1664 1704 * Note: You must intercept CN_DROPNOTIFY in your window proc 1665 * to clean up resources later. 1705 * to clean up resources later. For this, call: 1706 * 1707 + DrgDeleteDraginfoStrHandles(pdrgInfo); 1708 + DrgFreeDraginfo(pdrgInfo); 1666 1709 * 1667 1710 * 2) However, if (usNotifyCode == CN_INITDRAG), we will start … … 1669 1712 * will _not_ return until the object has been dropped or d'n'd 1670 1713 * has been cancelled. PM establishes another message loop 1671 * internally for this. 1714 * internally for this. In this case, this function managed 1715 * cleanup automatically. 1672 1716 * 1673 1717 * This function supports one single record core only. The following -
trunk/src/helpers/dosh.c
r15 r17 1530 1530 1531 1531 return (arcReturn); 1532 } 1533 1534 /* 1535 *@@category: Helpers\Control program helpers\Module handling 1536 */ 1537 1538 /* ****************************************************************** 1539 * 1540 * Module handling helpers 1541 * 1542 ********************************************************************/ 1543 1544 /* 1545 *@@ doshResolveImports: 1546 * this function loads the module called pszModuleName 1547 * and resolves imports dynamically using DosQueryProcAddress. 1548 * 1549 * To specify the functions to be imported, a RESOLVEFUNCTION 1550 * array is used. In each of the array items, specify the 1551 * name of the function and a pointer to a function pointer 1552 * where to store the resolved address. 1553 * 1554 *@@added V0.9.3 (2000-04-29) [umoeller] 1555 */ 1556 1557 APIRET doshResolveImports(PSZ pszModuleName, // in: DLL to load 1558 HMODULE *phmod, // out: module handle 1559 PRESOLVEFUNCTION paResolves, // in/out: function resolves 1560 ULONG cResolves) // in: array item count (not array size!) 1561 { 1562 CHAR szName[CCHMAXPATH]; 1563 APIRET arc = DosLoadModule(szName, 1564 sizeof(szName), 1565 pszModuleName, 1566 phmod); 1567 if (arc == NO_ERROR) 1568 { 1569 ULONG ul; 1570 for (ul = 0; 1571 ul < cResolves; 1572 ul++) 1573 { 1574 arc = DosQueryProcAddr(*phmod, 1575 0, // ordinal, ignored 1576 (PSZ)paResolves[ul].pcszFunctionName, 1577 paResolves[ul].ppFuncAddress); 1578 1579 /* _Pmpf(("Resolved %s to 0x%lX, rc: %d", 1580 paResolves[ul].pcszFunctionName, 1581 *paResolves[ul].ppFuncAddress, 1582 arc)); */ 1583 if (arc != NO_ERROR) 1584 break; 1585 } 1586 } 1587 1588 return (arc); 1532 1589 } 1533 1590 -
trunk/src/helpers/dosh2.c
r14 r17 714 714 free(pEnv->papszVars); 715 715 pEnv->cVars = 0; 716 }717 }718 719 return (arc);720 }721 722 /*723 *@@category: Helpers\Control program helpers\Module handling724 */725 726 /* ******************************************************************727 *728 * Module handling helpers729 *730 ********************************************************************/731 732 /*733 *@@ doshResolveImports:734 * this function loads the module called pszModuleName735 * and resolves imports dynamically using DosQueryProcAddress.736 *737 * To specify the functions to be imported, a RESOLVEFUNCTION738 * array is used. In each of the array items, specify the739 * name of the function and a pointer to a function pointer740 * where to store the resolved address.741 *742 *@@added V0.9.3 (2000-04-29) [umoeller]743 */744 745 APIRET doshResolveImports(PSZ pszModuleName, // in: DLL to load746 HMODULE *phmod, // out: module handle747 PRESOLVEFUNCTION paResolves, // in/out: function resolves748 ULONG cResolves) // in: array item count (not array size!)749 {750 CHAR szName[CCHMAXPATH];751 APIRET arc = DosLoadModule(szName,752 sizeof(szName),753 pszModuleName,754 phmod);755 if (arc == NO_ERROR)756 {757 ULONG ul;758 for (ul = 0;759 ul < cResolves;760 ul++)761 {762 arc = DosQueryProcAddr(*phmod,763 0, // ordinal, ignored764 (PSZ)paResolves[ul].pcszFunctionName,765 paResolves[ul].ppFuncAddress);766 767 /* _Pmpf(("Resolved %s to 0x%lX, rc: %d",768 paResolves[ul].pcszFunctionName,769 *paResolves[ul].ppFuncAddress,770 arc)); */771 if (arc != NO_ERROR)772 break;773 716 } 774 717 } -
trunk/src/helpers/linklist.c
r14 r17 353 353 * The item data can be queried from the node 354 354 * as follows: 355 * 355 356 + PLINKLIST pll = lstCreate(); 356 357 + ... // add items here … … 359 360 * 360 361 * You can iterate over the whole list like this: 362 * 361 363 + PLISTNODE pNode = lstQueryFirstNode(pll); 362 364 + while (pNode) … … 425 427 */ 426 428 427 PLISTNODE lstNodeFromItem(PLINKLIST pList, void* pItemData) 429 PLISTNODE lstNodeFromItem(PLINKLIST pList, 430 void* pItemData) 428 431 { 429 432 PLISTNODE pNode = 0, … … 465 468 */ 466 469 467 void* lstItemFromIndex(PLINKLIST pList, unsigned long ulIndex) 470 void* lstItemFromIndex(PLINKLIST pList, 471 unsigned long ulIndex) 468 472 { 469 473 PLISTNODE pNode = lstNodeFromIndex(pList, ulIndex); … … 472 476 else 473 477 return (0); 478 } 479 480 /* 481 *@@ lstIndexFromItem: 482 * returns the index of the list node with 483 * the specified item pointer. The first 484 * node returns 0, the second 1, and so on. 485 * 486 * Returns -1 if not found. 487 * 488 * In the worst case, this function traverses 489 * the whole list. 490 * 491 *@@added V0.9.7 (2000-12-13) [umoeller] 492 */ 493 494 unsigned long lstIndexFromItem(PLINKLIST pList, void *pItemData) 495 { 496 ULONG ulrc = -1, 497 ulIndex = 0; 498 PLISTNODE pNode = lstQueryFirstNode(pList); 499 while (pNode) 500 { 501 if (pNode->pItemData == pItemData) 502 { 503 ulrc = ulIndex; 504 break; 505 } 506 507 pNode = pNode->pNext; 508 ulIndex++; 509 } 510 511 return (ulrc); 474 512 } 475 513 -
trunk/src/helpers/timer.c
r15 r17 73 73 #define INCL_DOSMISC 74 74 #define INCL_DOSERRORS 75 76 #define INCL_WINMESSAGEMGR 75 77 #include <os2.h> 76 78 … … 151 153 } 152 154 else 153 brc = ( DosRequestMutexSem(G_hmtxTimers, SEM_INDEFINITE_WAIT)155 brc = (WinRequestMutexSem(G_hmtxTimers, SEM_INDEFINITE_WAIT) 154 156 == NO_ERROR); 155 157 return (brc); … … 164 166 { 165 167 DosReleaseMutexSem(G_hmtxTimers); 166 }167 168 /*169 *@@ tmrOnKill:170 * on-kill proc for exception handlers.171 *172 *@@added V0.9.7 (2000-12-09) [umoeller]173 */174 175 VOID APIENTRY tmrOnKill(PEXCEPTIONREGISTRATIONRECORD2 pRegRec2)176 {177 DosBeep(500, 500);178 UnlockTimers();179 168 } 180 169 … … 217 206 ULONG ulNesting = 0; 218 207 208 ULONG ulTimeNow; 209 219 210 DosSleep(ulInterval); 220 211 … … 225 216 ulInterval = 100; 226 217 218 DosEnterMustComplete(&ulNesting); 219 227 220 TRY_LOUD(excpt1) 228 221 { 229 DosEnterMustComplete(&ulNesting);230 231 222 fLocked = LockTimers(); 232 223 if (fLocked) … … 244 235 // we have timers: 245 236 BOOL fFoundInvalid = FALSE; 237 238 // get current time 239 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, 240 &ulTimeNow, sizeof(ulTimeNow)); 241 246 242 while (pTimerNode) 247 243 { 248 244 PXTIMER pTimer = (PXTIMER)pTimerNode->pItemData; 249 ULONG ulTimeNow;250 DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,251 &ulTimeNow, sizeof(ulTimeNow));252 245 253 246 if (pTimer->ulNextFire < ulTimeNow) -
trunk/src/helpers/winh.c
r15 r17 3251 3251 * If this is passed as HWND_DESKTOP, the 3252 3252 * whole screen is repainted. 3253 * 3254 *@@changed V0.9.7 (2000-12-13) [umoeller]: hwndParent was never respected, fixed 3253 3255 */ 3254 3256 … … 3256 3258 { 3257 3259 HWND hwndTop; 3258 HENUM henum = WinBeginEnumWindows( HWND_DESKTOP);3260 HENUM henum = WinBeginEnumWindows(hwndParent); 3259 3261 while ((hwndTop = WinGetNextWindow(henum))) 3260 3262 if (WinIsWindowShowing(hwndTop))
Note:
See TracChangeset
for help on using the changeset viewer.