|
An application must contain the main function.
On the other hand, you may write a static library of functions (such libraries haven't the 'main block'), however that's a completely different thing...
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]
|
|
|
|
|
|
surekha.btech wrote: can we write a program without main block in c++
Certainly, you can write anything you like, but I doubt that it will be of any use. 
|
|
|
|
|
Answer is a word: No.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi
I'm getting the following error during compilation:
error C2440: '=' : cannot convert from 'void (__thiscall CCBEMFGUILayer::*)(const char *)' to 'void (__thiscall CCBEMFLayer::*)(const char *)'
on the line: pMFPostMessage = MFPostMessage; // see below
CCBEMFGUILayer::CCBEMFGUILayer()
{
sLayerSignature = "<SourceLayer Name=\"GUI\"";
pMFPostMessage = MFPostMessage;
}
CCBEMFGUILayer::~CCBEMFGUILayer()
{
}
string CCBEMFGUILayer::GetLayerSignature()
{
return sLayerSignature;
}
void CCBEMFGUILayer::MFPostMessage( const char *cGUIMessage )
{
string sRecvMessage;
sRecvMessage = (string)cGUIMessage;
return;
}
MFGUILayer inherits from MFLayer.
class CCBEMFLayer
{
public:
CCBEMFLayer();
virtual ~CCBEMFLayer();
virtual void MFPostMessage( const char * );
virtual string GetLayerSignature();
void (CCBEMFLayer::*pMFPostMessage)( const char * );
};
class CCBEMFGUILayer : public CCBEMFLayer
{
public:
CCBEMFGUILayer();
virtual ~CCBEMFGUILayer();
string GetLayerSignature();
void MFPostMessage( const char * );
protected:
string sLayerSignature;
};
MFGUILayer implements MFPostMessage and I want to store a pointer to this function so I can add it to a subscriber class and then call the appropriate function based on a message signature.
How do I cast this correctly (if at all)?
Any help or direction appreciated.
Jim
|
|
|
|
|
Why don't you use polymorphism for that?
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]
|
|
|
|
|
I thought I was doing that, however, turns out I was doing it in reverse - against the derived class - instead of the base class.
I've resolved the problem by declaring Base references and instantiating the derived class and casting where appropriate.
Thanks
|
|
|
|
|
how to mimic the operation of refurbishing desktop like the right-context-menu way?
in other words, you right-click on the desktop, there'll be the context menu which has the fresh button, you press fresh button to force refurbishing the desktop.
how can i mimic this operation through code.
|
|
|
|
|
|
what i want is to reach the same effect by some simple codes but without any gui codes.
|
|
|
|
|
It's not as simple as that. There's not a WM_REFRESH type of message that you can send to a window and have it refresh itself. Using Spy++, you can see what messages are sent to the desktop's list control and how it responds. In order to mimic this, I suspect a shell extension would be in order.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi All
Can i convert _variant_t to binary?Please give me advice.
|
|
|
|
|
Data is already in binary form, you know. What kind of conversion do you really need? Could you make an example?
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]
|
|
|
|
|
Thanks for reply
i am useing
ADODB::_RecordsetPtr rSet; to get values from MS Access through this code.When Ms Access datatype is adLongVarBinary.
(j is indext number)
_variant_t vtValue;
vtValue =rSet->Fields->GetItem(j)->Value;
Then i am geting values like this
vtValue laues like this.
safearray = safearray of UI1 = [27609](21 ' ',28 ' ',45 '-',0,2 ' ',0,0,0,10 '
',0,15 ' ',0,20 ' ',0,30 ' ',0,255 'ÿ',255 'ÿ',255 'ÿ',255 'ÿ',87 'W',111 'o',114 'r',107 'k',115 's',104 'h',101 'e',101 'e',116 't',0,69 'E',120 'x',99 'c',101 'e',108 'l',46 '.',83 'S',10...
So how can i get this values in redable formate.
|
|
|
|
|
What do you intend with 'readable format'? What's the array is supposed to contain?
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]
|
|
|
|
|
|
What is meant by converting _variant_t to binary?
|
|
|
|
|
Hi,
Please suggest me any sample which is using Subclassing of CEdit class...
|
|
|
|
|
Here[^] you have a lot.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi all,
How to prevent usage of global variables from other files.
thanks,
|
|
|
|
|
Check here[^]..
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
I think you can declare the global variables as static so that the access is restricted to specific translation units.
|
|
|
|
|
You should use the static storage class: from MSDN [^]
When modifying a variable or function at file scope, the static keyword specifies that the variable or function has internal linkage (its name is not visible from outside the file in which it is declared).
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]
|
|
|
|
|
As people have already correctly answered you, using a static specification does this just fine.
If you are interested ( for culture maybe? ) there is another approach you may encounter. That is to put the variable definition in an anonymous namespace ( also known as an unnamed namespace[^] ).
|
|
|
|
|
Using VS2008, I've created an MFC TypeLib class, CApplication from _Application Interface in Ms Word 12.0 Object Library <8.4>. As expected, the class works with my Word 2007, but doesn't with Excel, PowerPoint etc.
My question, is there a way for me to create a CApplication class that caters to all the Ms Office family? I'm not looking at automating application specific functions, only common function (e.g: Save, Exit)
|
|
|
|