Solved

Wierd Problem with DialogBox

Posted on 1998-06-01
9
290 Views
Last Modified: 2010-04-02
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)SetupTarifProc, hInstance);
      DialogBox(hInstance, "DIALOG1", hwnd, (DLGPROC)lpfnTarifProc);
      FreeProcInstance(lpfnTarifProc);
}

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.
0
Comment
Question by:dsch
  • 4
  • 3
  • 2
9 Comments
 
LVL 6

Expert Comment

by:WxW
ID: 1165092
Have you executed InitCommonControls first ?
Are there common controls in your dialog ? Do you use a rich edit 2 ? Have you loaded RICHED20.DLL ?

0
 
LVL 22

Expert Comment

by:nietod
ID: 1165093
In win32 You don't need MakeProcInstance and FreeProcInstance().
0
 
LVL 1

Author Comment

by:dsch
ID: 1165094
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
0
 
LVL 6

Expert Comment

by:WxW
ID: 1165095
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
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:dsch
ID: 1165096
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
0
 
LVL 1

Author Comment

by:dsch
ID: 1165097
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.

0
 
LVL 22

Expert Comment

by:nietod
ID: 1165098
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.

0
 
LVL 6

Accepted Solution

by:
WxW earned 50 total points
ID: 1165099
These files are in the borland c++ directory , or in C:\WINDOWS or C:\WINDOWS\SYSTEM

First check if BC++ links your executable with BWCC.DLL in that case you need only to transfer your program with this file

If the system CAN find BWCC.DLL but it is not loaded , you need to execute TApplication :: EnableBWCC() before creating the window
0
 
LVL 1

Author Comment

by:dsch
ID: 1165100
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.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now