Thread View: comp.os.ms-windows.programmer.tools
3 messages
3 total messages
Started by Kenneth Soh
Thu, 17 Dec 1992 17:35
Resource Help
Author: Kenneth Soh
Date: Thu, 17 Dec 1992 17:35
Date: Thu, 17 Dec 1992 17:35
20 lines
1200 bytes
1200 bytes
Hi ! 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. 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 ?? Many thanks. Kenneth Soh Singapore
Re: Resource Help
Author: John Grant
Date: Fri, 18 Dec 1992 22:29
Date: Fri, 18 Dec 1992 22:29
25 lines
1502 bytes
1502 bytes
In article <BzEzJ2.4FA@newsserver.technet.sg> scstech@solomon.technet.sg (Kenneth Soh) writes: >Hi ! > >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. > >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. -- John A. Grant jagrant@emr1.emr.ca Airborne Geophysics Geological Survey of Canada, Ottawa
Re: Resource Help
Author: Rob Ryan
Date: Sat, 19 Dec 1992 03:58
Date: Sat, 19 Dec 1992 03:58
50 lines
2699 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads