dsch
asked on
Wierd Problem with DialogBox
I am using Borland BC4.52 to do a win32 app.
In the program I respond to a right click of the mouse which calls:
void DoSetUpProc(HWND hwnd)
{
FARPROC lpfnTarifProc;
lpfnTarifProc = MakeProcInstance((FARPROC) SetupTarif Proc, hInstance);
DialogBox(hInstance, "DIALOG1", hwnd, (DLGPROC)lpfnTarifProc);
FreeProcInstance(lpfnTarif Proc);
}
DIALOG1 is the dialog box template and SetupTarifProc is defined in the Header file:
BOOL CALLBACK SetupTarifProc(HWND hwnd, WORD Msg, WORD wParam, LONG lParam);
Here is the procedure:
BOOL CALLBACK SetupTarifProc(HWND hdlg, WORD Msg, WORD wParam, LONG lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
LoadConnectionList(hdlg);
return TRUE;
case WM_CLOSE:
EndDialog(hdlg,wParam);
break ;
case WM_PAINT:
case WM_COMMAND:
{switch(wParam)
{
case IDC_QUIT:
EndDialog(hdlg,wParam);
break ;
case IDC_NEXT:
//LoadConnectionList(hwnd) ;
break;
}
}
}
return FALSE;
}
///
LoadConnectionList simply fills the boxes of the DialogBox.
Anyway. This works perfectly when the ide is open (only BC4.5 has to be loaded, not the project file) but when the ide is not open, the dialog will not load.
Nothing I do seems to fix this, Please help.
In the program I respond to a right click of the mouse which calls:
void DoSetUpProc(HWND hwnd)
{
FARPROC lpfnTarifProc;
lpfnTarifProc = MakeProcInstance((FARPROC)
DialogBox(hInstance, "DIALOG1", hwnd, (DLGPROC)lpfnTarifProc);
FreeProcInstance(lpfnTarif
}
DIALOG1 is the dialog box template and SetupTarifProc is defined in the Header file:
BOOL CALLBACK SetupTarifProc(HWND hwnd, WORD Msg, WORD wParam, LONG lParam);
Here is the procedure:
BOOL CALLBACK SetupTarifProc(HWND hdlg, WORD Msg, WORD wParam, LONG lParam)
{
switch(Msg)
{
case WM_INITDIALOG:
LoadConnectionList(hdlg);
return TRUE;
case WM_CLOSE:
EndDialog(hdlg,wParam);
break ;
case WM_PAINT:
case WM_COMMAND:
{switch(wParam)
{
case IDC_QUIT:
EndDialog(hdlg,wParam);
break ;
case IDC_NEXT:
//LoadConnectionList(hwnd)
break;
}
}
}
return FALSE;
}
///
LoadConnectionList simply fills the boxes of the DialogBox.
Anyway. This works perfectly when the ide is open (only BC4.5 has to be loaded, not the project file) but when the ide is not open, the dialog will not load.
Nothing I do seems to fix this, Please help.
In win32 You don't need MakeProcInstance and FreeProcInstance().
ASKER
To WxW. At the moment, I have just a bare window that responds to a right click of the mouse. I am not usind a rich edit (YET!). I am not using the common controls in this dialog but I have executed InitCommonControls anyway, and included <commctrl.h>. I just cant understand that it works when the compiler is open but not when it is closed. It is as if the Dialog Procedure exits straight away.
To nietod: I have removed MakeProcInstance and FreeProcInstance() and still no change.
Thanks for your your help so far
dsch
To nietod: I have removed MakeProcInstance and FreeProcInstance() and still no change.
Thanks for your your help so far
dsch
You must also make WPARAM wParam and LPARAM lParam in your callback function , not WORD and LONG .
In the WM_COMMAND handle , you must use LOWORD(wParam) to get the id.
Check if you are using Borland Common Controls , in that case I think you must load BWCC.DLL or BWCC32.DLL
In the WM_COMMAND handle , you must use LOWORD(wParam) to get the id.
Check if you are using Borland Common Controls , in that case I think you must load BWCC.DLL or BWCC32.DLL
ASKER
I am using the Controls made in the resource workshop. I think that this is the problem. I will try this out and let you know.
Thanks
Thanks
ASKER
It HAS TO BE BWCC.DLL or BWCC32.DLL as when I delete the controls lines like "BorBtn" or "BorShade" it all works. Where can I find these files and how do I link them using Borland BC4.52
Greatfully yours
dsch.
Greatfully yours
dsch.
You must already have linked with the .lib files at compile time. The DLLs are linked in the run-time. I guess the problem is that they are not being found.
To fix this
1. The directory that contans them should be in the path
2. They should be copied to the window directory
3. They should be in the directory that contains the executable.
You will also need to copy them when you install your app on other machines.
To fix this
1. The directory that contans them should be in the path
2. They should be copied to the window directory
3. They should be in the directory that contains the executable.
You will also need to copy them when you install your app on other machines.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It HAS TO BE BWCC.DLL or BWCC32.DLL as when I delete the controls lines like "BorBtn" or "BorShade" it all works. Where can I find these files and how do I link them using Borland BC4.52
Greatfully yours
dsch.
Greatfully yours
dsch.
Are there common controls in your dialog ? Do you use a rich edit 2 ? Have you loaded RICHED20.DLL ?