|
|
can i add a quetion on the end?
i have a base class animalClass.hpp i have a derived Dog class and main in dogObj.cpp and a derived Cat class in catObj.cpp what i wanted to know is should i have animalClass.hpp dogClass.hpp, catClass.hpp, declaring the classes and have a seperate animalObj.cpp for main() to constrol the functions etc? at the moment my animalClass is about fifty lines as are the other animal classes, with my main () about 80 lines
thanks in advance
paul
if ignorance is bliss then knock the smile off my face!!!
|
|
|
|
|
1slipperyfish wrote: should i have animalClass.hpp dogClass.hpp, catClass.hpp, declaring the classes and have a seperate animalObj.cpp
you need header files (.h, .hpp) if you want to use the classes in other .cpp files so they can be #include < ...>
If the class is defined in a cpp file the visibility of it is limited to (not sure) that file maybe.
|
|
|
|
|
thanks for the reply led mike
i have rewritten my classes into baseClass.hpp, CatClass.hpp, and DogClass.hpp with farms.cpp initialising the functions and having main()
i had a lot of trouble compiling as it kept saying i had already declared my Mammal class in baseClass however if you add [code]#ifndef BASE_CLASS_HPP
#define BASE_CLASS_HPP[/code] at the top of baseClass.hpp and [code]#endif[/code] at the bottom it works.
you all probably already new that but i've just wasted 2 1/2 hours of my life learning that the hard way
thanks again
paul
if ignorance is bliss then knock the smile off my face!!!
|
|
|
|
|
MAybe I shouldn't answer this after all I work as a MainFrame Assembler Dino programmer
I think think if you declare it in the code/obj/cpp you just have to qualify the method with Class name e.g. DogClass :: dogmethod saying that this dogmethod is releated to the dogalass Class
Trying to get into the future.....
|
|
|
|
|
thanks
paul
if ignorance is bliss then knock the smile off my face!!!
|
|
|
|
|
Hi there. I'm pretty new to coding, I'm trying to (slowly but surely) design a program to receive data from a dyno that I'm fabricating. I'm guessing I'd best use the serial port, from what I read using USB 2.0 is pretty much harder. I'd be putting together a microsystem using either a microprocessor or my own electronics. I'd have to transmit data like engine rpm, air/fuel ratio, dyno drum speed etc. Is there a way to read analogue signals with a pc or can it only use digital signals?
If anyone has some good links or books on communicating with the outside world using a pc, I'd love to have some. Thanks a bunch!
Brian
Yup, I'm a NEWB
|
|
|
|
|
You may want to post this on the hardware board[^].
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Alrighty, thanks for the quick reply!
Brian
Yup, I'm a NEWB
|
|
|
|
|
We are using the February 2006 version of DirectX. When we insert the following line:
#define new DEBUG_NEW
we get the following errors from the Directx Modules:
c:\program files\microsoft directx sdk (february 2006)\include\d3dx9math.h(392)
: error C2059: syntax error : 'string'
c:\program files\microsoft directx sdk (february 2006)\include\d3dx9math.h(392)
: error C2091: function returns function
c:\program files\microsoft directx sdk (february 2006)\include\d3dx9math.h(392)
: error C2802: static member 'operator new' has no formal parameters
c:\program files\microsoft directx sdk (february 2006)\include\d3dx9math.h(393)
: error C2059: syntax error : 'string'
c:\program files\microsoft directx sdk (february 2006)\include\d3dx9math.h(393)
: error C2090: function returns array
c:\program files\microsoft directx sdk (february 2006)\include\d3dx9math.inl(987
) : error C2761: 'void *(__cdecl *_D3DXMATRIXA16::operator new(void))(size_t)' :
member function redeclaration not allowed
c:\program files\microsoft directx sdk (february 2006)\include\d3dx9math.inl(987
) : fatal error C1903: unable to recover from previous error(s); stopping compil
ation
How can we take advantage of the DEBUG_NEW capability and also get around these errors?
BRC
|
|
|
|
|
Defining DEBUG_NEW after any included header files has always worked for me.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Ok - I'll try that. We wanted to define the DEBUG_NEW option in a general header file, but we will include it later on.
|
|
|
|
|
hi all
i am making mfc activex control. i want to assign short cut keys to buttons placed on dialog box.
pls help me what should i do
thanx
ggggggggggg
|
|
|
|
|
maulesh bhojani wrote: i want to assign short cut keys to buttons placed on dialog box.
Are you referring to mnemonics?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
no. i m new to MFC if possible describe the same.
thanx
mbho
|
|
|
|
|
Then I'm a bit confused as to what you are after.
Keyboard shortcuts
Accelerator table
Keyboard mnemonics
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi all,
When "ESC" key Or "ENTER" key is pressed on the dialog, the dialog box is closed. What do i do to prevent this from happening.
I want to force the user to press the close button on my dialog to close the application.
Thanks a lot for all the help extended to me by taking all the trouble away from me.
|
|
|
|
|
wajape wrote: What do i do to prevent this from happening.
Read the FAQ.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You can insert a button to dialog and then use of OnOK() or OnCancel() for exit.
|
|
|
|
|
You have to write the following in the dialog class (say CMyDlg):
void OnOK() { }<br />
void OnCancel() { }
Also have to map WM_CLOSE and in the mapped function do the following:
void CMyDlg::OnClose()<br />
{<br />
EndDialog( 0 );<br />
}
- NS -
|
|
|
|
|
Does anybody know by chance how to change the file attributes of a shortcut in a folder? CFile::Get/SetStatus and GetFileAttributes/SetFileAttributes don't work.
Thanks in advance
MS
|
|
|
|
|
Manfred Staiger wrote: CFile::Get/SetStatus and GetFileAttributes/SetFileAttributes don't work.
Why not? What are they (not) doing?
This works fine for a shortcut that is on my desktop:
void main( void )
{
char szFile[] = "...\\Desktop\\Survivor.url";
SetFileAttributes(szFile, GetFileAttributes(szFile) | FILE_ATTRIBUTE_READONLY);
}
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It works!
I didn't respect that the windows explorer hides the file extension .lnk even if you haven't checked the "hide file extensions" property. So I simply passed the incomplete filename to SetFileAttributes.
Anyway, thank you for responding.
MS
|
|
|
|
|
Hello Friends,
I m back with another probelm. I need the call the Windows procedure(WindowProc) of class MainFrame.cpp from the file FileChangeNotification.h(another file). ya ya ya !!! I know I have to use SendMessage() Function to call WindowProc. But for that i need the handle of that MainFrame Class from MainFram.cpp.
So please Tell me how to get the handle of that class in another window.
|
|
|
|
|
Use AfxGetMainWnd .
Prasad
MS MVP - VC++
|
|
|
|