|
I'm sorry, but no-one in this office can figure out what you want. I presume you want to double click on a word to select it, but we cannot guess what you want to block this word *from*, or how or why you want to do this. Please provide some more information regarding your thought processes here.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
how can I change ip address with vc?
|
|
|
|
|
http://www.codeproject.com/internet/nwset.asp
--------------------------------------------------
If my messages appear curt, I apologize.
I try to be brief to save your time as well as mine.
--------------------------------------------------
|
|
|
|
|
For the life of me I can't get this function to not crash my program.
CTime somecoolvariablename, anothercoolvariablename;
somecoolvariablename.GetCurrentTime();
// do something
anothercoolvariablename.GetCurrentTime();
if(anothercoolvariablename.GetSecond() - somecoolvariablename.GetSecond() > 10) // CRASH HERE!
MessageBox(yadda yadda yadda);
I've tried it in as many contexts as possible, it always crashes. I tried using CTimeSpan, it doesn't wanna work for me either!
CTimeSpan supervar;
// do something
if(supervar.GetTotalSeconds() > 10)
MessageBox(yadda yadda yadda);
I must be missing something simple....
- John
|
|
|
|
|
I think that CTime has a habit of crashing. I faced a lot of problem due to this. Use COleDateTime instead and it has nearly the same function.
|
|
|
|
|
The problem come from the fact that you're using GetCurrentTime() in the wrong way; it is a static function that returns a CTime object filled with the current time.
Therefore, the following code should work:
CTime somecoolvariablename, anothercoolvariablename;
somecoolvariablename = CTime::GetCurrentTime();
// do some work
anothercoolvariablename = CTime::GetCurrentTime();
if(anothercoolvariablename.GetSecond() - somecoolvariablename.GetSecond() > 10) // CRASH HERE!
MessageBox(yadda yadda yadda);
|
|
|
|
|
I need have my controlling thread function for a second thread as a member function of a class. From what I've found out, this means that the function must be declared staticly. There was a good discussion about this previosly HERE. However what I need, is to be able to access the class's non-static member variables, which the above linked topic discusses, but does not provide a solution. Is this possible?
|
|
|
|
|
Well, yes - the usual trick is to pass a pointer to the class as the LPVOID parameter of the threadproc function. Then, inside your class, you can cast it as a pointer to the class and you have access. Kind of like making calls with an explicit this pointer, but it works.
|
|
|
|
|
|
Usually I implement it as follows:
class CMyClass
{
static UINT _MyThread( LPVOID pParam )
void MyThread();
void StartThread();
};
UINT CMyClass::_MyThread( LPVOID pParam )
{
reinterpret_cast<CMyClass*>(pParam)->MyThread();
return 0;
}
void CMyClass::MyThread()
{
}
void CMyClass::StartThread()
{
AfxBeginThread( _MyThread, reinterpret_cast<void*>(this) );
} Regards,
Thomas
I am a signature virus!
Help me spread and copy me to your sig!
|
|
|
|
|
Where can I find the C++ source code (MFC or ATL) of an ActiveX control that supports OLE Drag and Drog?
|
|
|
|
|
I am writing an application that makes extensive
use of an unlimited undo / redo mechanism, and I've also added the ability for my users to delete files off the hard drive through my gui. I am using the following code to delete a file and send it to the
recycling bin:
SHFILEOPSTRUCT OpInfo;
OpInfo.hwnd = ::AfxGetMainWnd()->m_hWnd;
OpInfo.wFunc = FO_DELETE;
OpInfo.pFrom = FilenameStringRaw;
OpInfo.pTo = NULL;
OpInfo.fFlags = FOF_ALLOWUNDO | FOF_FILESONLY | FOF_NOCONFIRMATION |
FOF_SILENT | FOF_NOERRORUI;
int result = ::SHFileOperation(&OpInfo);
MHogDeleteArray(&FilenameStringRaw);
Now that all works fine. The problem is---how do I let the user UNDO the
delete programmatically? The flag FOF_ALLOWUNDO suggests that this
should be possible, but I can't figure out how. Been looking everywhere.
Thanks.
Matus
====================================
Check out Aephid Photokeeper, the POWERFUL digital
photo album solution at http://www.aephid.com
|
|
|
|
|
http://www.msdn.microsoft.com/msdnmag/issues/01/04/c/c0104.asp
Good Luck.
Carlos Antollini.
|
|
|
|
|
Thanks, but unfortunately, this msdn article does exactly what I've already done...
I know how to send files to the recycling bin no problem, but I'm still clueless how to get them BACK.
I've found the SHGetSpecialFolderLocation() api function, which I was hoping that perhaps, by specifying CSIDL_BITBUCKET as the nFolder parameter, I would be able to get a path to the hidden recycling bin directory. But even if I could access it, how would I know what the name of the file was after it was deleted? (I'm sure Microsoft renames it so that you can delete files with the same name and still recover them.)
this sucks.
swine
|
|
|
|
|
Hi,
I have a doubt, though it might seem silly to many. But, please help.
My doubt is in the following code
class Base
{
protected:
int i;
public:
Base(){ printf("Base Constructor\n");}
void MyPrint(){ printf("Value of i(Base) = %d",i); }
};
class Derv: public Base
{
public:
Derv(){ i = 20; }
};
//a global function
void GlobalPrint(Base objB) { objB.MyPrint(); }
void main()
{
Derv Objd;
Base Objb = Objd;
ObjB.MyPrint(); // in this case what happens is that the base class version of MyPrint is called. But the value of "i" is a junk
}
// but if my main is something like this
void main()
{
Derv Objd;
GlobalPrint(Objd); // in this case the base class verion of MyPrint is called inside the
// global function. but the value of i is 20.
}
Can u please explain whats happening. I thought in the first implmentation also an implicit conversion should take place and value of i should be 20. But its not. So please help me
Regards,
Ganesh.M.Ramaswamy
|
|
|
|
|
I have tried this with my VC++ 6.0 compiler and it works just fine!
I see no difference between the two secnarios! In each case you're using the copy constructor to instatiate the objects, even in your GlobalPrint function, the object is being passed by value and this implies that a new object is being constructed using the copy ctor. And the Copy Ctor is the default provided by the compiler!
Check your code... maybe you have something else that is causing the problem!
|
|
|
|
|
Does anybody know how to fix this error in Visual C++? I'm getting it on one of my functions in the class view. The function implementation exists and is in the header obviously. I tried rebuilding the class wizard file in hopes it would reassociate but it didn't work. It was working for a while then just stopped. Thanks for the help.
Jamie
|
|
|
|
|
There r two problem due to which I faced the same issues. First is that the Visual C++ compiler sometimes deletes the CPP file from the back.
Another is that in the funcion above there can be an extra closing bracket which causes the Wizard not to get the function.
Third problem can occur due to the type of parameters. That I can hopefully tell if I see the code.
|
|
|
|
|
I often play the game "Quake3". When I looked at the game-files I saw that there were also normal *.c files
here a piece of code from one of these files:
[code]
//===========================================================================
#include "game.h"
#include "match.h"
//entered the game message
MTCONTEXT_ENTERGAME
{
//enter game message
NETNAME, " entered the game" = (MSG_ENTERGAME, 0);
} //end MTCONTEXT_ENTERGAME
//initial team command chat messages
MTCONTEXT_INITIALTEAMCHAT
{
//help someone (and meet at the rendezvous point)
"(", NETNAME, ")", PLACE, ": help "|" meet ", TEAMMATE, " near "|" at ", "the "|"checkpoint "|"waypoint "|"", ITEM = (MSG_HELP, ST_NEARITEM);
[/code]
these files seem to be loaded at runtime by quake3.
Now my question?
How is it possible to load source-files at runtime and execute their code?
thanks in advance
|
|
|
|
|
To do this would require that the destination machine has a C++ compiler available to it. This Quake file looks to me like a data file, which is a different kettle of fish entirely.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Carmack (the creator of Quake3) took LCC (a free open source C compiler) and used it as the base of an interpreter. The game code is loaded at startup and runs interpreted inside of a virtual machine inside of Quake3. It's a lot like Java but using C as the starting point. I think Carmack said it incurrs about a 10% performance hit which is acceptable and allows Quake3 to be ported easily to multiple platforms. Since the game logic is portable you can write a mod for the PC version and it will work automatically on Mac and Linux. This also allows him to exclude a lot of stuff from the language like access to local files on your PC. The game code runs in a sort of sand box with limited system interaction. You can also take the game logic code and compile it nativly on each system. For the PC you'd end up with a .DLL that's loaded at run time. You can get back your 10% speed drop this way but of course the DLL isn't portable to other platforms.
If you hunt down his .plan files you can read all about it.
|
|
|
|
|
Thanks for the detailed answer.
does it mean that these files are being compiled during gameplay with lcc?
Where can I find the .plan-files you mentioned?
How difficult do you think is it to realize something comparable in my own apps?
thanks
|
|
|
|
|
MFC code (or Win32 code that works in MFC) that checks if there is a CD-ROM installed!
/*
BETA
*/
|
|
|
|
|
Move through all drives and call the win32 function GetDriveType(DRIVE_CDROM) on each drive.
This should work.
Gero Gerber
|
|
|
|
|
DWORD dwDriveMask = GetLogicalDrives();
char szDir[4];
szDir[1] = TEXT(':');
szDir[2] = TEXT('\\');
szDir[3] = 0;
/* enumerate all logical, fixed drives */
for(int i=0; i<max_drives; dwdrivemask="">>= 1, i++)
{
// if logical drive exists
if (dwDriveMask & 0x01)
{
szDir[0] = TEXT('A') + i;
if (GetDriveType(szDir) == DRIVE_CDROM)
{
//do whatever you like to do
}
}
}
|
|
|
|