Path: utzoo!attcan!uunet!mcsun!unido!gmdzi!strobl From: strobl@gmdzi.UUCP (Wolfgang Strobl) Newsgroups: comp.sys.mac.misc Subject: Re: The Mac's resource fork: does Win 3 have one? Message-ID: <3038@gmdzi.UUCP> Date: 5 Jul 90 11:13:14 GMT References: <2322.268f7cca@csc.anu.oz> <2964@gmdzi.UUCP> <7705@jarthur.Claremont.EDU> <2966@gmdzi.UUCP> <23070@boulder.Colorado.EDU> <2987@gmdzi.UUCP> <42649@apple.Apple.COM> Organization: GMD, Sankt Augustin, F. R. Germany Lines: 91 daveo@Apple.COM (David M. O'Rourke) writes: >strobl@gmdzi.UUCP (Wolfgang Strobl) writes: >>This includes Windows Programmers, too. There seems to be NO DIFFERENCE >>between MS Windows and the Macintosh OS, here. Both separate >>programs into a user interface part (icons, bitmaps, menues, keyboard >>accelerators, string constants, dialog boxes, ...) and the algorithmic >>part. Both do not need a recompilation for changing the user interface. > Real Questions: > Can you change the resources "in-place" in the file, change their sizes, >attributes and possibly add resources, or delete them, with out re-linking?? Yes and no. The resource compiler has in fact two different functions. Function one is the compilation of a resources script into a binary resource. Function two is adding such a binary resource to a completely linked program. This second function can be applied more so once, so I can do it. But I would not call this "changing resources in-place". There is a commercial resource editor which claims to be able to extract and edit resources. So far I have used the Microsoft Windows SDK (System Development Kit) of version 2 and documented interfaces only, so I can't tell you anything about it. There is no documented interface for changing resources in Windows 2 as far as I know, and all this applies to programs only, anyway. > As I understand Window's resource concept it's a nice way to separate >data from the code, but it's not a resource management system that allows you >to change, modify, delete, and resize existing resources "in-place" in the >file without re-building the file through some linking process. Yes, but see above. And as far as programs a concerned, this is more the problem of some missing documentation and/or tools. And I normally dont want to change my program on the fly. > Can programs add, delete, change, resize resources at run time to any file?? >And if they can is there OS support for this operation, or do you have to >implement the routines yourself?? Don't make the fault of just looking for exact duplicates of Macintosh functionality in MS Windows. Windows is built on top of an simple operating system which has a file system which knows nothing about resources. Programs got a new load module format with Windows, so a place for resources could be added there. But this is for constant data, only. For variable information there is a documented interface to manipulate named tables of keyword=value pairs. It is heavily used to store all kinds of configuration information. > Can you "search" for a particular type of resource, providing a simple form >of dynamic linking I can place resources (common or custom ones) into a dynamic link library, get a handle for it with LoadLibrary, use FindResource to search for a specific resource by name or number and type, get a handle on that with LoadResource, and finally load it by using LockResource. > Now on to Mac related topics of resources: > In addition when you recall a resource on the Macintosh it "searches" all >open resource files to attempt to find the resource. This allows Apple to >put standard dialogs and such in the system file, which is always open, and >they can be used by programs, and OS routines. But if a programmer places >a resource of the idential type/id in his application it will override the >system based resource and use the one it finds in the Application, and if you >do it right you can even subsitute your own data {dialog, icon, bitmap, etc.} >and still use the OS routine that uses it. There by reusing the OS code, but >changing the interface by the simple addition of a resource to your Application. This sounds indeed nice. A few questions: what is the search order in the above resource search, i.e. what if there is more than one program running and both have open resources files? In order to have an OS routine use my own resource, I have to know some details about the internals of this routine. Is all this officially documented? > From talking to a friend of mine who's a competent programmer in both >enviroments he seems to feel that MS Windows resource management is a step >forward for the separation of Data and Code, but it's not as dynamic and the >Mac's resource manager and lacks some of it's functionality. But I'm willing >to listen to arguments about how MS Windows is just as functional... I would never claim that MS Windows is as functional as the Mac in the resource area. It cannot, because it has to live with an old file system. What I claim is that a) there are areas where MS Windows is more functional and b) there has been some misinformation here in this group about Windows, recently. I do not have strong opinions about what system is better, I like both, and I think that some kind of misinformation is bad for both systems, in the long run. Wolfgang Strobl #include