I'm writing a find routine.  I'm working on a retail application and it has
ways to find records using obvious things like the sku and the UPC code
within the application. I want the find routine to find a text string that
is imbedded within a 60 character discription - so I have to write my own
little search routine.  I can't find the exact wording that explains it in
the documents but it looks like the text in strToFind is compressed and I
have to pass it to TxtGluePrepFindString to turn it into an ASCII string
that I can work with.  I tried various ways of passing the variables to
TxtGluePrepFindString and they all make my program abort.  Maybe someone can
tell me if I am correct about needing TxtGluePrepFindString and what I'm
doing wrong in passing variables to it.

Here is my latest attempt:

Down below is where my search routine gets called.

static DWord StarterPilotMain(Word cmd, Ptr cmdPBP, Word launchFlags)
{
        Err error;

        error = RomVersionCompatible (ourMinVersion, launchFlags);
        if (error) return (error);


        switch (cmd)
                {
                case sysAppLaunchCmdNormalLaunch:
                        error = AppStart();
                        if (error)
                                return error;
                        WinEraseWindow();
                        FrmGotoForm(MainForm);
                        AppEventLoop();
                        AppStop();
                        break;
--->>           case sysAppLaunchCmdFind:
                        Search ((FindParamsType *) cmdPBP);
                        break;



These are the interesting parts of my search routine:

void Search (FindParamsPtr sparams){
        char findstring[20];

        recordnumber = sparams->recordNum & 0x0fffffff;
        dbinprocess = sparams->recordNum & 0xf0000000;
//      the two lines above seem to do what I want.
        TxtGluePrepFindString(sparams->strToFind, findstring, sizeof(findstring) -
1);

It blows up on the above call.




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to