Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.1 KiB

  1. #include "MSMQMon.h"
  2. int __cdecl main( int argc, TCHAR *argv[])
  3. {
  4. //TCHAR szConnectString[] = _T("TKBGITWB16\\PRIVATE$\\OCAIN");
  5. TCHAR szConnectString[] = _T("SOLSON22\\PRIVATE$\\TEST");
  6. int count;
  7. HRESULT hResult;
  8. MSMQMon Test( szConnectString );
  9. TCHAR Queue[256];
  10. Test.DisplayCurrentQueue( Queue );
  11. hResult = Test.ConnectToQueue();
  12. if( S_OK == hResult || MQ_OK == hResult )
  13. {
  14. _tprintf( _T("running count\n"));
  15. hResult = Test.CountMessagesInQueue( &count );
  16. if( MQ_OK == hResult )
  17. _tprintf( _T("Count of messages: %i\n"), count );
  18. if( Test.CloseOpenQueue() != MQ_OK )
  19. _tprintf( _T("it failed to close the queue\n"));
  20. }
  21. else
  22. {
  23. printf("FAILED - Great error message eh?: %x", hResult );
  24. }
  25. Test.ConnectToQueue( MQ_SEND_ACCESS );
  26. for( int i=0 ; i < 200000 ; i++ )
  27. {
  28. if( !Test.SendQueueMessage() )
  29. {
  30. _tprintf( _T("Failed to send message\n"));
  31. }
  32. }
  33. if( Test.CloseOpenQueue() != MQ_OK )
  34. _tprintf( _T("it failed to close the queue\n"));
  35. //Test.ConnectToQueue( MQ_PEEK_ACCESS );
  36. //_tprintf( _T("running count\n"));
  37. //Test.CountMessagesInQueue();
  38. }