|
|
|
Some problems with your question
1. There is a language called c as opposed to c++. Is that what you mean ?
2. The question is way too broad, and you're on a site full of information on the topic, if you meant C++. Either way, how can anyone explain such a huge topic in a reply to a message board ?
If you meant C and not C++ then you obviously cannot use MFC, and your best bet is to buy 'Programming Windows' by Charles Petzold. You need to make sure you get his book for C and not his book for C#, which is the newer one.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Perhaps they've heard of the legendary powers of the posters on CP and assumed that the gurus could tell the full nuances of the question from that one emoticon?
Debbie
|
|
|
|
|
Hi
I need to check whether a button of a toolbar has an "disabled" image or an "enabled" image. The toolbar is owned by an external app, I have the HWND wndTToolBar of the toolbar. That's what I have so far:
CToolBarCtrl bar;
VERIFY(bar.Attach(wndTToolBar));
Everything works fine, I can hide certain buttons, get the number of buttons and so on. But how can I find out, what image a button has, say button with the index 5?
thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If found out, I just queried the iBitmap value of the button. Works perfectly now.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
Suppose I have a class a vector (defined in vector.h) as a member of the class.
Throughout the methods of the class I insert elements (strings that are read from a file, not allocated with "new") into this vector. Should I erase all the elements of the vector in the destructor of the class? If so - why? aren't these string allocated on the stack?
Same question for a vector I declared in one of the class methods. Should I call clear() on this vector at the end of the method?
Thank You.
-----------------------
Go USA Go
|
|
|
|
|
you don't need to manually empty the vector, unless the objects in the vector require manual deletion (like, if you have a vector of pointers). otherwise, the contents of the vector will be automatically destroyed; the d'tors of all contained objects will be called by the vector d'tor.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
I'm sorry that this is a realy basic question -
About the vector which is a member variable of the class - when is its Dtor called? My guess is when the object "dies" but i'm still not sure.
Is it normal to have a constructor (which doesn't allocate any memory on the heap) and no destructor in a class?
Thanks for your patience .
-----------------------
Go USA Go
|
|
|
|
|
About the vector which is a member variable of the class - when is its Dtor called? My guess is when the object "dies" but i'm still not sure.
vector dtor is called as part of your class dtor (the compiler automatically handles this). So, yes, the vector is destroyed when the owner object dies.
Is it normal to have a constructor (which doesn't allocate any memory on the heap) and no destructor in a class?
It is pefectly normal, specially if all members take care of their own cleanup. Remember that your class never lacks a dtor: if you don't provide one the compiler generates it automatically, and will call appropriate dtors for member objects and base classes.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Makover wrote:
when is its Dtor called?
when the containing object dies. if CFoo has a vector, the vector's d'tor is called as part of the CFoo d'tor.
Makover wrote:
Is it normal to have a constructor (which doesn't allocate any memory on the heap) and no destructor in a class?
constructors and destructors are totally optional. there's nothing wrong or unusual to not have one or the other (or both) in a class. if your class isn't responsible for any heap-allocated memory then you probably don't need a d'tor.
one exception to this is when you have a class where the d'tor performs some kind of useful side-effect: like CWaitCursor which show the hourglass cursor in the constructor then shows the normal cursor in the destructor.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Great! thanks, I finally got it. Thanks Joaquín and Chris.
-----------------------
Go USA Go
|
|
|
|
|
Hi,
My problem :
I want to call a function from a DLL and isn't working
the function is :
// this code is from dll ......
DWORD test(DWORD x)
{
if (x==1)
MessageBox(NULL, "work DLL", "working", MB_OK);
return 0;
}
// ............
in my program I wrote :
typedef DWORD (*LPtest)(DWORD);
LPtest test = NULL;
hDll = LoadLibrary("test.dll");
test = (LPtest)GetProcAddress(hDll,"test");
DWORD a = GetLastError();
hDll is not NULL .... and ....
a is 127 ... "The specified procedure could not be found."
and if I try something like
test(1); the program gets an ACCESS VIOLATION !
please help !!!
|
|
|
|
|
Does your DLL compile correctly? There is no export code.
extern "C" __declspec(dllexport) DWORD Test(DWORD)
Kuphryn
|
|
|
|
|
It sound likes that you does not export the function "DWORD test(DWORD x)",
you can get your current exports table via typing "dumpbin /exports test.dll" in console. In normally, VC6 exports your test function in this form:
_test@2
For telling the compiler we need to export this function in standard mode, save follow lines in notepad in a .def file and then add it to your dll project:
EXPORTS
test
At the end, change declares line "DWORD test(DWORD x)" to "__declspec(dllexport) DWORD test(DWORD x)" for avoid the warning(dllexport assumed).
Good Luck.
|
|
|
|
|
thank you very much !
I wrote a .def file, linked and it worked !!!!
thank you !
|
|
|
|
|
hii..
I created the window,like this:
class CNewWnd : public CWnd
{
public:
CNewWnd(void);
~CNewWnd(void);
};
CNewWnd::CNewWnd(void)
{
this->Create("CNewWnd","New Window",WS_CHILD|WS_OVERLAPPEDWINDOW|WS_VISIBLE,CRect(10,10,200,200),this->GetParent(),NULL);
}
And I want to show this window when pressed the button.I have wanted to do this,like this but this didnt worked .
CNewWnd m_NewWnd;
m_NewWnd.ShowWindow(SW_NORMAL);
I am novice.how can I do this?
|
|
|
|
|
But from where may I ask "this->GetParent()" is going to GetParent(), if you call it from the constructor?
CNewWnd::CNewWnd(void)
{
this->Create("CNewWnd","New Window",WS_CHILD|WS_OVERLAPPEDWINDOW|WS_VISIBLE,CRect(10,10,200,200),this->GetParent(),NULL);
}
|
|
|
|
|
Brian has a valid point.
Another possible problem may be the fact that you're declaring an instance of CNewWnd in your button-click's handler. m_NewWnd should be a member of the parent class.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
thanks for your reply.
please,can you show me how to do this?.
I found an example in MSDN.like this:
void CMyDlg::OnCreateStatic()
{
CWnd* pWnd = new CWnd;
pWnd->Create(_T("STATIC"), "Hi", WS_CHILD | WS_VISIBLE,
CRect(0, 0, 20, 20), this, 1234);
}
but I cant interfere to window.
|
|
|
|
|
OK, this sounds stupid , but I'll ask it 'cos I need to know:
After choosing a Dialog based app in MFC AppWizard, I get the dialog but not the toolbar that is used to place the controls (buttons, combo boxes, etc). How do I make it visible? I looked in the menus if I could bring it up, but I couldn't see it. I'm using VS 6.
4 months of hard-coding everything in MFC has made me a bozo. [embarassed look]
Please help.
Vikram.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
You can get back the Control Box from Through
Menu Tools ->Customize->ToolBars( From the Tab Control)->Controls( Check this)
Jibesh...
|
|
|
|
|
Hi, Jibesh!
Thanx for that tip- it worked. I feel so *dumb* , but hey, MS shoulda put it in a better place! Like I said, 4 months of hard coding in MFC didn't help me.
Thanx,
Vikram.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
Trying to get into OpenGL programming. I have no prior
experience with it. Looking for suggestions on best
ways to get started.
Also looking for suggestions on where to obtain the
necessary libraries, etc...
Consider me and OpenGL newbie, what can I say?
Any help of any kind would be greatly appreciated.
Thanks.
|
|
|
|
|
http://nehe.gamedev.net/
Visual Studio contains all required OpenGL libraries and headers.
|
|
|
|