Thanks a bunch Michal.
That really helped me a loot to understand a lil bit.

One more favor please. 
Can you check if this code works.. I tried in the simulator and I don't see 
anything happening. I don't have a device as of now to make a make file and 
test it. I know its a kind of dumb question but as a starter I am not sure if 
the code works.


#include <PalmOS.h>
#include <stdlib.h>
#include <stdio.h>
#include "AppResources.h"

#define appFileCreator                  'wxyz'  // register your own at 
http://www.palmos.com/dev/creatorid/
#define appVersionNum                   0x01
#define appPrefID                               0x00
#define appPrefVersionNum               0x01
#define hsFileCBlazer3 'BLZ5'


static void AppStop(void)
{
        // Close all the open forms.
        FrmCloseAllForms();
}

static void LaunchBlazerWithURL(Char* urlP)
//static void LaunchBlazerWithURL()
{
        
        Err err = 0;
        UInt16 cardNo;
        LocalID dbID;
        DmSearchStateType searchState;
        Char* url;
        
        // first check if web browser is installed
        err = DmGetNextDatabaseByTypeCreator(true, &searchState,
        sysFileTApplication,hsFileCBlazer3, true, &cardNo, &dbID);
        if (err)
        {
                // Display appropriate error dialog...          
                return;
        }
        // ok, now let's call the web browser with the URL. Must first copy the
        // URL because it will be disposed of by the system after the browser
        // exits
        //url = MemPtrNew(StrLen("http://www.yahoo.com";)+1);
        url = MemPtrNew(StrLen(urlP)+1);
        if (!url)
        {       
                AppStop();      
                return;
        }
        //StrCopy(url, "http://www.yahoo.com";);
        StrCopy(url, urlP);
        // set the memory owner to zero, so it is not deleted
        // by the system when we switch apps    
        MemPtrSetOwner(url, 0);
        SysUIAppSwitch(cardNo, dbID, sysAppLaunchCmdGoToURL, url);
}




/***********************************************************************
 *
 * FUNCTION:    PilotMain
 *
 * DESCRIPTION: This is the main entry point for the application.
 *
 * PARAMETERS:  cmd - word value specifying the launch code. 
 *              cmdPB - pointer to a structure that is associated with the 
launch code. 
 *              launchFlags -  word value providing extra information about the 
launch.
 * RETURNED:    Result of launch
 *
 * REVISION HISTORY: 
 *
 *
 ***********************************************************************/
UInt32 PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
        Err error = errNone;

        switch (cmd) {
                case sysAppLaunchCmdNormalLaunch:                       
                        LaunchBlazerWithURL("http://www.yahoo.com";);

                        break;

                default:
                        break;
        }
        
        return error;
}






-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to