|
I use the following lines of code in my program to get focus to a particular object and select it:
hr = (SELFLAG_TAKEFOCUS,varTemp);
hr = pTempAcc->accLocation(&left,&top,&width,&height,varTemp);
The trouble is that after the my program has been running for a while ( as such there is no specific limit or minimum), the execution just hangs at pTempAcc->accSelect() and the only way to stop it is a forced exit.
Can anyone tell me why this might happen.
|
|
|
|
|
There appears to be some code missing from the 1st line you posted.
Looking at the MSDN page for IAccessible::accSelect Method[^] we can see an example given as:
HRESULT SelectItemAtPoint(POINT point)
{
VARIANT varItem;
IAccessible* pAcc;
HRESULT hr = AccessibleObjectFromPoint(point, &pAcc, &varItem);
if ((hr == S_OK))
{
hr = pAcc->accSelect((SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION), varItem);
VariantClear(&varItem);
pAcc->Release();
}
return hr;
}
Which immediately causes me to wonder if perhaps you haven't done the clean-up for your equivalents of varItem and pAcc in the above block
|
|
|
|
|
The same problem occurs even when i give both the flags as follows:
hr = pAcc->accSelect((SELFLAG_TAKEFOCUS | SELFLAG_TAKESELECTION), varItem);
|
|
|
|
|
Do you perform the clean-up as shown in the example in my last post?
|
|
|
|
|
Clean up does not help either.
|
|
|
|
|
Hi!
I was trying to create a snake program in c++ (i'm using devC++ environment). I had already initialized the snake. But I have no idea as to how to move the snake. I'm using the graphics.h header from borland...
I was wondering if you could help me out on the snake movement algorithm??? thanks!
|
|
|
|
|
Sure can,
In pseudo-code:
Snake.Position += Snake.Velocity;
You may wish to represent both the position and the velocity as a 2d vector.
e.g
typedef vec2_t{
int x;
int y;
} vec2;
vec2 snakePosition;
vec2 snakeVelocity;
snakePosition.x += snakeVelocity.x;
snakePosition.y += snakeVelocity.y;
How you set snakeVelocity is up to you and the game you're creating. If this is the typical game of snake, as found on mobile phones etc, you simply need to respond to key-presses.
pseudo-code:
switch(pressedKey)
{
case leftArrow:
snakeVelocity = (vec2){-1,0};
break;
case rightArrow:
snakeVelocity = (vec2){1,0};
break;
case upArrow:
snakeVelocity = (vec2){0,-1};
break;
case downArrow:
snaeVelocity = (vec2){0,1};
break;
}
|
|
|
|
|
WOW!thanks a bunch! I'll try this one out...it seems do-able at my level... lol...
|
|
|
|
|
Pleasure.
Be mindful of the fact that this will keep track of the position and velocity of the head of the snake only. In order to keep track of the body segments, you'll need to maintain an array (or list) of the coordinates of each of the body segments.
I'd suggest you deal with that bit later, after you have position and movement nutted out.
|
|
|
|
|
hiooooooooooooooooooooooo
|
|
|
|
|
|
|
|
|
|
Hello Guys,
Anyone knows how to create an Out-process ActiveX Control ?
I'm trying to use 'CreateControlLicEx' function to create the control from my WIN32 application but it only works for In-process ActiveX.
thanks
Mithrill
|
|
|
|
|
Freeing the memory using delete operator for a class object created using new operator gives exception.
The class is
class CSnp : public CObject
{
public:
CSnp();
~CSnp();
char liststr[50];
char sSnpDesc[50];
CTime tDateTime;
int iDCSSerialKey;
};
Is there anything wrong in the class?
|
|
|
|
|
class looks fine. make sure you haven't written past the ends of either of those arrays, though.
|
|
|
|
|
I don't know, you didn't provide the class implementation code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
This might happen if you continue to use the pointer after using delete. After delete, set the pointer to 0, to make it easier to catch this.
|
|
|
|
|
Any reason you are using char arrays instead of something like CString?
|
|
|
|
|
Because that is a right (warranted by the constitution) of the native developer?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
God forbid I infringe upon anyone's rights
However,
char sSnpDesc[50]; sounds like some sort of description, and I've seen descriptions longer than 50 chars.
|
|
|
|
|
It looks just "A snapshot in the family album". I don't know if Daddy had more than 50 characters.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In World of Warcraft the maximum number of characters you can create over all servers is 50, so this definition looks perfectly valid to me!
|
|
|
|