|
Don't feel blue,
these are simple C++ errors. I think you haven't basics in C++.
In C++ default constructor and other stuffs are learning in the beginning.
If you give the compilation error code in MSDN. it will show the reason with example. First try for that.
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
<blink>My Blog | Understanding State Pattern in C++
|
|
|
|
|
Sorry, but as you are missing the essential parts of C++, it is very difficult to help because we need much more information than you just gave us. And asking these information will require you to understand what we are speaking about (which seems not to be the case).
I suggest you take a look at these tutorials[^] and read that carefully before going any further. It is essential that you understand at least the basics of C++.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
i think u people are misinterpreting me..
but that is ok.
i have made the deafult constructor but still its giving the same error.
but i think problem is some where else.
when i call the function making object then it give me error of default constructor.
and when i call the function by its name then it gives error
"illigal call of non-static member function".
thanx for ur support.
|
|
|
|
|
Let me say one thing.
For a properly written class ( source files) can be used with any C++ applications.
aavesh wrote: i think u people are misinterpreting me..
Is it our mistake? if yes, sorry for the same.
aavesh wrote: hi
i include the header file like that
#include "gloox/src/connection.h"
and call the member function on buttion click event like this
gloox::Connection::temp();
here gloox is a namespace,coonection is class and temp is function name.
when i call like this its giving me error illigal call of non static member function.
thanx
This was one of you post.
You know that the function is not static. you can call temp function without creating an object,only if it is static function.
Cedric asked you for the constrcutor right?
The Compiler will put a default constructor, if there's no constructor available in your class
for example
class CTest
{
public:
CTest(int i ){};
};
If you try to create
CTest t;
it will give the same error what u said eralier. In this case you can create an object in this way
CTest t(10);
we have tried to help you by spending our time... Just look at the forum... it's quite a big discussion right?
aavesh wrote:
hi
when i pass the argument then it gives the error that
"Error : object have struct/unioun tyoe"
what to do.
it there any clear way to call a other project function into our project (both of the project in the same solution).
thanx
Without provinding enough information how we could track your bug? even after asking you for the ctor, u didnt give anything.. don't blame us for your mistake.
C++ is not written for a single peron. there are alot of people using the same in this world.
99.99% it will be our mistake. don't blame the compiler.
Hope you will take this in positive sense.
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
<blink>My Blog | Understanding State Pattern in C++
|
|
|
|
|
hi
plz don't take it other wise.
thanx for ur support people.even i appreciate ur patience that u people give me ur valuable time.
i know that there is my mistake and for my mistake how can i blame u.
i didn't mean it at any time.
i was getting little frusted and was making the stupid mistake.
event the problem is not yet solved.
but i will try to find out the solution once again thanx for ur support.
i hope u wouldn't mind anything....thanx
|
|
|
|
|
Hi,
I have a a singleton class with a private instance pointer (pInstance) that is initialized with a dynamically created instance (using "new"). I'm just wondering what I have to do to ensure there is no memory leak when the class is no longuer used.
Shall I create and call a "destroyInstance()" function in the class doing "delete pInstance; pInstance = NULL;" ?
|
|
|
|
|
If you prefer an STL solution, I think you could consider the auto_ptr class:
#include "stdafx.h"
#include <memory>
std::auto_ptr< MyClass > pInstance;
In this case the singleton object will be deleted automatically.
|
|
|
|
|
We should destroy it after use.
Singleton design is same like as all objects except it has an internal static pointer and function to create it.
We should do the cleanup.
I suggest you do the same at the end of the application.
e.g: Before returning from Main, or in ExitIstance of CWinApp etc.
The other way is make the static pointer as an auto pointer.
but I'm not recommending the same.
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
-- modified at 7:44 Wednesday 5th July, 2006
|
|
|
|
|
Sarath.<fon wrote:<="" div="">We should do the cleanup.
Thanks.
Is it OK to do the cleanup in a method of the same class ("destroyInstance()") as I suggested ?
It seems a bit weird to me to destroy an class instance using a method inside it.
|
|
|
|
|
It's special no?
we are created it specially, So we have to do something specal to clean it up.
In this case, the destrcutor will not awake automatically.
you can use auto pointer. but i think it is not good way for handling the resources.
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Let me ask you one more question. What you will do to delete a static member pointer which holds allocated memory.
there you can create alot of objects. In which object's dtor, you can do the same? or any other idea?
same case here. manually cleanup the pointer.
do the same thing which we are supposed to do in the cleanup function. Instead of compiler put code, we are manually putting the code to destruct the object inside. is it ok? don't feel weird
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Another option is to have the function that returns the single instance written this way:
CMySingleton* CMySingleton::GetInstance()
{
static CMySingleton Instance;
return &Instance;
}
This way, everything will be managed automatically and you don't need to take care of releasing the memory. The disandvatage of this version is that you don't have any control over the creation time of the singleton (which is not a problem when you use one but can be problematic when you have a singleton that has a singleton as member for example).
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
how we can use owner draw for list control and tab control.give any examples or any links ,
vasu.
|
|
|
|
|
I would advise to search in CP yourself , but for sake I searched a Link of my favourite author at CP:
http://www.codeproject.com/listctrl/lvcustomdraw.asp
Greeting from Germany
|
|
|
|
|
|
plz tell me how i can place picture or like on button and how to change font of button,
plz tell me example for this its a request......
plz...........
Ashish Dogra
MCA
Noida
|
|
|
|
|
for picture on a button Instead of Creating an object of type CButton do it for CBitmapButton and then set the Bitmap using LoadBitmap function. set the owner draw property of the button.
CBitmapButton m_bmpBtn; // In the header file
m_bmpBtn.LoadBitmaps (IDB_BITMAP1);
m_bmpBtn.SizeToContent ();
/////////To change the font . Type CButton. and Remove owner draw
m_bmpBtn.SetWindowText ("Hello");
CFont font;
font.CreateFont (10,10,2,3,2,0,0,0,0,0,0,0,0,"Arial");
m_bmpBtn.SetFont (&font);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 7:41 Wednesday 5th July, 2006
|
|
|
|
|
thanks sir what
if i want to set both that means set font and color at same time then what is solution sir
plz tell me
Ashish Dogra
MCA
Noida
|
|
|
|
|
for piscture you need to two thing
(1)BS_BITMAP
(2)bitmap or image handle)<br />
m_Button.ModifyStyle(0,BS_BITMAP);<br />
m_Button.SetBitmap(hbitmap);
this handle hbitamp has one HBITMAP handle that return from one CBitmap or LoadImage
------------------
2-for Font you can use a simple function
m_Button.SetFont(GetFont());
whitesky
|
|
|
|
|
If you are considering CBitmapButton , see here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I want to change the bitmap on my toolbar button when user presses the button i.e. if initially its showing x bitmap then when user presses it it should show y bitmap on that coreesponding button
Thanx in advance
|
|
|
|
|
One way is to Set the owner draw property of the button to TRUE. Derive a class from CBitmapButton and override the DrawItem function in that derived class.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
another way to do this is to have 2 toolbar buttons and show/hide them appropriately
cje
|
|
|
|
|
Hi,
i try to write a ISAPI Extension for Win CE 4.2 to view dynamic webpages.
The got the ISAPI environment working it can now read templatefiles and replace tags in the template but now i try to fill the page with data form a SQL CE 2.0 Server. As far as i know there is the only way to connect by using ole db. right?
i found the article about accessing MS SQL Server CE v1.0 / 2.0 without ADO object. I tried to implement it. When I call the included test function it tells me that SQL Server is running. And with the example application it's no problem to connect and create tables and so on.. but when i try to connect to my database it always fails.
Anyone can help me with this?
Her's my example code:
<br />
<br />
#include "stdafx.h"<br />
#include "WriteFunctions.h"<br />
#include "ReadFunctions.h"<br />
#include "SqlSvrCe.h"<br />
<br />
<br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{<br />
return true;<br />
}<br />
<br />
BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVersion)<br />
{<br />
pVersion->dwExtensionVersion = MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR);<br />
<br />
strcpy(pVersion->lpszExtensionDesc, "ISAPI DB Connection");<br />
<br />
return true;<br />
}<br />
<br />
DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB)<br />
{<br />
HRESULT hr;<br />
WriteHTMLHeader(pECB);<br />
WriteHTMLHead(pECB, "ISAPI DB Connection");<br />
WriteHTML(pECB, "Checking SQL Server\r\n<br>");<br />
if (SqlServerSelfTest() != 0)<br />
{<br />
WriteHTML(pECB, "SQL Server CE not installed!\r\n<br>");<br />
<br />
} else {<br />
WriteHTML(pECB, "SQL Server CE installed!\r\n<br>");<br />
}<br />
<br />
hr = CreateSqlSvrCeProvider();<br />
WriteHTML(pECB, "Result : %d\r\n", hr);<br />
hr = ConnectDB(TEXT("\\StoreCard\\Tmp\\database.sdf"));<br />
if (FAILED(hr)){<br />
WriteHTML(pECB, "Can't Open\r\n<br>");<br />
}<br />
<br />
WriteHTMLFoot(pECB);<br />
<br />
return HSE_STATUS_SUCCESS;<br />
}
|
|
|
|
|
Can someone point me to the best control/class that I can plug in to a dialog app created in VC++ using MFC so that I can display a simple array of 27 numbers as a 2D profile. It doesn't need to have any runtime user input or customisation. My program calculates two arrays, and displays some numeric values based on them, but it would be nice if the user could see each of the two arrays plotted on a graph like they would see it in an Excel chart, ideally with the points joined by smoothed lines
tks in advance
|
|
|
|