|
<br />
class __declspec(novtable) CIOMessageMap<br />
{<br />
public:<br />
virtual bool ProcessIOMessage(IOType clientIO, ClientContext* pContext, DWORD dwSize) = 0;<br />
};<br />
<br />
#define BEGIN_IO_MSG_MAP() \<br />
public: \<br />
bool ProcessIOMessage(IOType clientIO, ClientContext* pContext, DWORD dwSize = 0) \<br />
{ \<br />
bool bRet = false; <br />
<br />
#define IO_MESSAGE_HANDLER(msg, func) \<br />
if (msg == clientIO) \<br />
bRet = func(pContext, dwSize); <br />
<br />
#define END_IO_MSG_MAP() \<br />
return bRet; \<br />
}<br />
Why class CIOMessageMap should be declared by declspec(novtable)?
The macros implements the member function of CIOMessageMap --ProcessIOMessage();But in other places of project,there no any inheritances of CIOMessageMap.
Who can tell me the advantages about this coding style?
There are will best in detail.;)
|
|
|
|
|
ProcessIOMessage() is defined as virtual , so the compiler wants to add a vtable for the class. But, because it's an abstract class (due to the = 0 ) it cannot be instantiated and doesn't need the overhead of the vtable. __declspec(novtable) instructs the compiler to not generate a vtable.
A more detailed explanation can be found here[^].
Cyril Connolly wrote: Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
|
|
|
|
|
Hi all,
I was able to set particular cell's content by CRange::put_Item() from MFC typelib class, but how can I set cell's background color and put comment into it? I've googled it but got no result so far.
Thanks,
|
|
|
|
|
To set the background color, look for an Interior property of the Range object, Interior has a Color property that specifies the color of the background, the Range can span cells.
To add a comment, use the AddComment method of the Range object.
|
|
|
|
|
Thanks, Roger!
But how can I reference the color property?
range.get_Interior();
and when "range.AddComment(COleVariant("1234"));" was reached an exception happened.
|
|
|
|
|
I am not using the same environment as you I am looking at the VBA for Excel and porting it into VC++6 wherein I get the Interior property which is an IDispatch and which has a Color property which I can set
Same with AddComment all I did was look in the MSDN documentation for the VBA Model of Excel and it told me Range had an AddComment method I have never actually used it, and even if I had it would be in VC++6 which doesnt use a CRange class.
|
|
|
|
|
Inside <<inside c++="" object="" models="">>, it wrote
"It is stll a bad design choice to declare all functions virutal and to depend on the compiler to optimize away unnecessary virtual invocations."
I can't understand it very well.
class Abstract_base {
public:
virtual ~Abstract_base()=0;
virtual void interface1() const = 0;
virtual const char*
mumble() const {return _mumble;)
protected:
char *_mumble;
};
As the source above.
"virtual const char* mumble() const {return _mumble;)"
If you define a member function to be virtual, you insert a vptr in your class object.
but as the function's defination has been claimed within the head file, it must be looked as an linline function. Is it right?
Tomorrow is another day!
|
|
|
|
|
I think what the author meant was that the compiler does not generate a vtable entry that is never needed. If you declare a function as virtual in a base class, and that function is always called in the scope of a known class, the compiler might as well skip the vtable entry for that function. Or if you declare a virtual fuction in a class with no sub- or superclasses, there's no point in using a vtable at all.
As for the inline declaration of a function, it only tells the compiler that you would prefer to have the code generated inline. If the function is virtual, you will still get a pointer in the vtable to that function (unless optimized away by the compiler).
Might add that I'm not an expert on the inner logic of an actual compiler, so the case may be a bit more complicated than this
-- modified at 12:33 Thursday 25th October, 2007
|
|
|
|
|
Hello,
I have read an excel sheet using IDispatch.But I cannot read a particular sheet with a particular name.Also how to find the number of sheets in an excel file.
If I use CRecordset to open an excel file then how do I find the sheet name from excel file or I will I have to provide the sheet name like we provide a table name for the CRecordset object.
Any Ideas
Prithaa
|
|
|
|
|
So you have an IDispatch of a worksheet. Call GetApplication on the worksheet it will return an IDispatch of the Application. Call GetWorksheets on the application it will return an IDispatch of the worksheets collection. Call GetCount on the worksheets collection.
Or in VBA terms. A Worksheet has an Application property. An Application has a Worksheets property. The Sheets collection has a Count property. Sheets also has an Item property that takes a parameter of either the index or name of a sheet.
|
|
|
|
|
Hello,
Can I get the name of the sheet from any method of a Worksheet ?
Can I use CRecordset to open a sheet from excel file whose name(sheet's name) is not known.
Thanks for your help.
Prithaa
|
|
|
|
|
The most recent MSDN I have is Jan2002
wherein you drill down as follows
Office Solutions development
Microsoft Office
Microsoft Office Xp
VBA Language Reference
Microsoft Excel Visual Basic Reference
Objects
W
Worksheet Object
Name Property
no I dont think you can CRecordset a sheet whose name is not known (but I could be wrong)
|
|
|
|
|
I'm having a windows forms application project. On the form there's a datagridview with data of a table out of the datasources. The connectionstring in the datasource is made by the add new datasource wizard and is : Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\Tabel-XML.mdb
Changing it in the _Tabel_XMLDataset.h file doesn't do anything and changes after a new build.
Now I'd like to know if it's possible to change my data source, so make it variable. I saw something about the use of app.config but how do i have to do this then so that the data source of my datagridview is changed without rebuilding my project it each time after creating a new databaseconnection. I'd like to define the databaseconnection in an external file (like app.config) and then use this databaseconnection for my project. How is this done?
Thanks for helping me out
-- modified at 10:26 Friday 26th October, 2007
|
|
|
|
|
I want to draw some characters with underline, strikeout or overline, I've known how to get the first two, but how to do with the overline, please?
I'm using VC++ 2005, GDI+.
thanks~
Thanks all!
|
|
|
|
|
When you make your font with CreateFont you can set these parameters for it.
|
|
|
|
|
BOOL CreateFont(
int nHeight,
int nWidth,
int nEscapement,
int nOrientation,
int nWeight,
BYTE bItalic,
BYTE bUnderline,
BYTE cStrikeOut,
BYTE nCharSet,
BYTE nOutPrecision,
BYTE nClipPrecision,
BYTE nQuality,
BYTE nPitchAndFamily,
LPCTSTR lpszFacename
);
you mean this?
sorry, I don't see how to set over-line here, any suggestions?
thanks a lot~
|
|
|
|
|
Hello friends I am creating the application that provides the multiple desktop. I am using CreateDesktop and SwitchDesktop API for that. And also getting new Desktop throught that, But has several problem with new Desktop.
I search a lot for that but not getting enought help.The problem are as follows.
1) Windows shortcut ( Hotkeys ) are not working in new Desktop.
i.e. If I press the WIN + R to open the RUN Window it don't open in the new window, But open in the Default window.
2) Not able to open the TASK MANAGER in New Desktop. It also opens in the Default desktop.
3) As I am creating the new instance of Explorer before switching to new desktop. Not gettting current Tray Icons From defult Desktop to new Desktop.
Is there any way I can Solve the problems. Are any Hint on how I can solve it.
Thnx in advance.....
|
|
|
|
|
How to parse VBA script file in MFC ?
I want to extract following information from the VBA script file,
1. Number of modules in the script.
2. Name of all the modules.
3. All the function names in the given module.
Is there any scripting engine ?
Any help would be appreciated ?
Regards,
Paresh.
|
|
|
|
|
Look into LEX & YACC... It's been awhile since I used them, but they could help if nothing else does.
Though there must be a more modern alternative!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
Thanks for your reply.
Could you please give some reference to start with ?
Regards,
Paresh.
|
|
|
|
|
There's a HUGE documentation about bison and flex, Google is your best friend.
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.
|
|
|
|
|
|
Hello,
I am reading an excel file in VC++ where I have read the first sheet though IDispatch.But I cannot read the 2nd sheet and find the name of the sheet.
Any ideas
Prithaa
|
|
|
|
|
How are you reading an excel file ?
I think I have a similar problem, could you please help me for finding the solution ?
How to parse VBA script file in MFC ?
I want the following information from the VBA macro file,
1. Number of modules in the script.
2. Name of all the modules.
3. All the function names in the given modules.
Is there any scripting engine ?
Any help would be appreciated.
Thanks and Regards,
Paresh.
|
|
|
|
|
Hello,
I am not aware of VB.What I have done is just read an excel sheet which comprises of row and columns and put those values in my variables.
Do you want to know this?
Thanks
Prithaa
|
|
|
|