Feedback Search Top Backward Forward
EDM/2

Questions and Answers

Written by Larry Salomon, Jr.

 

Question

Unfortunately, I saved the following questions while replying to the sender's mail. Since the Elm mail utility doesn't put the header information into the temporary file used to compose the mail, I do not have the address of this person, nor the name.

Nonetheless, he (I remember the gender at least!) writes:

I have three questions that are really starting to drive me crazy, so hopefully they are driving other people crazy and would make good inclusions into the next EDM/2.

1) I've seen programs that have their icon bound into the .EXE somehow rather than in [extended attributes]. The WPS has no problem finding the icon in this programs and displaying it from a program object or from the drives object. How is this done? I even have source for programs that do this, and I still can't figure out what they are doing that I'm not!

2) I've designed a nice dialog box with IBM's Dialog Editor. In it I have some static text fields with their font's and colors changed to make them look nice (e.g. I have the title of the program in 18.Tms Rmn). Unfortunately, I've found that dragging a scheme from the scheme palette onto my dialog causes all of the fonts to revert to System Proportional! :-( From what I can tell, PM does not send any message before it kills everything, only after (WM_PRESPARAMSCHANGED). How can I keep things from being changed? The behavior that I would like to see would be for the drag-n-drop operation to be denied (I don't know the actually terminology, but you get that "circle with a bar in it" icon).

3) This is the most frustrating one. I've been through the PM Reference so many times I can hardly see, and I still haven't figured out how to load a font resource. I have all of my resources bound into my .EXE, but GpiLoadFonts() requires the name of a .FON file. The font is one that I have created in IBM's Font Editor, and I've included in in my resource file like so:

FONT ID_MAIN "c:\\project\\myproject\\myfont.fnt"

Thanks for any help you can give me. You have full permission to do absolutely anything with these questions you want, including print them in EDM/2 :-)

Answer

1) The first icon resource found is used, I believe.

2) All three palettes work in this way: when they receive the WM_BEGINDRAG message, they capture the mouse ; when the WM_ENDDRAG message is received, they call WinWindowFromPoint() to get the handle of the window under the mouse; finally, they call WinSetPresParam() to change the appropriate attributes. Thus, they aren't using direct manipulation, so you can't stop it from happening.

3) Fonts can only be loaded from .FON files, which are nothing more than DLL's with a different extension. The easiest way to create this is to write a short C program which contains a static function dummy(). This function is defined as such:


VOID dummy(VOID)
{
}
This will compile and link, creating a .DLL that you can bind your font to. Rename the file to .FON and you're finished.