C++ CALL CRange's get_shapeRange() triggers an exception
-
I construct a CRange object and then call CRange's function get_shapeRange() to get a CShapeRange object. but it triggers an exception. (but it's OK to call another function get_InlineShapes) I have no idea why it triggers an exception. does anyone knows why? thanks. ======================================================== By the way, I call this code in a keyboard hook function.
-
I construct a CRange object and then call CRange's function get_shapeRange() to get a CShapeRange object. but it triggers an exception. (but it's OK to call another function get_InlineShapes) I have no idea why it triggers an exception. does anyone knows why? thanks. ======================================================== By the way, I call this code in a keyboard hook function.
A question first : Are you using COM Interop? When an exception is triggered, it is indicative that the function cannot be found.
You talk about Being HUMAN. I have it in my name AnsHUMAN
-
I construct a CRange object and then call CRange's function get_shapeRange() to get a CShapeRange object. but it triggers an exception. (but it's OK to call another function get_InlineShapes) I have no idea why it triggers an exception. does anyone knows why? thanks. ======================================================== By the way, I call this code in a keyboard hook function.
BianChengNan wrote:
does anyone knows why?
There is probably a bug in your code. You need to provide a snippet of the code and full details of the exception if you want a better suggestion.
One of these days I'm going to think of a really clever signature.
-
BianChengNan wrote:
does anyone knows why?
There is probably a bug in your code. You need to provide a snippet of the code and full details of the exception if you want a better suggestion.
One of these days I'm going to think of a really clever signature.
thanks for your tip. code looks like following.
bool isRangeShape(__in CRange& oRange)
{
// I promise oRange is correct, because I can call
// like this oRange.get_InlineShapes()AFX\_MANAGE\_STATE(AfxGetStaticModuleState()); // in word2010 it's ok,but in word2003 triggers an exception // but corresponding VBA code works fun in word2003 **(not fun, I'm sorry)** // word2003 don't support this method, oh my god!!! CShapeRange oShpRange = oRange.get\_ShapeRange(); long lCount = oShpRange.get\_Count(); if (lCount > 0) { return true; } return false;
}
-
A question first : Are you using COM Interop? When an exception is triggered, it is indicative that the function cannot be found.
You talk about Being HUMAN. I have it in my name AnsHUMAN
Yes, you are right. but what I can't understand is in VBA corresponding code works fun. VBA code below: selection.range.shaperange works fun ================================================================================= I'm sorry! in word2010 it works fun. in word2003 not fun. oh, my god!!!
-
Yes, you are right. but what I can't understand is in VBA corresponding code works fun. VBA code below: selection.range.shaperange works fun ================================================================================= I'm sorry! in word2010 it works fun. in word2003 not fun. oh, my god!!!
-
thanks for your tip. code looks like following.
bool isRangeShape(__in CRange& oRange)
{
// I promise oRange is correct, because I can call
// like this oRange.get_InlineShapes()AFX\_MANAGE\_STATE(AfxGetStaticModuleState()); // in word2010 it's ok,but in word2003 triggers an exception // but corresponding VBA code works fun in word2003 **(not fun, I'm sorry)** // word2003 don't support this method, oh my god!!! CShapeRange oShpRange = oRange.get\_ShapeRange(); long lCount = oShpRange.get\_Count(); if (lCount > 0) { return true; } return false;
}