Changeset 48 for trunk/MFCtooling/userlog/userlog.cpp
- Timestamp:
- 06/07/11 11:56:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MFCtooling/userlog/userlog.cpp
r47 r48 4 4 #include <map> 5 5 #include <cstdio> 6 7 #include "helpers.h" 6 8 7 9 #ifdef __USING_MTRACE__ … … 233 235 } 234 236 235 /* Source code for an inverse filter236 237 // inverse filter: defined messages will be filtered, all else just passes through238 // may be replaced with a lookup-table to improve perfomance239 // upon completion of the rules, i.e., when it is clear which messages are required,240 // this should be changed to a "normal" filter.241 switch(msg->message) {242 case WM_NULL:243 case WM_MOVE:244 case WM_SIZE:245 case WM_GETTEXT:246 case WM_GETTEXTLENGTH:247 case WM_PAINT:248 case WM_ERASEBKGND:249 case WM_SHOWWINDOW:250 case WM_CANCELMODE:251 case WM_SETCURSOR:252 case WM_GETMINMAXINFO:253 case WM_GETFONT:254 case WM_WINDOWPOSCHANGING:255 case WM_WINDOWPOSCHANGED:256 case WM_NOTIFY:257 case WM_STYLECHANGING:258 case WM_STYLECHANGED:259 case WM_GETICON:260 case WM_NCCREATE:261 case WM_NCDESTROY:262 case WM_NCCALCSIZE:263 case WM_NCHITTEST:264 case WM_NCPAINT:265 case WM_GETDLGCODE:266 case 0x0090: // WM_UAHDESTROYWINDOW267 case 0x0091: // WM_UAHDRAWMENU268 case 0x0092: // WM_UADRAWMENUITEM269 case 0x0093: // WM_UAHINITMENU270 case 0x0094: // WM_UAHMEASUREMENUITEM271 case 0x0095: // WM_UAHNCPAINTMENUPOPUP272 case WM_NCMOUSEMOVE:273 case WM_TIMER:274 case WM_ENTERIDLE:275 case WM_CTLCOLORMSGBOX:276 case WM_CTLCOLOREDIT:277 case WM_CTLCOLORLISTBOX:278 case WM_CTLCOLORBTN:279 case WM_CTLCOLORDLG:280 case WM_CTLCOLORSCROLLBAR:281 case WM_CTLCOLORSTATIC:282 case WM_MOUSEMOVE:283 case WM_PARENTNOTIFY:284 case WM_MDIGETACTIVE:285 case WM_IME_NOTIFY:286 case WM_IME_SETCONTEXT:287 case WM_AFXFIRST:288 case WM_AFXFIRST+1:289 case WM_AFXFIRST+2:290 case WM_AFXFIRST+3:291 case WM_AFXFIRST+4:292 case WM_AFXFIRST+5:293 case WM_AFXFIRST+6:294 case WM_AFXFIRST+7:295 case WM_AFXFIRST+8:296 case WM_AFXFIRST+9:297 case WM_AFXFIRST+10:298 case WM_AFXFIRST+11:299 case WM_AFXFIRST+12:300 case WM_AFXFIRST+13:301 case WM_AFXFIRST+14:302 case WM_AFXFIRST+15:303 case WM_AFXFIRST+16:304 case WM_AFXFIRST+17:305 case WM_AFXFIRST+18:306 case WM_AFXFIRST+19:307 case WM_AFXFIRST+20:308 case WM_AFXFIRST+21:309 case WM_AFXFIRST+22:310 case WM_AFXFIRST+23:311 case WM_AFXFIRST+24:312 case WM_AFXFIRST+25:313 case WM_AFXFIRST+26:314 case WM_AFXFIRST+27:315 case WM_AFXFIRST+28:316 case WM_AFXFIRST+29:317 case WM_AFXFIRST+30:318 case WM_AFXLAST:319 case 1025:320 case 1031:321 case 1142:322 case 2024:323 case 4100:324 case 4101:325 case 4103:326 case 4352:327 case 4362:328 case 4363:329 case 4364:330 case 4365:331 case 4372:332 case 4613:333 break;334 default:335 // exclude messages 0xC000-0xFFFF336 if( !(msg->message>=0xC000 && msg->message<=0xFFFF) ) {337 // CODE HERE!338 }339 break;340 } */341 342 237 #ifdef __TIMING__ 343 238 GetSystemTime( &systemTime ); … … 354 249 } 355 250 #endif // __TIMING__ 356 }357 358 359 ///////////////////////////////////////////////////////////360 // 2 Byte character functions361 ///////////////////////////////////////////////////////////362 363 bool MessageEquals(const MSG & msg1, const MSG & msg2) {364 bool retVal = false;365 if( (msg1.time==-1 && msg1.pt.x==-1 && msg1.pt.y==-1) || (msg2.time==-1 && msg2.pt.x==-1 && msg2.pt.y==-1) ) {366 retVal = msg1.hwnd==msg2.hwnd && msg1.message==msg2.message && msg1.lParam==msg2.lParam &&367 msg1.wParam==msg2.wParam;368 } else {369 retVal = msg1.hwnd==msg2.hwnd && msg1.message==msg2.message && msg1.lParam==msg2.lParam &&370 msg1.wParam==msg2.wParam && msg1.time==msg2.time && msg1.pt.x==msg2.pt.x && msg1.pt.y==msg2.pt.y;371 }372 return retVal;373 }374 375 int replaceWithXmlEntitiesWString(const wchar_t * source, wchar_t ** target, size_t sourceLength) {376 size_t j=0;377 size_t extraLength = 0;378 size_t bufsize = 300;379 wchar_t * tmpTarget = new wchar_t[sourceLength+bufsize];380 size_t i;381 for( i=0; i<sourceLength && j<sourceLength+bufsize-5; i++ ) {382 switch (source[i]) {383 case L'&':384 tmpTarget[j] = L'&';385 tmpTarget[j+1]=L'a';386 tmpTarget[j+2]=L'm';387 tmpTarget[j+3]=L'p';388 tmpTarget[j+4]=L';';389 j += 5;390 extraLength += 4;391 break;392 case L'<':393 tmpTarget[j] = L'&';394 tmpTarget[j+1]=L'l';395 tmpTarget[j+2]=L't';396 tmpTarget[j+3]=L';';397 j += 4;398 extraLength += 3;399 break;400 case L'>':401 tmpTarget[j] = L'&';402 tmpTarget[j+1]=L'g';403 tmpTarget[j+2]=L't';404 tmpTarget[j+3]=L';';405 j += 4;406 extraLength += 3;407 break;408 case L'\"':409 tmpTarget[j] = L'&';410 tmpTarget[j+1]=L'q';411 tmpTarget[j+2]=L'u';412 tmpTarget[j+3]=L'o';413 tmpTarget[j+4]=L't';414 tmpTarget[j+5]=L';';415 j += 6;416 extraLength += 5;417 break;418 case L'\'':419 tmpTarget[j] = L'&';420 tmpTarget[j+1]=L'a';421 tmpTarget[j+2]=L'p';422 tmpTarget[j+3]=L'o';423 tmpTarget[j+4]=L's';424 tmpTarget[j+5]=L';';425 j += 6;426 extraLength += 5;427 break;428 case L'%':429 tmpTarget[j] = L'\\';430 tmpTarget[j+1] = L'%';431 j += 2;432 extraLength += 1;433 break;434 default:435 tmpTarget[j] = source[i];436 j++;437 }438 }439 *target = new wchar_t[j+1];440 memcpy(*target,tmpTarget,j*sizeof(wchar_t));441 (*target)[j] = '\0';442 return j;443 251 } 444 252
Note: See TracChangeset
for help on using the changeset viewer.