|
Your code should have double mWeight = mEngine.GetWeight(); instead. You call a class member funnction through an object of that class, not by the class name.
|
|
|
|
|
badbirdchung wrote:
how can I call engine GetWeight() function or get the engine mWeight result at car.cpp file?
Have you declared an instance of Engine in your Car class's header file?
#include "Engine.h"
class Car
{
[...]
Engine m_engine;
[...]
};
Then in your Car 's C++ implentation file, you can call member functions of your "m_engine " instance whenever you need it. For instance:
m_engine.GetWeight();
I hope this clearifies things for you.
Happy Programming and may God Bless!
"Your coding practices might be buggy, but your code is always right."
Internet::WWW::CodeProject::bneacetp
N-Tech Productions
http://www.n-tp.com/
|
|
|
|
|
how to write text to RichEdit line by line.
for example
...
WriteText("line1\r\n");
...
...
WriteText("line2\r\n");
...
...
WriteText("line2\r\n");
...
I tried SetWindowText(), but it CLEARS the existing text and writes the text at the first line.
|
|
|
|
|
use the member function CEdit::ReplaceSel(LPCTSTR str) . know that CRichEdit inherits from the CEdit class, that's allowed
TOXCCT >>> GEII power
|
|
|
|
|
HI,
1 - How can i detect the that on which path Program Files Folder is ???
2- and how can i find path of specific folder
thanx
Regards.
|
|
|
|
|
About your first question.
You can read the ProgramFilesDir value at:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
in Registry. Then you will obtain the current path of the Program Files Folder in the system.
You can use RegOpenKey and RegQueryValueEx Windows API functions to read the path from the Registry.
|
|
|
|
|
HI,
How can i detect the that on which path Program Files Folder is ???
thanx
Regards.
|
|
|
|
|
ShGetSpeacialFolderPath ,ShGetFolderPath api will help you in above cause
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Well you can read from regedit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
"ProgramFilesDir"
That value is on every OS.
|
|
|
|
|
Absolutely not. Use the APIs for getting folder paths, they were written to insulate programs from changes in where the OS keeps folder paths (who knows where they're going to be held in Longhorn, for example...)
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
When I convert mp3 to ogg files on the command promt I use a pipe like this:
"lame --decode abc.mp3 - | oggenc -o abcogg -"
I can't use a regular ShellEx function to do this in a program of my own; because the pipe will be sent as an argument to lame. How do I do this. I've tried starting two processes and redirecting their output and input, but I can't make it work.
|
|
|
|
|
Maybe the simplest way is to issue this command via the system function.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
What do you mean by the system function?
|
|
|
|
|
A function called system which is available by including the <stdlib.h> header.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
HI,
Wt are smart pointers and y we use them ?
thanx
Regards.
|
|
|
|
|
Hello Zahid,
Smart Pointers are actually objects which wrap around actual memory pointers. These memory pointers usually point to objects which are reference counted.
Smart Pointers are usually bound to these object pointers on construction. During construction, a smart pointer would usually increment the reference count of the pointed-to object. For example
SmartPtr(Interface *& pInterface) :
m_pInterface(pInterface)
{
if (m_pInterface)
{
m_pInterface -> AddRef();
}
}
During destruction, the smart pointer will usually decrement the reference count of pointed-to object. For example :
~SmartPtr()
{
if (m_pInterface)
{
m_pInterface -> Release();
m_pInterface = 0;
}
}
Smart Pointers can also increase the ref count of their internal object pointers when they are assigned to another object. For example :
// Copies and AddRef()'s the interface.
//
SmartPtr& operator=(const SmartPtr& copypointer) throw()
{
if (operator!=(copypointer))
{
Interface* pOldInterface = m_pInterface;
m_pInterface = copypointer.m_pInterface;
if (m_pInterface)
{
m_pInterface -> AddRef();
}
if (pOldInterface)
{
pOldInterface -> Release();
pOldInterface = NULL;
}
}
return *this;
}
It is this automated reference increment and decrement feature of smart pointer objects that make them most useful for keeping the reference count of COM objects (through their interface pointers).
To properly keep track of COM objects (via their interface pointers), AddRef() and Release() calls must tally. Otherwise there will be reference undercount (leading to crashes) and reference overcount (leading to memory leaks). This is precisely what Smart Pointers are designed to overcome.
There are many more useful functionalities behind Smart Pointers. Lookup the definition of _com_ptr_t in MSDN.
Regards,
Bio.
|
|
|
|
|
|
There are methods to change the pointer shape, why not just create a one pixel mouse pointer and use that ?
Elaine
The tigress is here
|
|
|
|
|
Use the ShowCursor function. Despite its name, it can hide and show the cursor.
|
|
|
|
|
Handle WM_SETCURSOR for the window and call SetCursor(NULL).
...cmk
Save the whales - collect the whole set
|
|
|
|
|
You can use the ShowCursor Windows API function to show and hide the mouse pointer.
|
|
|
|
|
Hi All,
I wanted to know how to display the tooltips for the contents of the CListBox.
The length of the strings that are inserted into the CListBox is larger than the width of the CListBox.For such strings I want to display a tooltip text containing the full string when user places the cursor on them.Can someone tell me how to realize this.
I want to implement something like the tooltips displayed for CTreeView when the contents of the node does not fit the window.
Thanks in advance
Regards
Raghu
|
|
|
|
|
|
I'm new to using the WinInet APIs and I'm stuck on something. If I request a bogus URL with HttpOpenRequest() and HttpSendRequest() , some servers will return HTML in response to the 404 error (example). The trouble is that the above two APIs will succeed because data is returned. Calling HttpQueryInfo() with the HTTP_QUERY_STATUS_CODE returns a code of 0, not 404.
So, the question is how can I tell when an HTTP error actually happens?
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
Hi, I am doing image processing and need to manipulate the pixels of the bitmap. Thus, I need to read the pixel from the bitmap to a 2D array. Is there any way to do this? Or is there any library that do that for me?
|
|
|
|