문제

after some processing my program shows a messagebox saying you can read a log file to know more about what has been done. I would like to show a link to the file instead the name of it. How is this done?

Thanks a lot

UPDATE:

IDD_RESULT_DIALOG DIALOGEX 0, 0, 228, 58
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Fax/Modem testing tool"
FONT 8, "Helv", 0, 0, 0x1
BEGIN
    PUSHBUTTON      "Cancelar",IDC_BUTTON1,174,38,50,14
    CONTROL         "<a>SysLink1</a>",IDC_SYSLINK1,"SysLink",WS_TABSTOP,105,22,32,14
END

This is the code on the rc file where the syslink control was created.

BOOL CALLBACK ResultDlg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch (msg)                  /* manipulador del mensaje */
    {
        case WM_INITDIALOG:
            SetWindowText(GetDlgItem(hDlg,IDC_SYSLINK1), (LPCSTR)"Visit my web site" );
           return TRUE;
        case WM_COMMAND:        
           EndDialog(hDlg, FALSE);
           return TRUE;
    }
    return FALSE;
}

This is where use SetWindowText ...

The dialog doesn't show up. If a Syslink control is embedded in the dialog. I'm not using MFC... can this be the problem?

도움이 되었습니까?

해결책

You can provide a button that will invoke Win32 function ShellExecute to open a log file.

다른 팁

IMHO, you have two options:

A) Make your own dialog from scratch

B) Use a thread hook (SetWindowsHookEx) and catch the initialization of the MessageBox(), resize it a little bit and add your own controls (XP and later have a link control that supports basic html. This control also exists on 2000 but is undocumented and has a different class name)

It seems to me the most direct solution would be to have your own dialog box that looks like a standard message window box and use the link control (referenced by Anders in this thread) in place of the standard static text.

I think this is much saner than the SetWindowHookEx route.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top