Koukam na ten kod (DOS 6) a bude tezke prestat cist ty dobove komentare... nevim zda i jini maji podobne archeologicke uchylky - ale stoji to za to. Vypada to celkem dobre dokumentovany.
Sem tam se najde perla typu - kvuli ramecku ohackujeme aplikaci i kdyz sama nechce a dokreslime ho tam! To je panecku dedikace pro UX :-)
/* * UPDATE * The latest CW build has pfnFilter be a far procedure, so this * is no longer necessary. . . * WARNING WARNING!!! * THIS IS AN EVIL DEATH NIGHTMARE HACK FROM HELL! * * The following code exists soley to draw black borders around menus * when in graphics mode. * * The problem is that we need to draw the border after CW draws the * menu so it won't get erased (or saved by savegraphic arc) * * This is not so easy, as CW doesn't want to give us control at this * time if the mouse button is down (ie we don't get any messages) * * So here is what we do, in our infinite slimyness: * When we get the WM_INITMENUPOPUP message indicating that a menu * is about to pop up, we save off info about which menu it is, and * save and modify one of CW's internal variables. This variable is * a function pointer to a menu-filter routine; what we want to do * is "hook" it so that we get called whenever it gets called so we * can get control to draw the menu border. Two things should be noted * here: one is that at the time we get the WM_INITMENUPOPUP message * we are actually inside the routine we want to hook; and the other is * that the routine is a near function inside the CW_USER segment. * It's ok that we are inside the routine since we are just changing * a function pointer which will be called again. To put our hook routine * inside the CW_USER segment (so it can be near), we use the alloc_text * pragma. * All out hook routine (MyMenuFilterProc) does is perhaps outline the * menu */
S tímhle naprosto souhlasím.
Je mi na blití z lidí kteří vnímají open source [dle opensource.org] a free software [dle fsf.org] jako jen možnost mít něco zdarma, místo mít možnost něčeho co si uplácají sami a mohou to sdílet, aniž by kradli práci někoho jiného, kdo si to nepřál na základě licence s kterou to uvolnil.
Neni to jediny hook kvuli CW, ktery je pry Character Windows ... taky to neznam, mozna nejaka nadstavba s mysi. Tento comment se tyka toho, kdyz ten DOS asi jede v nejake graficke emulaci (matne si vzpominam, ze DOS neco takoveho umel, pro high-res hardware), tak se do nej dokresli ramecek (stin), aby to vypadalo hezceji.
Je to opravdu neco, co by mel OS delat? Z pozice marketingoveho - koukejte, nas OS vypada lepe nez jine, ale z pohledu programatora - proc si OS dovoluje krast exekuci jednoho konkretniho programu (nebo knihovny)? A pak se nemuzeme divit, ze z nevinneho vylepseni vznikaji zamerne bugy, ktere musi byt portovany skrze desetileti vyvoje.. a tvurci - snad na obou frontach - jsou v pekelne pasti.
25. 9. 2020, 13:40 editováno autorem komentáře