home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / os / mswindo / programm / tools / 1772 < prev    next >
Encoding:
Text File  |  1992-12-21  |  2.6 KB  |  61 lines

  1. Newsgroups: comp.os.ms-windows.programmer.tools
  2. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!caen!malgudi.oar.net!news.ans.net!cmcl2!panix!rryan
  3. From: rryan@panix.com (Rob Ryan)
  4. Subject: Re: Resource Help
  5. Message-ID: <1992Dec19.035850.7088@panix.com>
  6. Date: Sat, 19 Dec 1992 03:58:50 GMT
  7. References: <BzEzJ2.4FA@newsserver.technet.sg> <1992Dec18.222932.23800@emr1.emr.ca>
  8. Organization: Panix, NYC
  9. Lines: 50
  10.  
  11. In <1992Dec18.222932.23800@emr1.emr.ca> jagrant@emr1.emr.ca (John Grant) writes:
  12.  
  13. >In article <BzEzJ2.4FA@newsserver.technet.sg> scstech@solomon.technet.sg (Kenneth Soh) writes:
  14. >
  15. >>This is my first attempt to use a resource from a windows program.
  16. >>I've created a dialog window using the Microsoft Windows' Dialog
  17. >>Editor and I intend to use it in my program as a modeless dialog.
  18. >>
  19. >>I am using the Microsoft MFC classes and I have inherited from
  20. >>the CDialog a customised class of my own. The constructor of this
  21. >>class then does a call to Create( <resource-dialog-name>, <parent
  22. >>window> ). I then call SendMessage(WM_INITDIALOG) to force my
  23. >>OnInitDiag() to execute.
  24.  
  25. You shouldn't have to do that.  MFC will automatically send the
  26. WM_INITDIALOG for you.  So, as long as you have ON_WM_INITDIALOG() in
  27. your message map (or whatever it is), everything should be fine.  No
  28. SendMessage should be needed.  Also, I don't have my docs in front of
  29. me, but isn't the default function name OnInitDialog()?
  30.  
  31. >>I cannot manage to get the dialog window out and hence upon tracing
  32. >>I realise that my Create() actually returns zero. The resource
  33. >>cannot be loaded. Can someone advise ??
  34. >
  35. >    Did you compile the resource script and bind it into your
  36. >    .exe?  I don't know how MS does this, but in Borland, just
  37. >    put the .rc script file in the project and the make will
  38. >    invoke the resource compiler.
  39.  
  40. If you use PWB to create your "project", and use the "Edit Project" to
  41. insert the .RC file, it will do all the necessary resource compiling
  42. for you.  Thus, compiling your code will amount to something to the
  43. effect of:
  44.  
  45.    cl -c file.c
  46.    rc -R file.rc file.res
  47.    link file.obj ... // whatever
  48.    rc file.res file.exe
  49.  
  50. Again, I don't have the docs in front of me, but if you use PWB, it
  51. will do this all for you.  If you're doing it manually (or making your
  52. own makefile) the steps are (a) compile c/c++ code (without linking);
  53. (b) use RC to compile .rc file into a .res file; (c) link the .obj
  54. from step (a); and (d) use RC to integrate .res from step (b) with
  55. .exe from step (c).  Although I've given these 4 steps above, I may
  56. have gotten the command line syntax wrong (I generally use PWB).
  57.  
  58. -- 
  59.  Rob Ryan
  60.     rryan@panix.com
  61.