Hi, 

I am working on an extension for scite for windows
(working with scite 1.7.2). 

I would like it to both filter the keys coming to
application (not just the regular characters) and
perform background processing. 

The way that makes sense to me to do this is to create
a windows proc which replaces the default windows
procedure and calls it - a la the single thread
extension. I wasn't thinking of a timer since I want
to also do keystroke filtering. 

My question is whether this seems like an approach
which could work with all the internals of scite
(which seem quite usual though I haven't looked in
every nook and cranny of its code). 

Thanks in advance

LRESULT PASCAL PatternRepeaterExt::WndProc(HWND   
      tempHWND, UINT tempUMsg, WPARAM tempWParam,
LPARAM tempLParam) {
  //We will soon go into this loop and never emerge
  if (tempUMsg == STE_WM_DO_BACKGROUND_PROCESSING) {
    while(true){ 
      MSG msg;
      while ( ::PeekMessage( &msg, NULL, 0, 0, 
            PM_NOREMOVE ) ){ 
        if (!::GetMessage(&msg, NULL, NULL, NULL)){
          ::PostQuitMessage(0); 
          return 0;
        }

        //sniff through 
        if(msg.message == WM_NOTIFY){
          mapIndexPtr->at()->OnTextModified(
            (SCNotification *)&msg);
          mapIndexPtr->at()->UpdateStates();
        }
        ::TranslateMessage(&msg);
        ::DispatchMessage(&msg);
      } 
      //Wait a bit
      if( clock() < gLT + iNCR ){
        continue;
      } else {
        gLT = clock();
      }
      //Do our idle processing
      if(mapIndexPtr && mapIndexPtr->at()){
        if(!mapIndexPtr->at()->IdleProcessing()){
          ::WaitMessage();
        }
      } else {
        //Then let the system do its thing, hopefully
        ::WaitMessage();
      }
    }
  }

  WNDPROC lpPrevWndProc = reinterpret_cast<WNDPROC>(
    GetWindowLongPtr(tempHWND, GWLP_USERDATA));
  if (lpPrevWndProc){
    return ::CallWindowProc(lpPrevWndProc, tempHWND, 
          tempUMsg, tempWParam, tempLParam);
  }
  return ::DefWindowProc(tempHWND, tempUMsg, 
              tempWParam, tempLParam);
}

And it would be created with the calls

  hwndDispatcher = CreateWindow(
    "STATIC",       
    "SciTE_PatternRepeaterExtension_Dispatcher",
    0, 0, 0, 0, 0, 0, 0, GetModuleHandle(NULL), 0
  );
  LONG_PTR subclassedProc = ::SetWindowLongPtr(
      hwndDispatcher, GWLP_WNDPROC, 
      reinterpret_cast<LONG_PTR>(WndProc)
  );
  SetWindowLongPtr(hwndDispatcher, 
        GWLP_USERDATA, subclassedProc);
  SendMessage(hwndDispatcher, 
        STE_WM_DO_BACKGROUND_PROCESSING,0, 0);*/

Hans Solbrig



 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to