|
dolphinhk wrote: Are there any limitation for an ActiveX Control in Web page similar to java applet ?
No, and if there was any information about that you would certainly not find it on the MSDN Web Site[^]
led mike
|
|
|
|
|
dolphinhk wrote: Are there any limitation for an ActiveX Control in Web page
Cross platform compatibility (lack of) comes immediately to mind...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
How to create an Application which have a singleton class which herit form 3 other interface class (so with pure virtual functions), without loosing reference to these interface functions ?
My problem is that I am lossing reference to vftable(__vfptr) between instances, so I cannot access to my interfaces in another instance of the application.
More about this problem :
1 - I launch "MyClass.exe start" => OK "MyClass.exe" is running ...
2 - I launch "MyClass.exe configure" => access violation is raised, because can't access to MyClass->Configure().
NB: this problem not occur if I make -2- then -1-
And although I call Configure() inside Start() it's working well.
My implementation code is :
<br />
#include "MyClass.h"<br />
#pragma data_seg("MyShared")<br />
MyClass* MyClass::m_instance = 0;
#pragma data_seg()<br />
#pragma comment(linker, "/section:MyShared,rws") <br />
<br />
int main(int argc, char *argv[])<br />
{<br />
MyClass* Me= MyClass::Instance();<br />
if(argc==2)<br />
{<br />
if(strcmp(argv[1],"start")==0)<br />
{<br />
MyClass->Start();
return 1;<br />
}<br />
<br />
if(strcmp(argv[1],"stop")==0)<br />
{<br />
C3STrace(C3S_TRACE_DEBUG, C3S_TRACE_INFO, "MAILNOTIFIER_STOP");<br />
MyClass->Stop();
return 2;<br />
}<br />
<br />
if(strcmp(argv[1],"configure")==0)<br />
{<br />
MyClass->Configure();
return 3;<br />
}<br />
}<br />
return 0;<br />
}<br />
<br />
-------------------------------------<br />
class MyClass: public Interface1, public Interface2, public Interface3<br />
{<br />
....<br />
static MyClass m_instance;<br />
static MyClass* Instance();<br />
virtual void Configure();<br />
}<br />
-------------------------------------<br />
MyClass* MyClass::Instance()<br />
{ <br />
if( m_instance == NULL )<br />
m_instance = new MyClass(); <br />
return m_instance;<br />
}<br />
--------------------------------------<br />
void MyClass::Configure()<br />
{<br />
}<br />
--------------------------------------<br />
Regards,
Olivier.
|
|
|
|
|
Does this compile?
class MyClass
{
static MyClass m_instance;
}
MyClass* MyClass::m_instance = 0;
and this
MyClass->Start();
I'm also doubtful about the use of shared data segment memory as an interprocess mechanism.
|
|
|
|
|
hi all
I need to handle a notification event from Active Directory server.
when the user deletes, renames, moves or changes the properties of an object using one of the Active Directory.
I am writing a com component derived from IDsAdminNotifyHandler Interface
and waiting for the notification event in Notify function of the interface
but the notification never occurs when the user details are changed.
plz help me.
thank & regards
#sanroop#
|
|
|
|
|
I have faced problem with cl_login. Whether it is standard function?
Please if anyone have any idea tell me.
|
|
|
|
|
|
hi all,
i am using printf,CString, int variables in my application CALL BACKS,due to that memory usage keeps on increasing.
but when i use const char * varibles memory don't increase.
my doubt is why memory increases when i use printf() funtion or CString, int in CALL BACKS?
st
|
|
|
|
|
When memory usage keep increasing, usually it is not due to printf or CString or even callbacks by themselves. There is simply a mistake in your code
(option two: maybe also there are several mistakes in the 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
|
|
|
|
|
do you keep allocating memory somewhere, and never releasing it ?
|
|
|
|
|
when i don't use printf or CString memory don't increase, it remains constant.
callbacks are called or updated by every second. even i need to check my code again.
my doubt is printf prints the output to stdout or console. is it that buffering ? or anything else
Jalsa
|
|
|
|
|
do you call CString::GetBuffer() by any chance ?
|
|
|
|
|
Maybe you're doing a wrong usage of CString objects. Could you post the 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
|
|
|
|
|
Hi,
Recently a friend of mine who is learning C++ wrote a code as given below
class SingleTon
{
public:
static SingleTon& GetInstance()
{
return *ptr;
}
private:
static SingleTon* ptr;
};
SingleTon* SingleTon::ptr = NULL;
int _tmain()
{
SingleTon &ref = SingleTon::GetInstance();
if(&ref == NULL)
{
cout << "The reference is NULL";
}
return 0;
}
My query is why didn't this code crashed. The program simply printed "The reference is NULL" and exited. I am a bit confused here, The pointer is initialized to NULL and in GetInstance() it is dereferenced. In my opinion as soon as it was dereferenced, the program should have crashed!! Or is there something basic I am missing?
Thanks & Regards

|
|
|
|
|
IMHO the pointer is never dereferenced in the above 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
|
|
|
|
|
probably because you tested in debug mode (where pointers are not actually initialized to 0x00000000).
test in release mode and tell us if it still doesn't crash...
|
|
|
|
|
toxcct wrote: test in release mode and tell us if it still doesn't crash...
I've done. It behaves exactly the same.
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
|
|
|
|
|
ok; it was just a guess, i have no compiler here.
however, i don't really like the way the OP uses NULL. i'm not even sure a reference gets a NULL pointer "dereference"...
|
|
|
|
|
toxcct wrote: however, i don't really like the way the OP uses NULL
I don't like too. Nonetheless, the address of operator seems to be legitimate on the reference.
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
|
|
|
|
|
I had tested in Release mode as well, yet the program never crashed.
I had used VC++ 2005 compiler with SP1 on Windows XP Pro + SP2
Thanks

|
|
|
|
|
I dont think it should not crash at all unless you are trying to access or invoke any members of ref. (Though its technically very unlikely to have an object at address 0x00 - its just an address like any other).
|
|
|
|
|
This is the beauty of references!
It refers to an instance of an object at a certain address, it's not an actual instance of an object. In this case the address is NULL, which is perfectly legitimate.
However, if you try to use any of its members it would of course crash since the 'this' pointer is NULL.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Deferencing is accesing value, indirectly through pointer.
In your example I say it is not deferencing, its referencing.
int val = *ptr; // accesses value;
int &ref = *ptr; // don't accesses value;
int *ptr2 = &*ptr1; // here Value of (*ptr1) is not accessed, as ptr2 is not going to store the address the temporary value (*ptr1), instead stores address itself (ptr1).
similarly
int &ref = *ptr; is not dereferencing the value but referencing the memory location;
"A reference holds the address of an object, but behaves syntactically like an object." from msdn;
int *ptr2 = &*ptr1; is same as int &ref = *ptr; check the code generated for the two expression.
and "int *ptr1 = NULL; int *ptr2 = &*ptr1" also won't crash.
|
|
|
|