我要用WINDBG调试一个EXE,我想查看点击CFileDiaog对话框的OK按钮之后的代码,应该在哪里设断点?我设了GetFilePath和GetFileName断点,但是在这里断不下来

解决方案 »

  1.   

    重设窗口函数,判断WM_COMMAND、IDOK来设置断点。
      

  2.   

    那就是说跟到CFileDialog里面看看了
      

  3.   

    int CFileDialog::DoModal()
    {
    ASSERT_VALID(this);
    ASSERT(m_ofn.Flags & OFN_ENABLEHOOK);
    ASSERT(m_ofn.lpfnHook != NULL); // can still be a user hook // zero out the file buffer for consistent parsing later
    ASSERT(AfxIsValidAddress(m_ofn.lpstrFile, m_ofn.nMaxFile));
    DWORD nOffset = lstrlen(m_ofn.lpstrFile)+1;
    ASSERT(nOffset <= m_ofn.nMaxFile);
    memset(m_ofn.lpstrFile+nOffset, 0, (m_ofn.nMaxFile-nOffset)*sizeof(TCHAR)); // WINBUG: This is a special case for the file open/save dialog,
    //  which sometimes pumps while it is coming up but before it has
    //  disabled the main window.
    HWND hWndFocus = ::GetFocus();
    BOOL bEnableParent = FALSE;
    m_ofn.hwndOwner = PreModal();
    AfxUnhookWindowCreate();
    if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner))
    {
    bEnableParent = TRUE;
    ::EnableWindow(m_ofn.hwndOwner, FALSE);
    } _AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
    ASSERT(pThreadState->m_pAlternateWndInit == NULL); if (m_ofn.Flags & OFN_EXPLORER)
    pThreadState->m_pAlternateWndInit = this;
    else
    AfxHookWindowCreate(this); int nResult;
    [color=#FF0000][/ if (m_bOpenFileDialog)
    nResult = ::GetOpenFileName(&m_ofn);
    else
    nResult = ::GetSaveFileName(&m_ofn);color] if (nResult)
    ASSERT(pThreadState->m_pAlternateWndInit == NULL);
    pThreadState->m_pAlternateWndInit = NULL; // WINBUG: Second part of special case for file open/save dialog.
    if (bEnableParent)
    ::EnableWindow(m_ofn.hwndOwner, TRUE);
    if (::IsWindow(hWndFocus))
    ::SetFocus(hWndFocus); PostModal();
    return nResult ? nResult : IDCANCEL;
    }断点就设在红字后面