View Single Post

  #2 (permalink)  
Old 08-08-2007
jonp54 jonp54 is offline
Junior Member
White Belt
 
Join Date: Jul 2007
Posts: 8
Re: Automating MapPoint in C++ With Built In GPS Features Enabled

If any one is also having issues with with the boolean functions that determine if a button was pressed, i found a more reliable method than what Paul was suggesting. Here is my IsTracking function. You have to include Oleacc.lib to your project or dynamically link the dll. I would recommend including it in your project.

int MapPt::IsTracking()
{
logFile<<"IsTracking()\n";
IAccessible * acc=NULL;

VARIANT idxIn;
VariantInit(&idxIn);
V_VT(&idxIn) = VT_I4;
V_I4(&idxIn) = CHILDID_SELF;

VARIANT idxOut;
VariantInit(&idxOut);
V_VT(&idxOut) = VT_I4;




// Obtain the IAccessible object from the parent window
HRESULT hr = AccessibleObjectFromWindow(m_hwBtnStartGPSTracking ,OBJID_CLIENT,IID_IAccessible,(LPVOID*)&acc);
if(SUCCEEDED(hr))
{
acc->get_accState(idxIn,&idxOut);
return V_I4(&idxOut);
}
else
return -1;

}

If you look in "Oleacc.h" you can see what the different values get_accState returns. There are probably 20 different states the button can be in. Search for SYSTEM_STATE_UNCHECKED in Oleacc.h and it will bring you to all the definitions.
Reply With Quote