|
Taka Muraoka wrote:
I'm virtually certain there's an utterly obscure rule floating around in the spec somewhere: if a function returns a temporary object into a reference variable, that temporary object must stay alive for as long as the reference variable does
There quite possibly is. I don't remember seeing it, but that doesn't mean it's not there . I still think it's dangerous and shouldn't be relied on.
Taka Muraoka wrote:
I remember studying some funky magic written by one of those C++ gurus and he was relying on this behaviour.
The only reason I can see for doing this is to prevent a potentially time-consuming copy of a large object. In this case, though, I'd see it as more intuitive to return a pointer to a new'd object that would then need to be deleted when finished with. It's much easier for a maintenance programmer to see what's going on, even if it might be slightly less safe.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi,
for my evc++ project (runs in WINCE Emulator) which meant for a device , i hav to
display some chars like ▲▼ and left , right arrows in a edit box/ label reading from file.
i am just saving this symbols with some text in a unicode file.while
reading it is read as '?' and i am unable to display those symbols in a
edit box / static text .those symbols are just displayed as some garbage symbols ie box symbol always .
i am using CFile obj for reading from file and using setdlgitemtext method to display it ,CString obj i use to store text.
any project settings need to be changed to display unicode chars? or any conversion has to be made before displaying in wince emulator?
it will be very helpful to me if anybody can help in this regard.
expecting a reply,
R.soodamani
|
|
|
|
|
Hello:
How can Profile the ISAPI Filter in VC.NET?
I'm able to Profile ISAPI DLL in Visual C++ 6.
Thanks
|
|
|
|
|
I have a MDI application when it is created the memory occupied for that application in task manager is around 2000K i open some document in that MDI application, the usage of memory grows up. Now i minimize the main frame window and i notice in task manager the memory is decreased to around 1000K.
I think the resouces which were not used are released when the mainframe is minimized.
Please let me know if anybody knows....
Which function is called when the mainframe is minimized?
How the resources are released when it is minimized?
vidya
|
|
|
|
|
What you are seeing is probably the result of RAM being swapped to disk (i.e., virtual memory). This is SOP with Windows.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How to use VC++ with MsWord.olb to create a table in a *.doc?
|
|
|
|
|
Hi,
I have been asked to possibly make modifications/tweaks to a program my colleague made about a year ago. It is all written in MFC etc... He was good at that and more importantly is no longer working for us, I am not good at it, never done it, never had the time As I was always busy writing C programs for diverse platforms. As I try to compile his software everything works except for it does not recognise a "CFileHeader" data type. Logically I would think this needs to be defined in some header file somewhere. However, I cannot find it anywhere. Can anybody tell me where this needs to be defined and where i can find/introduce the definition ??
Any help much appreciated.
Filip
|
|
|
|
|
A 'brief' search of April 2004 MSDN did not bring up anything on the CFileHeader.
I think you have a source and/or header file missing from your project.
Use the 'Find in Files' menu command from Visual Studio to look for CFileHeader in the INL, H, and HPP files of your project. Then #include that file into the source file using the CFileHeader.
You might also want to make sure you have the CPP file with the CFileHeader as part of the project, or you will end up with link errors.
|
|
|
|
|
Hi,
Thanks for your help, much appreciated. In the mean time I have found the required header file etc... It is part of a zip/unzip utility that was published on codeproject. Having located that one in a backup we had I have made some progress. However, now there is some other weird error message. I now suppose that my colleague had set up his machine/project in a particular way and did not mention that when he left. I guess we probably still have all the files and I will just have to figure it out the hard way. Still, as said before, your help is much appreciated.
All for now,
Filip
|
|
|
|
|
Hi,
I want to a MFC date time control which can take milliseconds, seconds, minutes & hrs into consideration. I am aware of only CDateTimeCtrl in vc++, but this cannot take milliseconds. I also need to extract time from such a control and do <,>,== comparisions. Can anyone please help me?
Thanks
Madhavi
|
|
|
|
|
|
Thanks for the inputs.
CTime does not take milliseconds..am I right? Anyway I will take a look at the other classes which you have mentioned.
madhavi
|
|
|
|
|
You are right, CTime does not have milliseconds.
ARSALAN MALIK
|
|
|
|
|
Hi,
I want to a MFC date time control which can take milliseconds, seconds, minutes & hrs into consideration. I am aware of only CDateTimeCtrl in vc++, but this cannot take milliseconds. I also need to extract time from such a control and do <,>,== comparisions. Can anyone please help me?
Thnaks
Madhavi
|
|
|
|
|
Hello Friends,
Is it possible to create a windowsNT/2000 services without threads.The problem I am facing is that i cant set a timer inside a service.
Is there any workaround for this prob?
regards,
John
|
|
|
|
|
Yeah,
if you don't mind i have a suggestion use Waitforsingleobject api inside the thread for wait for event which would set it self every time timer message arrived for example-->
your thread ->
void thread(lpvoid p)
{
while(1)
{
WaitForSingleObject(event);
----
your functioning
-------
-
--
}
}
and
OnTimer(UINT nIdEvent)//timer function
{
SetEvent(event);
}
simple and consise way for creating service
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I want to know:
There is any free compiler under windows for c++?
And, there is any free graphical develop under windows too?
Elfo,thanks
|
|
|
|
|
GCC+Eclipse?
I have not used either, but have heard it is not bad, and can work together.
Igor Green
http://www.grigsoft.com
Compare It! + Synchronize It! : Files and folders comparison never was easier!
|
|
|
|
|
yeah ther are two compiler i caome across
->DevShed C++ compiler
--> GNU compiler
or serach http://www.cpp-home.com for compiler
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi,
The Microsoft Visual C++ compiler is available for free and can be downloaded at:
http://msdn.microsoft.com/visualc/vctoolkit2003/
A preview of the upcoming Visual C++ 2005, coming with a complete graphical IDE can be gotten at:
http://lab.msdn.microsoft.com/express/visualc/default.aspx
Cheers.
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|
|
You can download the MS Visual C++ 2003 toolkit from microsoft here[^]. It's free, and includes the same C++ compiler distributed with Visual Studio 2003.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
GCC comes in two versions for windows, cygwin, and mingw.
http://www.cygwin.com/
http://www.mingw.org/
I've used the latter, though not much. Either will work, check them both out as there are differences that might matter to you.
By "free graphical develop" what do you mean?
|
|
|
|
|
Hey guys...How would I go about writing this in the .cpp file?
MOSTLY THE BOOL METHODS I AM HAVING TROUBLE WITH
This is what I have for the Menu.h file
#ifndef CONNECTFOUR_H
#define CONNECTFOUR_H
#include "Menu.h"//includes Menu header file
using namespace std;
class ConnectFour
{
private:
//date members
int board[12][13];
int numChips[7];
public:
ConnectFour();
//default constructor
bool playTurn();
/*gives a player the opportunity to place a chip into the board. This should be a Boolean function to return true if this turn produces a winner (otherwise false should be the return value).*/
void displayBoard();
/*places 2 different kinds of markers on the board (one for each player) and displays some kind of marker for empty slots. Be sure your choices are easy to see.
*/
void dropChip();
//places a chip into the board and looks for a winner
void checkWinner();
//should call 4 helper functions (you choose the names) to check the 4 possible winning moves – 4 in a row vertically, horizontally, or diagonally. These helper functions should look only at possible wins produced by this last move – they should not check the entire board!
void verticalwin();
//this method checks to see if 4 colors match to win the game vertically
void horizontalwin();
//this method checks to see if 4 colors match to win the game horizonatally
void diagonalwin1();
//this method checks to see if 4 colors match to win the game diagonally one way
void diagonalwin2();
//this method checks to see if 4 colors match to win the game diagonally the second way
bool determineDraw();
//method determines if the game is a draw (full board with no winner). This method returns true if the game is a draw and false if not.
};
#endif //ends ConnectFour.h
All I have left for my ConnectFour.cpp is ...
#include <iostream>
#include <string>
#include "ConnectFour.h"//includes ConnectFour header file
//default constructor will initialize zero to the data private members (variables)
ConnectFour::ConnectFour()
{
board[12][13] = 0;
numChips[7] = 0;
for(int i=0; i < 12; i++)
{
for(int j=0; j<13; j++)
{
board[i][j] = 0;
}
}
for(int i=0; i<7; i++)
{
numChips[i]= 0;
}
}
bool ConnectFour::playTurn()
{
}
|
|
|
|
|
You have to return a value in the bool-Method.
return true;
Hardy.
|
|
|
|
|
Hello,
void verticalwin();
void horizontalwin();
void diagonalwin1();
void diagonalwin2();
I think these functions should also return boolean datatypes, like determineDraw function.
If you will do this, you can just check if any of these functions returned a true value. And hence, determine if there has been a winner.
maybe like this:
bool ConnectFour::playTurn()
{
// TODO:
// Get the column input here
return (verticalwin() || horizontalwin() || diagonalwin1() || diagonalwin2());
}
|
|
|
|