[comp.windows.ms] Resources in PM 1.1

marc@mercury.sybase.com (I am Marc E. Strohwig) (01/06/90)

...Since there is no PM news group, I thought this to be the next best
place - so heres the problem.

In PM when you use CreateStdWindow(), WinLoadDlg() and several other
routines, you have the option of specifying the module from which these
routines will attempt to retrieve a specified resource.  If the MODULE
handle is null, then the resources are assumed to be within the
execution module.  If, on the other hand, the handle is one returned
by a call to DosLoadModule(), then these functions will search the
module specified by the handle for their resources.  

Now, I have a app. that consists of a resource defined menu and
dialog box.  I first call DosLoadModule() to load my resource DLL.
The returned handle is passed on the WinCreateStdWindow(). When the
window is shown, the window is painted and the menu shows up
correctly.  Now when the About menu item is clicked, WinLoadDlg() is
call with the same MODULE handle as was WinCreateStdWindow().
Unfortunately, the routine returns with PMERR_RESOURCE_NOT_FOUND.  I
have checked that the ID in the resource file matches the one passed
to WinLoadDlg().  I have disassembled the DLL and sure enough the
dialog template is there with the specified dialog ID.  I go back an
patch in DosGetResource() before calling WinLoadDlg().
DosGetResource() returns successfully and examination of the Seg.
selector returned by DosGetResource() shows that indeed the dialog
template was found and loaded.  A subsequent call the WinLoadDlg()
fails.  What gives ??   The Dos*() routines find the resources by the
PM routine don't.  
I went as far as double checking that the module was in fact loaded by
calling DosGetModHandle() - it returned the the same handle as the one
from DosLoadModule(). DosGetModName() shows that the DLL loaded is the
one created for the app.; path and all.  

Some facts about the app: The creation flags specify that the window only
has a menu bar - no title bar, no minmax, no system box, no size
boarders, no icon, no accel table, nothing; just a menu.

Is there anything weird about the ID range?
Does the app need any specific creation flags?
Are there any special restriction when use external resource
libraries?
Does RC.EXE have any debugging flags or options that could be used?
What?

Note that when the resources are compiled into the execution module
everything works fine. Its only when they get compiled in an external
DLL do thing stop working.  I have a second app that does similar
things and it successfully retrieves the resource from the DLL.

Anyone got any wild ideas??

	Thanx,
		_Marc

------------------------------------------------------------------------------
"We don't guarantee, any work caused by or arising out of the failure
    of the owner to comply with instructions or recommendations."

Marc E. Strohwig	-    		      "Opinions ?? Mine, mine, mine!!"
Sybase, Inc. 							marc@sybase.com
Emeryville, CA			    {pacbell, lll-tis, pyramid,sun}!sybase!marc

alistair@microsoft.UUCP (Alistair BANKS) (01/10/90)

In article <7823@sybase.sybase.com> marc@mercury.sybase.com (I am Marc E. Strohwig) writes:
>
>...Since there is no PM news group, I thought this to be the next best
>place - so heres the problem.

There ARE OS/2 newsgroups - comp.os.os2 - this group is active and well
informed - try posting there.

Alistair Banks
OS/2 Group
Microsoft