home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / mswindo / programm / misc / 1539 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.6 KB  |  46 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!microsoft!hexnut!blakeco
  3. From: blakeco@microsoft.com (Blake Coverett)
  4. Subject: Re: Mixing Windows API code & MFC
  5. Message-ID: <1992Aug27.223240.18862@microsoft.com>
  6. Date: 27 Aug 92 22:32:40 GMT
  7. Organization: Microsoft Canada Inc.
  8. References: <1992Aug26.044944.11302@csus.edu>
  9. Distribution: na
  10. Lines: 34
  11.  
  12. In article <1992Aug26.044944.11302@csus.edu> vpcsc7@sfsuvax1.sfsu.edu (Dan Tauber) writes:
  13. >{
  14. >DLGPROC lpfnAbout = (DLGPROC) ::MakeProcInstance(
  15. >                   (FARPROC) ::AboutBox, hInst);
  16. >::DialogBox(hInst, "DT_ABOUT", m_hWnd, lpfnAbout);
  17. >::FreeProcInstance((FARPROC)lpfnAbout);
  18. >}
  19. >
  20. >hInst is a global handle that I initialize with the
  21. >AfxGetInstanceHandle() function when the program starts.  m_hWnd
  22. >is the CWnd member function that holds the handle to the window.
  23. >I also export the AboutBox funtion in the def file.
  24.  
  25. By rights your second use of hInst (in ::DialogBox) should be 
  26. AfxGetResourceHandle(), but in practice unless you are doing something
  27. creative (like loading resources from a DLL) these values should be the
  28. same so I doubt that is a problem.
  29.  
  30. The rest looks fine to me so I would guess the problem is in ::AboutBox; 
  31. perhaps returning garbage instead of FALSE if you don't handle the message?  
  32.  
  33. The big question is, why not just use MFC:
  34.  
  35. {
  36.     CModalDialog about("DT_ABOUT", this);
  37.     about.DoModal();
  38. }
  39.  
  40. will do nicely if you have a 'normal' About box.  No dialog proc needed.
  41.  
  42. -Blake
  43. -- 
  44. #include <std/disclaimer.h>                       blakeco@microsoft.com
  45. Mail Flames, Post Apologies.                      ...!uunet!microsoft!blakeco
  46.