|
Click1^
Click2^
But asking the same here^ would be appreciated.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
I have an ATL Dll , it works fine with windows application. But I must be using it in an ASP page.
I use the <OBJECT> tag to refer it.
<OBJECT id=OBJ classid="clsid:5CDD5E2B-254D-412B-8B4C-88AF06EC3B0A" VIEWASTEXT>
<SCRIPT LANGUAGE=javascript FOR=OBJ EVENT=NewEvent>jsNewEvent();</SCRIPT>
</OBJECT>
<script>
function jsNewEvent()
{
alert(OBJ.testProperty);
OBJ.testMethod();
}
NewEvent - The event in the DLL. jsNewEvent which is mapped to that event.
I'm able to use all the methods, properties of the DLL but not the events.
the call this->Fire_NewEvent in my ATL code is never executed. It's not even entering the connection-points implementation.
Any help?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
Move the <script> outside the <object>
The contents of <object> are only used if the control can't be loaded, or the user has IE set to not load AX controls.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Yes. <Object> tag is sensitive. That's a mistake. Thanks Mike!
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
hi guys this is rocky,,,,,,
i cant understand one thing please help me to understand that........
check the code .............
// Initialize TAPI
hr = pTapi.CreateInstance((CLSID_TAPI));
hr = pTapi->Initialize();
// Look for the requested line
pEnumAddress = pTapi->EnumerateAddresses();
while ( pEnumAddress->Next(1, &pAddress, &ul) == S_OK )
{
name = pAddress->AddressName;
//if ( name == bstrLine )
//break;
pAddress.Release();
pAddress = 0;
}
// If the line was found, then make a call
if ( pAddress )
{
pCall = pAddress->CreateCall(bstrNumber,
LINEADDRESSTYPE_PHONENUMBER,
TAPIMEDIATYPE_AUDIO);
// Make the call
hr = pCall->Connect(true);
i think what this is doin there are so many numbers are here...........
i want to call only one no example 123456789 lests its hard coded how can i call this no with the above code what change i have to make for this
thnx in advance guys
Best Regards
Rocky
|
|
|
|
|
<br />
_bstr_t _bsPhoneNumber= "123456789"<br />
<br />
if ( pAddress )<br />
{<br />
pCall = pAddress->CreateCall(bstrNumber_bsPhoneNumber.copy(),<br />
LINEADDRESSTYPE_PHONENUMBER,<br />
TAPIMEDIATYPE_AUDIO);<br />
hr = pCall->Connect(true);<br />
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
Hello,
I'm developing a casual game using DirectX. In the game there is class called "CEnergyBall" which contains several animations(in fact, it is 407 altogather) according to its state. I've used the map to managed the animation here.
below is the code snippet :
...
map<AnimationKey,CAnimation> CEnergyBall::s_aBallAnimation;
...
bool operator<(const AnimationKey& a,const AnimationKey& b)
{
if(a.type<b.type)
return true;
if(a.type>b.type)
return false;
if(a.oldState<b.oldState)
return true;
if(a.oldState>b.oldState)
return false;
if(a.newState<b.newState)
return true;
return false;
}
struct AnimationKey
{
ENERGYBALL_TYPE type;
DWORD oldState;
DWORD newState;
friend bool operator<(const AnimationKey& a,const AnimationKey&);
AnimationKey(ENERGYBALL_TYPE type, DWORD newState, DWORD oldState)
{
this->type = type;
this->newState = newState;
this->oldState = oldState;
}
};
This work fine, everything is run smoothly. But when the application is closed (and the object is destroying) the exception is rised :
Unhandled exception at 0x7c901230 in Pick'n Pile.exe: User breakpoint.
Below is stack trace :
ntdll.dll!7c901230()
d3d9d.dll!0103e3ff()
d3d9d.dll!0103e579()
d3d9d.dll!0103e581()
d3d9d.dll!0103db0d()
ntdll.dll!7c91056d()
oleaut32.dll!77121b3d()
oleaut32.dll!77121b26()
ntdll.dll!7c926abe()
ntdll.dll!7c9268ad()
ntdll.dll!7c91056d()
ntdll.dll!7c914652()
ntdll.dll!7c910970()
ntdll.dll!7c90fb71()
ntdll.dll!7c91056d()
ntdll.dll!7c911962()
ntdll.dll!7c911993()
ntdll.dll!7c911970()
kernel32.dll!7c814b84()
ntdll.dll!7c911970()
ntdll.dll!7c911902()
ntdll.dll!7c91056d()
msvcrt.dll!77c2c2de()
msvcrt.dll!77c2c2e3()
ntdll.dll!7c911902()
crypt32.dll!77aa4469()
d3d9d.dll!010fdbc0()
ntdll.dll!7c9011a7()
ntdll.dll!7c923f31()
ntdll.dll!7c910945()
ntdll.dll!7c91094e()
ntdll.dll!7c915b4f()
kernel32.dll!7c81c9ae()
ntdll.dll!7c915b4f()
Pick'n Pile.exe!std::map<AnimationKey,CAnimation,std::less<AnimationKey>,std::allocator<std::pair<AnimationKey const ,CAnimation> > >::~map<AnimationKey,CAnimation,std::less<AnimationKey>,std::allocator<std::pair<AnimationKey const ,CAnimation> > >() + 0x3b C++
> Pick'n Pile.exe!doexit(int code=0, int quick=0, int retcaller=0) Line 414 + 0x9 C
Pick'n Pile.exe!exit(int code=0) Line 303 + 0xd C
Pick'n Pile.exe!WinMainCRTStartup() Line 267 C
kernel32.dll!7c816f97()
ntdll.dll!7c915b4f()
Since there is only s_aBallAnimation declared as map<AnimationKey,CAnimation>, I supect that it caused the exception, but I don't know why it is rised.
I'm using Visual Studio .Net 2003 (which is VC7.1) along with DirectX SDK (June 2006).
Thank you,
Wutipong
|
|
|
|
|
mr_tawan wrote: This work fine, everything is run smoothly. But when the application is closed (and the object is destroying) the exception is rised :
Unhandled exception at 0x7c901230 in Pick'n Pile.exe: User breakpoint.
Your error is an "Unhandled exception" and probably unrelated to the map.
|
|
|
|
|
Are you passing either the map or the map elements between multiple threads by chance? Or passing anything else between multiple threads (say, a std::string)?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Dear All,
I can use synonyms, Translate dictionary features in MS Word's Context Menu. Can I use the same features in browser's Context Menu. If Yes then how?
With Regards
Manoj
|
|
|
|
|
Hi
I see that all stl components have destructors.
string s;
s.~string();
But i know that we don't need to delete stl componenets.I read all stl components automatically delete themself.Is this wrong?
If true what is the function of destructors in STL?
Thanks...
|
|
|
|
|
How do you expect STL components to magically delete themselves ? Cleaning up after themselves is what C++ classes have destructors for.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: How do you expect STL components to magically delete themselves ?
He probably read somwhere that he need not learn the basics but jump right into STL programming.
|
|
|
|
|
say u have vector<string*> in such case the vector will delete the pointers but the memory referred by the pointers.So it leads to memory leak
never say die
|
|
|
|
|
If you have a vector of pointers to dynamically created objects, you must explicitly delete those objects before the vector goes out of scope:
using std::wcout;
using std::endl;
using std::vector;
class Foo
{
public:
Foo(int index) : m_index(index)
{
wcout << L"Creating Foo #" << m_index << endl;
}
~Foo()
{
wcout << L"Destroying Foo #" << m_index << endl;
}
private:
int m_index;
};
int _tmain(int argc, _TCHAR* argv[])
{
vector<Foo*> pFooList;
for (int i = 0; i < 10; ++i)
{
pFooList.push_back(new Foo(i));
}
for (int i = 0; i < 10; ++i)
{
delete pFooList[i];
}
return 0;
}
-- modified at 0:01 Saturday 12th August, 2006
|
|
|
|
|
<br />
Use auto_ptr<> will delete them for you<br />
#include <memory><br />
<br />
using std::wcout;<br />
using std::endl;<br />
using std::vector;<br />
<br />
class Foo<br />
{<br />
public:<br />
Foo(int index) : m_index(index)<br />
{<br />
wcout << L"Creating Foo #" << m_index << endl;<br />
}<br />
<br />
~Foo()<br />
{<br />
wcout << L"Destroying Foo #" << m_index << endl;<br />
}<br />
private:<br />
int m_index;<br />
};<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
vector< std::auto_ptr< Foo* > > pFooList;<br />
<br />
for (int i = 0; i < 10; ++i)<br />
{<br />
pFooList.push_back( std::auto_ptr< Foo* >(new Foo(i))); <br />
}<br />
<br />
<br />
<br />
return 0;<br />
}<br />
|
|
|
|
|
Unfortunately, that should not compile! According to the book, "The C++ Standard Library: A Tutorial and Reference" by Nicolai M. Josuttis, I quote:
auto_ptrs don't meet the requirements for container elements.
An auto_ptr does not meet one of the most fundamental requirements for elements of standard containers. That is, after a copy or an assignment of an auto_ptr, source and sink are not equivalent. In fact, when an auto_ptr is assigned or copied, the source auto_ptr gets modified because it transfers its value rather than copying it. So, you should not use an auto_ptr as an element of a standard container. ...
However, boost::shared_ptr can be used with containers! See: http://www.boost.org/libs/smart_ptr/shared_ptr.htm[^]
George
-- modified at 17:52 Thursday 17th August, 2006
|
|
|
|
|
#include <iostream>
#include <vector>
#include <boost/shared_ptr.hpp>
using std::wcout;
using std::endl;
using std::vector;
using boost::shared_ptr;
class Foo
{
public:
Foo(int index) : m_index(index)
{
wcout << L"Creating Foo #" << m_index << endl;
}
~Foo()
{
wcout << L"Destroying Foo #" << m_index << endl;
}
private:
int m_index;
};
int _tmain(int argc, _TCHAR* argv[])
{
vector< shared_ptr<Foo> > pFooList2;
for (int i = 0; i < 10; ++i)
{
shared_ptr<Foo> sptr(new Foo(i));
pFooList2.push_back(sptr);
}
return 0;
}
|
|
|
|
|
dfields326 wrote: Use auto_ptr<> will delete them for you
Containers of auto_ptr's is a BIG No-No! It will compile on some older compilers, but it will not do anything close to what you expect it to. It won't even compile on newer compilers.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
sawerr wrote: But i know that we don't need to delete stl componenets
I don't think you quite understand C++ fundamentals. STL classes (string, vector, list, map, etc) all allocate memory on the heap to store whatever data you are throwing at them. string, for example, allocates an array of characters. As you fill up that array, it evaluates if it needs to allocate a bigger buffer, etc. All that is handled for you. The destructor cleans up that heap memory.
When you write:
void f()
{
string s;
}
s is allocated on the stack. At the end of the scope (in this case, when the function returns), s's destructor is called, which cleans up anything s had allocated.
If you were to write this:
void f()
{
string* s = new string;
}
you would have a memory leak (not good!).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi all,
I'm writing an ActiveX ctrl in which a DDE server resides. The DDE server has it's own thread. From that thread function calls are made to the main thread on behalf of some messages. For the processing of one particular message a JavaScript function on the web page must be called. This involves acquiring an IHTMLWindow2 interface. My problem is that I get a return value of E_UNEXPECTED whenever I call the interface querying functions from the DDE server's thread. For example.
hr = m_spClientSite->GetContainer(&spContainer);
I presume this is a threading issue as the method works fine in the main thread. However, I have little idea of how to resolve the situation.
Thanks in advance
Tom
The greatest hinderence to the truth is not ignorance, it is the illusion of knowledge.
Anon.
|
|
|
|
|
I am debugging a large ATL-based application, and am suffering from some memory leaks that are reported when the app exits (thanks to _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF) in the satrtup code). However, unlike MFC apps (which used the DEBUG_NEW macro) the file name/line number of the relevant allocation calls are not displayed.
How can I find out where the leaks are coming from without paying $$$ for BoundsChecker/Purify - am amazed that ATL doesn't support this.
|
|
|
|
|
|
Thanks Michael. Would this be safe to use in stdafx.h do you know?
|
|
|
|
|