A89: installing C Event Hooks + misc other...


[Prev][Next][Index][Thread]

A89: installing C Event Hooks + misc other...




Hi guys!

I've got a small program here that i have been running as a resident prog on
my calc that hooks into the events.... I've been banging my head against the
wall trying to find a way to make an installer/deinstaller for it! The hook
function itself calls several other functions making it a little tougher. I
can't do it like a regular tsr because of course the event hook function
takes parameters! HELP!

Now on to the misc other...
How does one include special characters in an array?
say i have an array like this

char * El[]={
"Element0",
"Element1",
"Elementx"
};

1. if I wanted to include say a left arrow character (conversion arrow) in
an element how would i do that?
Example: "Elem->ent1"  where -> stands for the conversion arrow of course...


2. My event hook needs only to watch for keypresses when the calc is on the
home screen... I can prevent it from processing the key presses on nearly
every thing except for when the Catalog is displayed, how would i fix this?
Right now my code looks like this:

   if((FirstWindow->TaskId==EV_getAppID("TIHOME")) &&
((FirstWindow->Flags&WF_ACTIVE)==WF_ACTIVE))
{then do stuff here because the home screen is active}

That code checks to see if the FirstWindow's TaskId is that of the Home
Screen app and it checks to see if the WF_ACTIVE flag is set...

although I've tried many many other forms, this seems to work the best...
when it comes right down to it, I only need to process CM_KEYPRESS events
when the user is in the *home screen* text editor... I do have code that
finds the TEXT_EDIT structure for the home screen which contains a pointer
to the "parent" window...
Just so I don't confuse anyone, the Home Screen Text Editor is that little
bar on the bottom where you type calculations; not the normal text editor...

oh yea, one more thing
would someone explain why this function gives a warning when compiled

//isLike(StrToTestForMatch,StrToMatch)
//all characters in s1 must = len(s1) chars in string s2
//returns strlen(s2) or 0 (NULL) if no match

unsigned long isLike(const char* s1, const char* s2)
{
 unsigned long x=0;

 while(s1[x]==s2[x])
  x++;

 return x==strlen(s2)?x:0;        //the warning comes from the strlen
function:
                                                    //discards qualifiers
from pointer target type
                                                    // which would be s2...
}

any optimizations for speed would be welcome as well This function needs to
be fast...

and that's my monthly brain scandisk/defrag...
Thanks,

Greg
_________________________________
All parts should go together without forcing. You must remember that the
parts you are reassembling were disassembled by you. Therefore, if you can't
get them together again, there must be a reason. By all means, do not use a
hammer.
-- IBM maintenance manual, 1925



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Follow-Ups: