[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: TSVN harms WaitForInputIdle function

From: Ryoji Ohta <r-oota_at_ah.jp.nec.com>
Date: Wed, 16 Apr 2008 18:40:05 +0900

Stefan Ku"ng <tortoisesvn_at_gmail.com>" wrote:
> Where did you get that information?
> If that's really true, then that would be a bug in Vista.

On Vista, it never occurs with current TSVN version(1.4.8).

Here is my small sample code.

BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
  HWND hWnd;
  hInst = hInstance;

  SHFILEINFO sfi;
  CoInitialize(NULL);
  SHGetFileInfo(_T(".0"), FILE_ATTRIBUTE_DIRECTORY,
    &sfi, sizeof(SHFILEINFO),
    SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES);
  Sleep(1000); // some work

  hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
  if (!hWnd)
    return FALSE;

  ShowWindow(hWnd, nCmdShow);
  UpdateWindow(hWnd);

  return TRUE;
}

LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
  WPARAM wParam, LPARAM lParam)
{
  int wmId, wmEvent;
  PAINTSTRUCT ps;
  HDC hdc;

  switch (message)
  {
  case WM_COMMAND:
    wmId = LOWORD(wParam);
    wmEvent = HIWORD(wParam);
    switch (wmId)
    {
    case IDM_ABOUT:
      //DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
      STARTUPINFO s;
      PROCESS_INFORMATION p;
      TCHAR szCommand[MAX_PATH];

      ::ZeroMemory( &s, sizeof(s) );
      s.cb = sizeof(s);
      GetModuleFileName( NULL, szCommand, MAX_PATH );
      CreateProcess( NULL, szCommand, NULL, NULL,
        FALSE, 0, NULL, NULL, &s, &p );
      ::WaitForInputIdle( p.hProcess, INFINITE );
      ::CloseHandle( p.hThread );
      ::CloseHandle( p.hProcess );

      HWND hWndFind;
      DWORD dwPid;
      hWndFind = FindWindowEx( GetDesktopWindow(), NULL,
        szWindowClass, NULL);
      while( hWndFind ){
        GetWindowThreadProcessId( hWndFind, &dwPid );
        if( dwPid == p.dwProcessId )
          break;
        hWndFind = FindWindowEx( GetDesktopWindow(), hWndFind,
          szWindowClass, NULL);
      }
      MessageBox( hWnd, hWndFind? _T("OK"): _T("EROR"),
        _T("FindWindow"), MB_OK );
      break;
    case IDM_EXIT:
      DestroyWindow(hWnd);
      break;
    default:
      return DefWindowProc(hWnd, message, wParam, lParam);
    }
    break;
  case WM_PAINT:
    hdc = BeginPaint(hWnd, &ps);
    EndPaint(hWnd, &ps);
    break;
  case WM_DESTROY:
    PostQuitMessage(0);
    break;
  default:
    return DefWindowProc(hWnd, message, wParam, lParam);
  }
  return 0;
}

Ryoji Ohta

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: users-help_at_tortoisesvn.tigris.org
Received on 2008-04-16 11:40:37 CEST

This is an archived mail posted to the TortoiseSVN Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.