|
Hello
I'm rather new with VC++ development, so perhaps this is a stupid question, but I would like to create an HTML document from my application that contains a report but how do I launch this document in a browser window when it has been created?
Thank you for your Help
Henrik
|
|
|
|
|
There might be a better way to do this, but you can launch Internet Explorer by using the ::CreateProcess() API. You can then just pass to IE, the path to your file and it will open your file with IE. Look on MSDN for more info on it.
Or you can use the CHtmlView control which displays HTML documents using IE.
- Anatari
|
|
|
|
|
<br />
<br />
::ShellExecute( NULL, _T("open"), _T("iexplore.exe"), m_strURL, NULL, SW_SHOWDEFAULT );<br />
This code will always launch Internet Explorer and load the file specified by m_strURL. If you want to use the default browser then replace _T("iexplore.exe") with NULL.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
I have a property page (CPropertyPage ) with a CListCtrl and some buttons. With this buttons I can delete a item in the CListCtrl or change the position of a item in the CListCtrl (up or down).
So, the problem is that I want to make the current selected item allways be marked as the selected item.
I have tried to set the focus in every button handler (On...() ) to the list box (CListCtrl ):
m_ctrlList.SetFocus();
That works fine, when I click on a button. The focus switch back to the list box. But when I click anyone else on the property page the list box lost the focus and the current selected item will be marked in some gray (the background of an item will be gray).
So, I want that the current item will be allways be marked in blue and that the list box will never lost the focus, when I click anywhere on the property page.
How to make?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Can't you handle the property page the same way you handled the buttons? I believe they are all derived from the CWnd class.
- Anatari
|
|
|
|
|
Ok, I can handle every message that would make, that the list control lost the focus, but this are many messages (when the tab key is pressed, when I click on every other control, ...)
I want that the list control never lost the focus!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Can any one tell me why Microsoft removed class wizard from VC++.NET ???
I don't know about your views but for me class wizard always proved to be useful and I am unable to find reason behind the logic of removing class wizard.
Also please tell me what is the equivalent of class wizard in VC++.NET and from where we launch it ??? (I've installed VS.NET two days ago for the first time). It was so easy for me in VC++6.0 to add events and automation interfaces in ActiveX controls using class wizard. How can i do so in VC++.NET
|
|
|
|
|
You can add events by going to the class view and selecting the class you would like to add the message handlers to. Underneath the class view there is a properties box with a button with a lightning picture. Click on that picture and you will see a list of events you can add to the class. I think most of the features in VC 6.0 is still in VS.Net just re-arranged to different locations.
- Anatari
|
|
|
|
|
My ClistCtrl is of LVS_REPORT style, i want to set the background color of
alternative lines(NOT the whole control). How?
Thanks a lot!
|
|
|
|
|
I guess, the way how to have own color of one line in ClistCtrl
is set Owner-draw style and take responsibility for its drawing.
-Much more work, but much more freedom.
more in CListCtrl::DrawItem()
Viliam
|
|
|
|
|
See the article "Neat things to do in CListCtrl using Custom Draw" on this site by Michael Dunn (sorry i've not given you a link but search and you should get it). Had exactly the same problem and that sorted me out.
-Alex;)
|
|
|
|
|
why virtual destructor?
and what about constructor?
norm
|
|
|
|
|
a virtual destructor ensures that the destructor in the base class is called, in addition to the destructor in any derived classes.
ex:
class A
{
public:
virtual ~A() {...whatver...}
};
class B : public A
{
public:
~B() {...whatver...}
};
when an object of type B is destroyed, both the B destructor and the A destructor will be called.
c++ FAQ lite
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
Thanks, but "both the B destructor and the A destructor will be called."
how did that happen? thru what mechanism is A's destructor invoked when a class B instance is destroy?
i thought, unless:
class B
{
...
...
~B()
{
...
~A(); //Invoke base class destructor?
}
...
...
};
and what about constructor?
norm
|
|
|
|
|
norm wrote:
how did that happen?
it happens automatically as part of C++. you don't have to call A's destructor yourself.
norm wrote:
and what about constructor?
try that link i gave you.
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
Chris Losinger wrote:
a virtual destructor ensures that the destructor in the base class is called, in addition to the destructor in any derived classes.
This is only the first part of the statement, because this automatically happens normally. The other half of this statement is when the derived class is used polymorphically in the base class.
So, if you are storing a derived object of type B, in a type A pointer, you will need to have a virtual destructor in the base class A, in order for the proper destructor of class B to be called.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
sheesh - don't do all his homework for him!
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
Chris Losinger wrote:
sheesh - don't do all his homework for him!
Now you make me feel bad for the other more complete post that I made right under the main thread
Actually I just wanted to clarify this fact because it is one of those esoteric things in C++ that it doesn't make that much sense until you actually see it in action. And if you misunderstood the context in which a virtual destructor is useful it might actually cause more confusion.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Paul Watt wrote:
Now you make me feel bad for the other more complete post that I made right under the main thread
Paul Watt wrote:
it is one of those esoteric things in C++ that it doesn't make that much sense until you actually see it in action
yup. i agree.
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
You will need to create a virtual destructor if you plan on using your classes polymorphically. However it is good practice to make sure that you always define base classes with virtual destructors to leave that option open for you in the future.
If you create a Derived object B, and store it in a base class pointer A, when you call delete on A for a non-virtual destructor, the destructor for A will be called. However if you declare the destructor virtual, then B's destructor will be called first, and B's destructor automatically calls A's destructor. This memory leak is called slicing.
Here is a small sample program that shows what happens when you have a polymorphically stored derived class in a base class pointer where the base class does not have a virtual destructor.
#include <conio.h>
#include <iostream>
using std::cout;
using std::endl;
class A
{
public:
A ()
{
}
~A()
{
cout << "delete A" << endl;
}
};
class B : public A
{
public:
B () : A()
{
}
~B()
{
cout << "delete B" << endl;
}
};
int main(int argc, char* argv[])
{
B* B_Pointer = new B;
delete B_Pointer;
A* A_Pointer = new B;
delete A_Pointer;
cout << "Press any key to exit" << endl;
::getch();
return 0;
}
This is the output that you will see.
delete B
delete A
delete A
Press any key to exit
The first pointer that is deleted is the object of type B that was stored in a Pointer of type B. Notice how it first calls B's destructor, then A's destructor automatically gets called.
The second object that gets deleted is an object of type B that is stored in an pointer of type A. Only A's destructor will get called.
If you change A's destructor to virtual, this will be the output signifiying that B's destructor properly gets called both times.
delete B
delete A
delete B
delete A
Press any key to exit
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
|
anyone can tell me how to invoke/reference an ATL COM server from an ASP page?
i am pretty new in this subject, but it'd be nice if u can just get me up to speed here and point me in the right direction.
thanks
norm
|
|
|
|
|
As well as a GUID, your component has a friendly name, such as 'Dundas.Chart'. So you do this in your asp
dim oChart
set oChart = CreateObject("Dundas.Chart")
The COOL thing if you have .NET is that it then gives you intellisense on the objects methods ( just found this out ).
If the component is yours, the friendly name is the name written out in the rgs file, if not, it's in the top hive of the registry, and should be in the docs from the vendor.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
sorry, is this VB.NET syntax? I know VB.NET, but not VB and definitely not VBScript.
but it's an ASP (not ASP.NET) application that'll Create this COM object... and i dont get to decide whether we use ASP.NET or ASP.
and i presume this is the code for an in-process COM server?
Thanks!
norm
|
|
|
|
|
is there any good tutorial on how to create an ATL COM server and reference it from ASP web application?
i am rather overwhelmed by all the reading: ATL, MTA/STA, in-process vs out-of-process, local vs remote, registry APIs, interface and MIDL...
norm
|
|
|
|