|
Hi guys, I've been using the VS .NET IDE for some time now to do regukar C++ programming and so far so good.
But this weekend I wanted to explore GDI+ and wrote the following little app.
#include <windows.h><br />
#include <gdiplus.h><br />
<br />
using namespace Gdiplus;<br />
<br />
int main()<br />
{<br />
Bitmap b(L"a.bmp");<br />
<br />
return 0;<br />
}
I compiled and got 6 LNK2019 (unresolved external symbol) errors.
They are all along the lines of
gdistuff error LNK2019: unresolved external symbol _GdipFree@4 referenced in function "public: static void __cdecl Gdiplus::GdiplusBase::operator delete(void *)" (??3GdiplusBase@Gdiplus@@SAXPAX@Z)
gdistuff error LNK2019: unresolved external symbol _GdipCloneImage@8 referenced in function "public: virtual class Gdiplus::Image * __thiscall Gdiplus::Image::Clone(void)" (?Clone@Image@Gdiplus@@UAEPAV12@XZ)
etc etc
And I don't really see why there is a problem. Compiling with the /VERBOSE linker option tells me that all the needed file paths are being searched during compilation and linking. And I have all the required header on my machine courtesy of VS. NET. What step did I miss? Could someone either verify this or at least point me to a setting I missed?
Thanks
Senkwe
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
Go into Project Properties, Linker, Input, Additional Dependancies, and ensure gdiplus.lib is among the libraries listed there.
Shog9
------
to the revelations of fresh faced youth
no one will come to save you
so speak your peace in the murmurs drawn
but youth is wasted on the young - Smashing Pumpkins, Thru the Eyes of Ruby
|
|
|
|
|
Thanks Shog, did the trick. You know, it's linking to gdi32.lib and for some reason, everytime I saw it I kept thinking, "well there's hte lib file, why is this thing still giveing me errors??"
An X-File moment.
ASP.NET can never fail as working with it is like fitting bras to supermodels - it's one pleasure after the next - David Wulff
|
|
|
|
|
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
|
|
|
|