🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools
Article #714

Re: Resource Help

#714
From: Rob Ryan
Date: Sat, 19 Dec 1992 03:58
50 lines
2699 bytes
In <1992Dec18.222932.23800@emr1.emr.ca> jagrant@emr1.emr.ca (John Grant) writes:

>In article <BzEzJ2.4FA@newsserver.technet.sg> scstech@solomon.technet.sg (Kenneth Soh) writes:
>
>>This is my first attempt to use a resource from a windows program.
>>I've created a dialog window using the Microsoft Windows' Dialog
>>Editor and I intend to use it in my program as a modeless dialog.
>>
>>I am using the Microsoft MFC classes and I have inherited from
>>the CDialog a customised class of my own. The constructor of this
>>class then does a call to Create( <resource-dialog-name>, <parent
>>window> ). I then call SendMessage(WM_INITDIALOG) to force my
>>OnInitDiag() to execute.

You shouldn't have to do that.  MFC will automatically send the
WM_INITDIALOG for you.  So, as long as you have ON_WM_INITDIALOG() in
your message map (or whatever it is), everything should be fine.  No
SendMessage should be needed.  Also, I don't have my docs in front of
me, but isn't the default function name OnInitDialog()?

>>I cannot manage to get the dialog window out and hence upon tracing
>>I realise that my Create() actually returns zero. The resource
>>cannot be loaded. Can someone advise ??
>
>	Did you compile the resource script and bind it into your
>	.exe?  I don't know how MS does this, but in Borland, just
>	put the .rc script file in the project and the make will
>	invoke the resource compiler.

If you use PWB to create your "project", and use the "Edit Project" to
insert the .RC file, it will do all the necessary resource compiling
for you.  Thus, compiling your code will amount to something to the
effect of:

   cl -c file.c
   rc -R file.rc file.res
   link file.obj ... // whatever
   rc file.res file.exe

Again, I don't have the docs in front of me, but if you use PWB, it
will do this all for you.  If you're doing it manually (or making your
own makefile) the steps are (a) compile c/c++ code (without linking);
(b) use RC to compile .rc file into a .res file; (c) link the .obj
from step (a); and (d) use RC to integrate .res from step (b) with
.exe from step (c).  Although I've given these 4 steps above, I may
have gotten the command line syntax wrong (I generally use PWB).

-- 
 Rob Ryan
    rryan@panix.com
Technical Details
Message-ID: <1992Dec19.035850.7088@panix.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sdd.hp.com!caen!malgudi.oar.net!news.ans.net!cmcl2!panix!rryan
References: <BzEzJ2.4FA@newsserver.technet.sg> <1992Dec18.222932.23800@emr1.emr.ca>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.tools
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!sdd.hp.com!caen!malgudi.oar.net!news.ans.net!cmcl2!panix!rryan
From: rryan@panix.com (Rob Ryan)
Subject: Re: Resource Help
Message-ID: <1992Dec19.035850.7088@panix.com>
Date: Sat, 19 Dec 1992 03:58:50 GMT
References: <BzEzJ2.4FA@newsserver.technet.sg> <1992Dec18.222932.23800@emr1.emr.ca>
Organization: Panix, NYC
Lines: 50