|
As told in the article
CComObject<cmaindlg> dlgMain;
dlgMain.AddRef();
if ( dlgMain.Create(NULL) == NULL )
{
ATLTRACE(_T("Main dialog creation failed!\n"));
//return 0;
}
dlgMain.ShowWindow(SW_SHOWDEFAULT);
}
not working.
Now the program is compiling without any errors.But when i am clicking button then only Dialog Box is visible without ActiveX Control and that too with illegal operation, asks to close and send Error Report.
I know that the problem is somewhere with Create function .i.e. Dialog box is not creating.I also removed ActiveX control from Dialog Box ,then too the problem continues.It means that Dialog Box is not being Created.
But i don't know how and what to do.I tried as
For that i called AtlAxWinInit(); in CMainDlg::OnInitDialog();
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
AtlAxWinInit();// Added this
CAxWindow wndIE = GetDlgItem(IDC_IE);
CComPtr<iwebbrowser2> pWB2;
HRESULT hr;
hr = wndIE.QueryControl ( &pWB2 );
if ( pWB2 )
{
CComVariant v; // empty variant
pWB2->Navigate ( CComBSTR("http://www.codeproject.com/"),
&v, &v, &v, &v );
}
but same problem continues.Any one Plz help me
|
|
|
|
|
hi,
i want to create a function with the FileCodeModel and put a comment for the function. the problem is that i want to make a comment like this:
<br />
<br />
but i dont know how to make it, i know only to make this type of comment :
<br />
with this code -
CComPtr<EnvDTE::CodeFunction> l_pCodeFunction;<br />
CComPtr<EnvDTE::ProjectItems> l_pProjectItems;<br />
CComPtr<EnvDTE::ProjectItem> l_pProjectItem;<br />
CComPtr<EnvDTE::FileCodeModel> l_pFileCodeModel;<br />
<br />
pActiveDoc->get_ProjectItem(&l_pProjectItem); <br />
l_pProjectItem->get_FileCodeModel(&l_pFileCodeModel);<br />
l_pFileCodeModel->AddFunction(L"DoSomething",EnvDTE::vsCMFunctionFunction,CComVariant(L"void"),CComVariant(1),EnvDTE::vsCMAccessPublic,&l_pCodeFunction);<br />
l_pCodeFunction.put_Comment(???)
does someone knows how to make multiline comment?
|
|
|
|
|
hi,
where can i get this object? i mean from which object?
couldn't find in EnvDTE...
Avi.
|
|
|
|
|
|
thanks man, i'll check it out, it looks promising...
|
|
|
|
|
hi,
from where can i get the CodeModel obj?
10x, Avi
|
|
|
|
|
Hi!
I have some compiling problems with my shell projects. I can not compile them since I keep getting the error that there is no precompiled .pch-file...
What am I doing wrong? I am a bloody beginner.. (this is my first project)
pls help me. I know it's a very stupid question, but I can seem to solve the problem.
Thx in advance
zsomboro
|
|
|
|
|
Either
add a precompiled header - add stdafx.h and stdafx.cpp to your project and compile stdafx.cpp with the option /Ycstdafx.h
OR
remove mention of the option /Yu (you'll possibly see it as /Yustdafx.h) from the compilation options of your project
HTH!!!
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hi,
Can anyone tell me which overloaded function is called, below in Line 2:
vector<int>::iterator it = nArray.begin(); // Line 1
if(it) //What overloaded function called here // Line 2
..................
As I know in this case overloaded (operator void *) function is called,
But I d'nt find any such overloaded function in STL iterator class.
Regards
Devendra Chandola
|
|
|
|
|
As you point out, there's no official procedure in the STL specification to test an iterator in such a way. What's happening is that, for vector alone, and for your particular compiler, vector::iterator happens to be an actual pointer, so the expression makes sense --it tests whether the pointer is non-null, which makes little sense in the given context. This is non-portable and you are not guaranteed that the test yield any significative result. Most likely what's intended is the following:
if(it!=nArray.end()){
...
} Hope this helps,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Hi Joaquín,
Thanks for suggestion
I still want to know which overloaded function of iterator is called
when we write:
if(iterator)
Regards
Devendra Chandola
|
|
|
|
|
There is no general answer to your question.
Actually, you should not even ask the question because the "if (iterator)" should not generally compile. However, in your case, the magic of typedef's probably makes it valid and equivalent to "if (pointer)".
Also, the "suggestion" to do "if ( iterator == container.end() )" is NOT a suggestion: it is the only valid way to check for iterator validity.
my 2 cents...
Guy Prémont
|
|
|
|
|
DevendraC wrote:
I still want to know which overloaded function of iterator is called
when we write:
if(iterator)
Set a breakpoint on that if statement, and step into the line (F11) and you'll see.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Hi
I want to be able to dump a map out to any stream, ie cout, fstream, or stream into another class (the other class has the << overloaded) but I can't even pass cout into the template. I've cut the code back to the following....
typedef map<string , string> myMAP;
class MyClass
{
private:
myMAP somedata;
public:
void LoadSomeData(T &t) {
template <typename T>
void DumpSomeData(T &t);
};
template <typename T>
void MyClass::DumpSomeData(T &t)
{
myMAP::const_iterator iter(somedata.begin());
while (iter != somedata.end())
{
t << "#" << iter->first << "#" << iter->second << endl;
iter++;
}
}
and to call it I use...
MyClass LoadAndDump;
LoadAndDump.LoadSomeData();
LoadAndDump.DumpSomeData(cout); <-- compiler errors....
It won't compile and gives
error C2893: Failed to specialize function template 'void __thiscall MyClass::DumpSomeData(T &)'<br />
With the following template arguments:<br />
'class std::basic_ostream<char,struct std::char_traits<char> > *'
Any help much appreciated.
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Are you using MSVC++ 6.0? This compiler is notoriously ill-behaved when dealing with member function templates. Though I'm not 100% sure, sometimes moving the definition to the declaration of the class helps:
class MyClass{
...
template <typename T<
void DumpSomeData(T &t)
{
}
...
};
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Yes - using MSVC++ 6.0, and yes, moving the definition to the declaration works a treat.
Many thanks Joaquin
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Hello,
Things only seem to get stranger everyday.
If I am not mistaken, in an ATL ActiveX Control, the aim of FinalConstruct is that by the time the program reaches there, the object has alreay been created.
however that does not seem to be the case.
In FinalConstructor() m_hWnd in the next statement is NULL.
CWnd* parent = CWnd::FromHandle(this->m_hWnd);
How can the control's window not exist after the constructor has been completed?
Placing the same statment in the OnDraw function works, but not in FinalConstruct()?
Am I missing something? Is there some sort of FinalNoReallyThisOneIsTheFinalConstruct() ?
Thanks
|
|
|
|
|
greekgoddj wrote:
How can the control's window not exist after the constructor has been completed?
Because the C++ object and the window have different lifetimes. The C++ object is created before the window is. FinalConstruct() is, as the name implies, part of the construction process, so only the C++ exists when it is called.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Try trapping the WM_CREATE message. Or WM_INITDIALOG if you're using a dialog based window.
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
I blog too now[^]
|
|
|
|
|
Yup....the solution is...
LRESULT CKnob::OnShowWindow(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/)
Thats where the window is already created and ready. Needed to overide that and add my code inside there.
Thanks!
|
|
|
|
|
In virtula method FinalConstruct() is control created in sense of com object. Creation of control (window) is performed in method OnCreate(...) (this is message handler of message WM_CREATE like in common window).
|
|
|
|
|
hi,
i got an add-in that creates new .cpp and .h file with templates in them.
i want that after i save the files in the project to get them into the VSS.
how can i do that?
(EnvDTE.SourceControl only got checkout functions...)
Avi.
|
|
|
|
|
|
thanks man,
but i didn't find there an answer to my question...
can u direct me further more?
|
|
|
|
|
How can i move the bottom element in an array to the top,
From
Name 1
Name 2
Name 3
to
Name 3
Name 1
Name 2
can anyone help
|
|
|
|