为什么我的对话框看起来像这样?

时间:2015-04-22 17:33:55

标签: c++ dialog window box

我在资源文件中创建了一个简单的对话框。当我尝试使用DialogBox()生成它时,会出现对话框但看起来没有窗口。我不知道为什么会这样。有什么建议吗?

跑步时看起来像这样,你可以看到没有窗户。复选框,文本和东西没有背景,并且没有标题栏。什么都没有。

enter image description here

它应该显示为:

enter image description here

我用来产生它的代码是:

bool mostrarVentanaConfiguracion() {

    DialogBox(GetModuleHandle(0), MAKEINTRESOURCE(ID_DIAG_CONFIG), NULL, (DLGPROC)VentanaConfiguracion);
    return true;
}

这是.rc文件代码:

LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
ID_DIAG_CONFIG DIALOG 260, 200, 339, 203
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU | WS_BORDER | WS_VISIBLE
CAPTION "Configuración"
FONT 8, "Ms Shell Dlg"
{
    LTEXT           "Pulsar la combinación de teclas.", 0, 218, 18, 102, 9, SS_LEFT, WS_EX_LEFT
    CONTROL         "", ID_CONF_MACRO, HOTKEY_CLASS, WS_TABSTOP, 136, 16, 77, 12, WS_EX_LEFT
    EDITTEXT        ID_CONF_INDICATIVO, 16, 16, 70, 12, ES_AUTOHSCROLL, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_REUNION, 14, 67, 8, 8, 0, WS_EX_LEFT
    LTEXT           "... avisos de reuniones o 10-80 general.", 0, 28, 67, 125, 9, SS_LEFT, WS_EX_LEFT
    GROUPBOX        "Configuración de los avisos", 0, 5, 36, 328, 142, 0, WS_EX_LEFT
    PUSHBUTTON      "Cancelar", IDCANCEL, 220, 184, 49, 14, 0, WS_EX_LEFT
    DEFPUSHBUTTON   "Guardar\r\n", IDOK, 280, 184, 54, 14, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_SEISADAM, 14, 80, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_CODIGOCINCO, 14, 92, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_CENTRALITA, 14, 105, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_REP_UNIDADES, 14, 117, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_PROPIO, 14, 129, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_PEDIDOS, 14, 141, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_PEDIDOS_SWAT, 14, 153, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_SIN_ASIG, 14, 165, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_PANICO, 187, 67, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_APOYO, 187, 79, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_HERIDO, 187, 91, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_ROBO_COCHE, 187, 103, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_ROBO_CASA, 187, 115, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_ROBO_NEG, 187, 127, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_PAPAFOX, 187, 139, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_ROBO_BANCO, 187, 151, 8, 8, 0, WS_EX_LEFT
    AUTOCHECKBOX    "Check", ID_A_CUSTODIA, 187, 163, 8, 8, 0, WS_EX_LEFT
    LTEXT           "Recibir notificaciones sonoras para...", 0, 14, 50, 117, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de CÓDIGO 6-ADAM.", 0, 28, 79, 100, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de CÓDIGO 5.", 0, 28, 91, 77, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de centralita roleados.", 0, 28, 103, 100, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... pedidos de reportes de unidades.", 0, 28, 115, 114, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos a mi propia unidad o nombre.", 0, 28, 127, 122, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de pedidos generales (10-32, 10-37...)", 0, 28, 139, 150, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de pedidos para SWAT", 0, 28, 151, 105, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de agentes sin asignación.", 0, 28, 163, 115, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de botón de pánico.", 0, 201, 67, 94, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de solicitud de apoyo (/ref)", 0, 201, 79, 115, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de herido.", 0, 201, 91, 62, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de robo de vehículo.", 0, 201, 103, 97, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de robo a vivienda. ", 0, 201, 115, 94, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de robo a negocio.", 0, 201, 127, 90, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de alarma de prisión federal.", 0, 201, 139, 119, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de robo a banco.", 0, 201, 151, 85, 9, SS_LEFT, WS_EX_LEFT
    LTEXT           "... avisos de sospechosos bajo custodia.", 0, 201, 163, 128, 9, SS_LEFT, WS_EX_LEFT
    GROUPBOX        "Configuración del indicativo", 0, 7, 4, 114, 28, 0, WS_EX_LEFT
    GROUPBOX        "Macro para desactivar el programa temporalmente", 0, 127, 4, 206, 28, 0, WS_EX_LEFT
}

1 个答案:

答案 0 :(得分:1)

我已经修好了。我在对话程序中返回true而不是false。

来自MSDN:

“通常,对话框过程在处理消息时应返回TRUE,如果没有则返回FALSE。如果对话框过程返回FALSE,则对话框管理器执行默认对话操作以响应消息。”< / p>