N
Neelima Godugu
Hi All,
I am trying to extend the menu's in PocketOutlook Calendar by using
CePimCommand funtion.
So far i have gotten to the point where I have been able to Launch my CF exe
when the Menu options are tapped.
The only problem I have is when my CF EXE is already running. In this case,
the App just comes into focus and the code that I included in the Main
method is not executed. Could anybody suggest a work around for this
problem.
Following is the CEPIMCOMMAND.DLL code
void CePimCommand(HWND hWnd,
PIMTYPE ptData,
UINT uDataCount,
HANDLE * rghData,
void * pReserved)
{
//Convert ceoid to string
CEOID hitem = ((CEOID)*rghData);
wchar_t strCEOID[40];
_itow(hitem,strCEOID,10);
//Modify TEXT(...) Appropriately
LPTSTR commandType = TEXT("TSKUPDTSK ");
wchar_t commandParams[100];
_tcscat(commandParams,commandType);
_tcscat(commandParams,strCEOID);
//Launch Dovarri
CreateProcess(TEXT("\\My
documents\\Dovarri\\dovarri.exe"),commandParams,NULL,
NULL,false,NULL,NULL,NULL,NULL,NULL);
}
//FOLLOWING IS THE CODE IN MY MAIN method
static void Main(string [] args)
{
gArgs =args;
if(gArgs.Length > 0 && gArgs.Length == 2 )
{
//Invoked from Pocket Outlook
string menuOption = gArgs[0];
string oid = gArgs[1];
OutlookApplication app = new OutlookApplication();
switch(menuOption)
{
case "CALADDAPPT":
//Show a Dialog with an option to select the account
MessageBox.Show("Show Account List. Then Show Add Activity to that
Account");
break;
case "CALUPDAPPT":
//Retrieve
MessageBox.Show("UPD if already present otherwise Add Activity as
Personal");
Appointment appt
=(Appointment)app.GetItemFromOid(Int32.Parse(oid),ItemType.Appointment);
//Check if the appt is present in DB
if(LookUPItem(ItemType.Appointment,Int32.Parse(oid)))
{
//If found open the item in edit mode
}
else
{
//If not found add the item as personal item and open in edit mode
}
break;
case "CONADDCON":
//Show a Dialog with an option to select the account
MessageBox.Show("Show Account List. Then Show Add Contact to that Account");
break;
case "CONUPDCON":
//Retrieve
MessageBox.Show("UPD if already present otherwise Add Contact as Personal");
Contact con
=(Contact)app.GetItemFromOid(Int32.Parse(oid),ItemType.Contact );
//Check if the contact is present in DB
if(LookUPItem(ItemType.Contact ,Int32.Parse(oid)))
{
//If found open the item in edit mode
}
else
{
//If not found add the item as personal item and open in edit mode
}
break;
case "TSKADDTSK":
//Show a Dialog with an option to select the account
MessageBox.Show("Show Account List. Then Show Add Task to that Account");
break;
case "TSKUPDTSK":
//Retrieve
MessageBox.Show("UPD if already present otherwise Add Task as Personal");
Task tsk =(Task)app.GetItemFromOid(Int32.Parse(oid),ItemType.Task);
//Check if the appt is present in DB
if(LookUPItem(ItemType.Task,Int32.Parse(oid)))
{
//If found open the item in edit mode
}
else
{
//If not found add the item as personal item and open in edit mode
}
break;
}
}
Application.Run(new Form1());
}
TIA
Neelima
I am trying to extend the menu's in PocketOutlook Calendar by using
CePimCommand funtion.
So far i have gotten to the point where I have been able to Launch my CF exe
when the Menu options are tapped.
The only problem I have is when my CF EXE is already running. In this case,
the App just comes into focus and the code that I included in the Main
method is not executed. Could anybody suggest a work around for this
problem.
Following is the CEPIMCOMMAND.DLL code
void CePimCommand(HWND hWnd,
PIMTYPE ptData,
UINT uDataCount,
HANDLE * rghData,
void * pReserved)
{
//Convert ceoid to string
CEOID hitem = ((CEOID)*rghData);
wchar_t strCEOID[40];
_itow(hitem,strCEOID,10);
//Modify TEXT(...) Appropriately
LPTSTR commandType = TEXT("TSKUPDTSK ");
wchar_t commandParams[100];
_tcscat(commandParams,commandType);
_tcscat(commandParams,strCEOID);
//Launch Dovarri
CreateProcess(TEXT("\\My
documents\\Dovarri\\dovarri.exe"),commandParams,NULL,
NULL,false,NULL,NULL,NULL,NULL,NULL);
}
//FOLLOWING IS THE CODE IN MY MAIN method
static void Main(string [] args)
{
gArgs =args;
if(gArgs.Length > 0 && gArgs.Length == 2 )
{
//Invoked from Pocket Outlook
string menuOption = gArgs[0];
string oid = gArgs[1];
OutlookApplication app = new OutlookApplication();
switch(menuOption)
{
case "CALADDAPPT":
//Show a Dialog with an option to select the account
MessageBox.Show("Show Account List. Then Show Add Activity to that
Account");
break;
case "CALUPDAPPT":
//Retrieve
MessageBox.Show("UPD if already present otherwise Add Activity as
Personal");
Appointment appt
=(Appointment)app.GetItemFromOid(Int32.Parse(oid),ItemType.Appointment);
//Check if the appt is present in DB
if(LookUPItem(ItemType.Appointment,Int32.Parse(oid)))
{
//If found open the item in edit mode
}
else
{
//If not found add the item as personal item and open in edit mode
}
break;
case "CONADDCON":
//Show a Dialog with an option to select the account
MessageBox.Show("Show Account List. Then Show Add Contact to that Account");
break;
case "CONUPDCON":
//Retrieve
MessageBox.Show("UPD if already present otherwise Add Contact as Personal");
Contact con
=(Contact)app.GetItemFromOid(Int32.Parse(oid),ItemType.Contact );
//Check if the contact is present in DB
if(LookUPItem(ItemType.Contact ,Int32.Parse(oid)))
{
//If found open the item in edit mode
}
else
{
//If not found add the item as personal item and open in edit mode
}
break;
case "TSKADDTSK":
//Show a Dialog with an option to select the account
MessageBox.Show("Show Account List. Then Show Add Task to that Account");
break;
case "TSKUPDTSK":
//Retrieve
MessageBox.Show("UPD if already present otherwise Add Task as Personal");
Task tsk =(Task)app.GetItemFromOid(Int32.Parse(oid),ItemType.Task);
//Check if the appt is present in DB
if(LookUPItem(ItemType.Task,Int32.Parse(oid)))
{
//If found open the item in edit mode
}
else
{
//If not found add the item as personal item and open in edit mode
}
break;
}
}
Application.Run(new Form1());
}
TIA
Neelima