📄 dialog.c
字号:
}
}
else ptr = buffer;
if (unicode)
{
if (len > 0 && !WideCharToMultiByte( CP_ACP, 0, ptr, -1, (LPSTR)str, len, 0, 0 ))
((LPSTR)str)[len-1] = 0;
}
else lstrcpynW( str, ptr, len );
HeapFree( GetProcessHeap(), 0, buffer );
DPRINT("Returning %d '%s'\n", ret, str );
return ret;
}
/***********************************************************************
* GetDlgItemEnumProc
*
* Callback for GetDlgItem
*/
BOOL CALLBACK GetDlgItemEnumProc (HWND hwnd, LPARAM lParam )
{
GETDLGITEMINFO * info = (GETDLGITEMINFO *)lParam;
if(info->nIDDlgItem == GetWindowLongW( hwnd, GWL_ID ))
{
info->control = hwnd;
return FALSE;
}
return TRUE;
}
/* FUNCTIONS *****************************************************************/
/*
* @implemented
*/
HWND
STDCALL
CreateDialogIndirectParamAorW(
HINSTANCE hInstance,
LPCDLGTEMPLATE lpTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM lParamInit,
DWORD Flags)
{
/* FIXME:
* This function might be obsolete since I don't think it is exported by NT
* Also wine has one more parameter identifying weather it should call
* the function with unicode or not
*/
return DIALOG_CreateIndirect( hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit , !Flags, FALSE );
}
/*
* @implemented
*/
HWND
STDCALL
CreateDialogIndirectParamA(
HINSTANCE hInstance,
LPCDLGTEMPLATE lpTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM lParamInit)
{
return CreateDialogIndirectParamAorW( hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit, 2 );
}
/*
* @implemented
*/
HWND
STDCALL
CreateDialogIndirectParamW(
HINSTANCE hInstance,
LPCDLGTEMPLATE lpTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM lParamInit)
{
return CreateDialogIndirectParamAorW( hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit, 0);
}
/*
* @implemented
*/
HWND
STDCALL
CreateDialogParamA(
HINSTANCE hInstance,
LPCSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam)
{
HRSRC hrsrc;
LPCDLGTEMPLATE ptr;
if (!(hrsrc = FindResourceA( hInstance, lpTemplateName, (LPCSTR)RT_DIALOG ))) return 0;
if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
return CreateDialogIndirectParamA( hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam );
}
/*
* @implemented
*/
HWND
STDCALL
CreateDialogParamW(
HINSTANCE hInstance,
LPCWSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam)
{
HRSRC hrsrc;
LPCDLGTEMPLATE ptr;
if (!(hrsrc = FindResourceW( hInstance, lpTemplateName, (LPCWSTR)RT_DIALOG ))) return 0;
if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
return CreateDialogIndirectParamW( hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam );
}
/*
* @implemented
*/
LRESULT
STDCALL
DefDlgProcA(
HWND hDlg,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
{
WNDPROC dlgproc;
BOOL result = FALSE;
DIALOGINFO * dlgInfo;
/* if there's no dialog info property then call default windows proc?? */
if (!(dlgInfo = GETDLGINFO(hDlg)))
return DefWindowProcA( hDlg, Msg, wParam, lParam );
SetWindowLongPtrW( hDlg, DWLP_MSGRESULT, 0 );
if ((dlgproc = (WNDPROC)GetWindowLongPtrW( hDlg, DWLP_DLGPROC )))
{
/* Call dialog procedure */
result = CallWindowProcA( dlgproc, hDlg, Msg, wParam, lParam );
}
if (!result && IsWindow(hDlg))
{
/* callback didn't process this message */
switch(Msg)
{
case WM_ERASEBKGND:
case WM_SHOWWINDOW:
case WM_ACTIVATE:
case WM_SETFOCUS:
case DM_SETDEFID:
case DM_GETDEFID:
case WM_NEXTDLGCTL:
case WM_GETFONT:
case WM_CLOSE:
case WM_NCDESTROY:
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
return DEFDLG_Proc( hDlg, Msg, wParam, lParam, dlgInfo );
case WM_INITDIALOG:
case WM_VKEYTOITEM:
case WM_COMPAREITEM:
case WM_CHARTOITEM:
break;
default:
return DefWindowProcA( hDlg, Msg, wParam, lParam );
}
}
return DEFDLG_Epilog(hDlg, Msg, result);
}
/*
* @implemented
*/
LRESULT
STDCALL
DefDlgProcW(
HWND hDlg,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
{
WNDPROC dlgproc;
BOOL result = FALSE;
DIALOGINFO * dlgInfo;
/* if there's no dialog info property then call default windows proc?? */
if (!(dlgInfo = GETDLGINFO(hDlg)))
return DefWindowProcW( hDlg, Msg, wParam, lParam );
SetWindowLongPtrW( hDlg, DWLP_MSGRESULT, 0 );
if ((dlgproc = (WNDPROC)GetWindowLongPtrW( hDlg, DWLP_DLGPROC )))
{
/* Call dialog procedure */
result = CallWindowProcW( dlgproc, hDlg, Msg, wParam, lParam );
}
if (!result && IsWindow(hDlg))
{
/* callback didn't process this message */
switch(Msg)
{
case WM_ERASEBKGND:
case WM_SHOWWINDOW:
case WM_ACTIVATE:
case WM_SETFOCUS:
case DM_SETDEFID:
case DM_GETDEFID:
case WM_NEXTDLGCTL:
case WM_GETFONT:
case WM_CLOSE:
case WM_NCDESTROY:
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
return DEFDLG_Proc( hDlg, Msg, wParam, lParam, dlgInfo );
case WM_INITDIALOG:
case WM_VKEYTOITEM:
case WM_COMPAREITEM:
case WM_CHARTOITEM:
break;
default:
return DefWindowProcW( hDlg, Msg, wParam, lParam );
}
}
return DEFDLG_Epilog(hDlg, Msg, result);
}
/*
* @implemented
*/
INT_PTR
STDCALL
DialogBoxIndirectParamAorW(
HINSTANCE hInstance,
LPCDLGTEMPLATE hDialogTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam,
DWORD Flags)
{
/* FIXME:
* This function might be obsolete since I don't think it is exported by NT
* Also wine has one more parameter identifying weather it should call
* the function with unicode or not
*/
HWND hWnd = DIALOG_CreateIndirect( hInstance, hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam, !Flags, TRUE );
if (hWnd) return DIALOG_DoDialogBox( hWnd, hWndParent );
return -1;
}
/*
* @implemented
*/
INT_PTR
STDCALL
DialogBoxIndirectParamA(
HINSTANCE hInstance,
LPCDLGTEMPLATE hDialogTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam)
{
return DialogBoxIndirectParamAorW( hInstance, hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam, 2);
}
/*
* @implemented
*/
INT_PTR
STDCALL
DialogBoxIndirectParamW(
HINSTANCE hInstance,
LPCDLGTEMPLATE hDialogTemplate,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam)
{
return DialogBoxIndirectParamAorW( hInstance, hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam, 0);
}
/*
* @implemented
*/
INT_PTR
STDCALL
DialogBoxParamA(
HINSTANCE hInstance,
LPCSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam)
{
HWND hwnd;
HRSRC hrsrc;
LPCDLGTEMPLATE ptr;
if (!(hrsrc = FindResourceA( hInstance, lpTemplateName, (LPCSTR)RT_DIALOG ))) return 0;
if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam, FALSE, TRUE);
if (hwnd) return DIALOG_DoDialogBox(hwnd, hWndParent);
return -1;
}
/*
* @implemented
*/
INT_PTR
STDCALL
DialogBoxParamW(
HINSTANCE hInstance,
LPCWSTR lpTemplateName,
HWND hWndParent,
DLGPROC lpDialogFunc,
LPARAM dwInitParam)
{
HWND hwnd;
HRSRC hrsrc;
LPCDLGTEMPLATE ptr;
if (!(hrsrc = FindResourceW( hInstance, lpTemplateName, (LPCWSTR)RT_DIALOG ))) return 0;
if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam, TRUE, TRUE);
if (hwnd) return DIALOG_DoDialogBox(hwnd, hWndParent);
return -1;
}
/*
* @implemented
*/
int
STDCALL
DlgDirListA(
HWND hDlg,
LPSTR lpPathSpec,
int nIDListBox,
int nIDStaticPath,
UINT uFileType)
{
return DIALOG_DlgDirListA( hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType, FALSE );
}
/*
* @implemented
*/
int
STDCALL
DlgDirListComboBoxA(
HWND hDlg,
LPSTR lpPathSpec,
int nIDComboBox,
int nIDStaticPath,
UINT uFiletype)
{
return DIALOG_DlgDirListA( hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype, TRUE );
}
/*
* @implemented
*/
int
STDCALL
DlgDirListComboBoxW(
HWND hDlg,
LPWSTR lpPathSpec,
int nIDComboBox,
int nIDStaticPath,
UINT uFiletype)
{
return DIALOG_DlgDirListW( hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype, TRUE );
}
/*
* @implemented
*/
int
STDCALL
DlgDirListW(
HWND hDlg,
LPWSTR lpPathSpec,
int nIDListBox,
int nIDStaticPath,
UINT uFileType)
{
return DIALOG_DlgDirListW( hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType, FALSE );
}
/*
* @implemented
*/
BOOL
STDCALL
DlgDirSelectComboBoxExA(
HWND hDlg,
LPSTR lpString,
int nCount,
int nIDComboBox)
{
return DIALOG_DlgDirSelect( hDlg, (LPWSTR)lpString, nCount, nIDComboBox, FALSE, TRUE );
}
/*
* @implemented
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -