Can anyone help?
I am using Borland C++ 5.02 and creating a very simple app to display a dialog box. It works fine with a blank dialog box or if I have standard controls like edit boxes or push buttons.
However, when I include a progress bar, it builds fine, but will not run..... well, it does not create the dialog box.
=====================================================
Program code is listed here:
=====================================================
#include <windows.h>
#include "res.h"
/***************************************
Function Prototypes
***************************************/
BOOL WINAPI DlgProc (HWND hWnd, UINT msg,
UINT wParam, LONG lParam);
/***************************************
WinMain
***************************************/
#pragma argsused
int PASCAL WinMain(HANDLE hInstance,
HANDLE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
FARPROC fndlg = MakeProcInstance((FARPROC)DlgProc,
hInstance);
DialogBox (hInstance,
MAKEINTRESOURCE(IDD_DIALOG1),
NULL, fndlg);
return 0;
}
/************************************
Dialog Procedure for Main Dialog
***************************************/
#pragma argsused
BOOL WINAPI DlgProc (HWND hWnd, UINT msg,
UINT wParam, LONG lParam)
{
switch(msg)
{
case WM_INITDIALOG:
return(TRUE);
case WM_COMMAND:
switch (wParam)
{
case IDOK:
EndDialog(hWnd, FALSE);
break;
case IDCANCEL:
EndDialog(hWnd, TRUE);
break;
}
}
return(FALSE);
}
=====================================================
rc file listed below
=====================================================
/***********************************
testpgrs.rc
produced by Borland Resource Workshop
*****************************************/
#include "res.h"
IDD_DIALOG1 DIALOGEX 0, 0, 240, 120
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_CONTEXTHELP
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CONTEXTHELP
| WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION ""
FONT 8, "MS Sans Serif"
{
CONTROL "OK", IDOK, "BUTTON", BS_PUSHBUTTON |
BS_CENTER | WS_CHILD | WS_VISIBLE |
WS_TABSTOP, 186, 6, 50, 14
CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON |
BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
186, 26, 50, 14
CONTROL "Help", IDHELP, "BUTTON", BS_PUSHBUTTON |
BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
186, 46, 50, 14
CONTROL "ProgressBar1", IDC_PROGRESSBAR1,
"msctls_progress32", WS_CHILD | WS_VISIBLE | WS_BORDER,
24, 78, 168, 13
}
======================================================
Information from target expert.
======================================================
The project target is an application (exe) for win32
platform. The target model is GUI, and I have included
the class libraries Framework and the linking is done
staticly.
======================================================
The program fails as it is at the moment, but if the
following section is removed from the rc file, it will
work. Can someone tell me why this is so ? The same
thing happens with other common controls from the resource
workshop toolbox.
CONTROL "ProgressBar1", IDC_PROGRESSBAR1,
"msctls_progress32", WS_CHILD | WS_VISIBLE | WS_BORDER,
24, 78, 168, 13
======================================================
I am using Borland C++ 5.02 and creating a very simple app to display a dialog box. It works fine with a blank dialog box or if I have standard controls like edit boxes or push buttons.
However, when I include a progress bar, it builds fine, but will not run..... well, it does not create the dialog box.
=====================================================
Program code is listed here:
=====================================================
#include <windows.h>
#include "res.h"
/***************************************
Function Prototypes
***************************************/
BOOL WINAPI DlgProc (HWND hWnd, UINT msg,
UINT wParam, LONG lParam);
/***************************************
WinMain
***************************************/
#pragma argsused
int PASCAL WinMain(HANDLE hInstance,
HANDLE hPrevInstance,
LPSTR lpszCmdLine,
int nCmdShow)
{
FARPROC fndlg = MakeProcInstance((FARPROC)DlgProc,
hInstance);
DialogBox (hInstance,
MAKEINTRESOURCE(IDD_DIALOG1),
NULL, fndlg);
return 0;
}
/************************************
Dialog Procedure for Main Dialog
***************************************/
#pragma argsused
BOOL WINAPI DlgProc (HWND hWnd, UINT msg,
UINT wParam, LONG lParam)
{
switch(msg)
{
case WM_INITDIALOG:
return(TRUE);
case WM_COMMAND:
switch (wParam)
{
case IDOK:
EndDialog(hWnd, FALSE);
break;
case IDCANCEL:
EndDialog(hWnd, TRUE);
break;
}
}
return(FALSE);
}
=====================================================
rc file listed below
=====================================================
/***********************************
testpgrs.rc
produced by Borland Resource Workshop
*****************************************/
#include "res.h"
IDD_DIALOG1 DIALOGEX 0, 0, 240, 120
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_CONTEXTHELP
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CONTEXTHELP
| WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION ""
FONT 8, "MS Sans Serif"
{
CONTROL "OK", IDOK, "BUTTON", BS_PUSHBUTTON |
BS_CENTER | WS_CHILD | WS_VISIBLE |
WS_TABSTOP, 186, 6, 50, 14
CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON |
BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
186, 26, 50, 14
CONTROL "Help", IDHELP, "BUTTON", BS_PUSHBUTTON |
BS_CENTER | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
186, 46, 50, 14
CONTROL "ProgressBar1", IDC_PROGRESSBAR1,
"msctls_progress32", WS_CHILD | WS_VISIBLE | WS_BORDER,
24, 78, 168, 13
}
======================================================
Information from target expert.
======================================================
The project target is an application (exe) for win32
platform. The target model is GUI, and I have included
the class libraries Framework and the linking is done
staticly.
======================================================
The program fails as it is at the moment, but if the
following section is removed from the rc file, it will
work. Can someone tell me why this is so ? The same
thing happens with other common controls from the resource
workshop toolbox.
CONTROL "ProgressBar1", IDC_PROGRESSBAR1,
"msctls_progress32", WS_CHILD | WS_VISIBLE | WS_BORDER,
24, 78, 168, 13
======================================================