www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - Repeat of Newbie Question About DMC with Win32

reply NuToWin32 <NuToWin32_member pathlink.com> writes:
I posted about a week ago, but only got one reply, which unfortuneatly didn't
help, so I'm reposting the problem, now summed up. (I apologize for the repost,
fixing this problem is somewhat urgent though)

 Executing: C:\PROGRAMMING\CONTEXT\ConExec.exe "C:\Programming\dm\bin\Sc.exe"
"C:\Programming\WinDBMst\windbmst.cpp" -oC:\Programming\WinDBMst\windbmst.exe
-mn -WA windbmst.def
DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT), hwndMain,AboutDlg); ^ C:\Programming\WinDBMst\windbmst.cpp(204) : Error: need explicit cast for function parameter 4 to get from: int (*std func)(void *,unsigned ,unsigned ,long ) to : int (*__import std func)() When AboutDlg is cast as DLGPROC, the error isn't generated, but neither will the dialogbox command function properly. Under other compilers the same bit of code works, but not under DMC, however, it's DMC I wish to use. What is the syntax in DMC for passing a dialog procedure to DialogBox, paremeter 4?
Sep 04 2002
parent reply Chris <chris widdows.demon.nl> writes:
On Wed, 4 Sep 2002 20:19:50 +0000 (UTC), NuToWin32
<NuToWin32_member pathlink.com> wrote:

Hi,

I'm not quite sure what is going wrong, but I have a program that does:

if (DialogBox(hInst, MAKEINTRESOURCE(IDD_ADJUST), hwnd,
(DLGPROC)AdjustProc) == IDOK)

AdjustProc having this sig
proto:
 BOOL CALLBACK AdjustProc       (HWND hDlg, UINT iMsg, WPARAM wParam,
LPARAM lParam);

and start of function:
BOOL CALLBACK AdjustProc (HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM)

Compiled as MCBS or Unicode Win NT exe and it is not using MFC. Works fine.

The cast to DLGPROC is required, but you have to make sure the function sig
matches the docs. 

HTH Chris

I posted about a week ago, but only got one reply, which unfortuneatly didn't
help, so I'm reposting the problem, now summed up. (I apologize for the repost,
fixing this problem is somewhat urgent though)

 Executing: C:\PROGRAMMING\CONTEXT\ConExec.exe "C:\Programming\dm\bin\Sc.exe"
"C:\Programming\WinDBMst\windbmst.cpp" -oC:\Programming\WinDBMst\windbmst.exe
-mn -WA windbmst.def
DialogBox(hInst,MAKEINTRESOURCE(IDD_ABOUT), hwndMain,AboutDlg); ^ C:\Programming\WinDBMst\windbmst.cpp(204) : Error: need explicit cast for function parameter 4 to get from: int (*std func)(void *,unsigned ,unsigned ,long ) to : int (*__import std func)() When AboutDlg is cast as DLGPROC, the error isn't generated, but neither will the dialogbox command function properly. Under other compilers the same bit of code works, but not under DMC, however, it's DMC I wish to use. What is the syntax in DMC for passing a dialog procedure to DialogBox, paremeter 4?
Sep 04 2002
parent NuToWin32 <NuToWin32_member pathlink.com> writes:
In article <533dnuo41rb55vs4i0mstvsan56i3bohb5 4ax.com>, Chris says...
On Wed, 4 Sep 2002 20:19:50 +0000 (UTC), NuToWin32
<NuToWin32_member pathlink.com> wrote:

Hi,
 (snipped)

The cast to DLGPROC is required, but you have to make sure the function sig
matches the docs. 

HTH Chris
Thank you, knowing at least that DLGPROC casting is definately required helps quite a bit, for a while I was using the lcc-win32 compiler, but it's lack of c++ support got in the way. I switched to DMC almost without error, but unfortuneatly some function calls aren't recognized (CreateFont, CreateStatusWindow, DeleteObject) I figure I'm not including the write header files(currently using windows.h, windowsx.h, and commctrl.h. If you have any further information as to this, it would be much appreciated.
Sep 05 2002