home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!microsoft!hexnut!blakeco
- From: blakeco@microsoft.com (Blake Coverett)
- Subject: Re: Mixing Windows API code & MFC
- Message-ID: <1992Aug27.223240.18862@microsoft.com>
- Date: 27 Aug 92 22:32:40 GMT
- Organization: Microsoft Canada Inc.
- References: <1992Aug26.044944.11302@csus.edu>
- Distribution: na
- Lines: 34
-
- In article <1992Aug26.044944.11302@csus.edu> vpcsc7@sfsuvax1.sfsu.edu (Dan Tauber) writes:
- >{
- >DLGPROC lpfnAbout = (DLGPROC) ::MakeProcInstance(
- > (FARPROC) ::AboutBox, hInst);
- >::DialogBox(hInst, "DT_ABOUT", m_hWnd, lpfnAbout);
- >::FreeProcInstance((FARPROC)lpfnAbout);
- >}
- >
- >hInst is a global handle that I initialize with the
- >AfxGetInstanceHandle() function when the program starts. m_hWnd
- >is the CWnd member function that holds the handle to the window.
- >I also export the AboutBox funtion in the def file.
-
- By rights your second use of hInst (in ::DialogBox) should be
- AfxGetResourceHandle(), but in practice unless you are doing something
- creative (like loading resources from a DLL) these values should be the
- same so I doubt that is a problem.
-
- The rest looks fine to me so I would guess the problem is in ::AboutBox;
- perhaps returning garbage instead of FALSE if you don't handle the message?
-
- The big question is, why not just use MFC:
-
- {
- CModalDialog about("DT_ABOUT", this);
- about.DoModal();
- }
-
- will do nicely if you have a 'normal' About box. No dialog proc needed.
-
- -Blake
- --
- #include <std/disclaimer.h> blakeco@microsoft.com
- Mail Flames, Post Apologies. ...!uunet!microsoft!blakeco
-