htmlhelp.cpp 782 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "stdafx.h"
  2. #include "htmlhelp.h"
  3. #include "mainframe.h"
  4. #include "libs.h"
  5. IMPLEMENT_DYNAMIC( HtmlHelp,CHtmlView )
  6. BEGIN_MESSAGE_MAP( HtmlHelp,CHtmlView )
  7. ON_WM_ERASEBKGND()
  8. END_MESSAGE_MAP()
  9. string HtmlHelp::getTitle(){
  10. return title;
  11. }
  12. void HtmlHelp::OnTitleChange( LPCTSTR t ){
  13. listener->helpTitleChange( this,title=t );
  14. }
  15. void HtmlHelp::OnBeforeNavigate2( LPCTSTR url,DWORD flags,LPCTSTR target,CByteArray& posted,LPCTSTR headers,BOOL* cancel ){
  16. string t( url );
  17. int attr=GetFileAttributes( url );if( attr==-1 ) attr=0;
  18. if( (attr & FILE_ATTRIBUTE_DIRECTORY) ||
  19. (t.rfind( ".bb" )+3==t.size()) ||
  20. (isMediaFile( t )) ){
  21. listener->helpOpen( this,t );
  22. *cancel=true;
  23. return;
  24. }
  25. *cancel=false;
  26. }
  27. BOOL HtmlHelp::OnEraseBkgnd( CDC *dc ){
  28. return true;
  29. }