|
you are right DavidCrow. _access and _waccess are get functions. I wan't set functions that hides (locks) folders no matter on what account you are, including administrator. Any ideas anybody?
|
|
|
|
|
I do not know how to do it programmatically.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have a ListCtrl that is being updated with new data, I was planning to use the doubleclick to stop the updating and allow the use to edit two fields in the list, one is decimal the other in Hex. This would be via a right mouse click.
My question is how do you edit these fields in this control. I have only ever used this control to display data (View = report style). So I would like to right-click and see the 2nd and 4th colums in an editable state.
I have set up a control variable for the control but dont know how to use it for editing data items.
Any samples or a few lines of code.
Many thanks,
Sweep
|
|
|
|
|
Pretty simple really you create an edit control dynamically and then size and position it in the area that the list control cell occupies. The user edits the edit control then presses enter which you capture as the [end edit] signal. Then you copy the edit control text into the list control and wherever else you need it and either destroy the edit control or hide it to reuse it later in another cell.
If my memory is correct there are more List Control topic articles on CodeProject than any other single topic. Take a look at them and see if they dont show you how to do that. If not post back here and I will take a shot at it. I have some code laying around somewhere where I did that and more in a list control.
Hate is not a family value.
-pete
|
|
|
|
|
I have an application where I get a message and save a real number entered by a user. This value is stored. The next time the user enters a value I want to compare it to the stored value. If the values are floats I believe they cant be compared due to rounding. Is there a way to make a comparison between to real values?
Thanks.
Jerry
|
|
|
|
|
The answer to this is found in the C++ FAQ at
http://www.parashift.com/c++-faq-lite/
If you read the whole thing you will see why I didn't point out where. I strongly recomend you read the whole thing.
|
|
|
|
|
bool IsEqual(double d1, double d2, double tolerance)
{
return (abs(d1 - d2) < tolerance);
}
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
jerry1211a wrote:
If the values are floats I believe they cant be compared due to rounding.
You are correct.
jerry1211a wrote:
Is there a way to make a comparison between to real values?
Yes. You'll need to decide the level of precision, however. For example:
double dVal1 = 1.245, dVal2 = 1.249;
if (fabs(dVal1 - dVal2) < 0.01)
...
else
... The number of decimal places in the constant must be equal to the number of decimal places being compared in the other two numbers.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How can you get Microsoft Visual C++ version 6.0 to display the time it takes to compile and build a project? I don’t mean the /Bt option, that displays the time taken to compile each individual source file. There’s a way of displaying the time for the whole build. I know there is because I used to do it, but I’ve just reinstalled Visual C++ 6.0 and I can’t remember how I did it before!
|
|
|
|
|
|
Thanks very much for your speedy reply. It didn't seem to work at first, but a web search showed that it's not a project option but an option for the shortcut to msdev.exe . Where did you get this useful information?
|
|
|
|
|
HI!
In my code, I create a document template in the following way:
pDocTemplate = new CMultiDocTemplate(IDR_PHYSEDIT,
RUNTIME_CLASS(CPhysEditDoc),
RUNTIME_CLASS(CPhysEditFrame),
RUNTIME_CLASS(CPhysEditView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
Everything works perfectly, but when the program exits I get
the following output:
e:\work\c++\project\utilities.cpp(117) : {58} client block at 0x003F4B40, subtype c0, 140 bytes long.
a CMultiDocTemplate object at $003F4B40, 140 bytes long
{56} normal block at 0x003F49F8, 78 bytes long.
Data: < 6 = = > D0 0D 36 10 3D 00 00 00 3D 00 00 00 01 00 00 00
My question is: How do I clean up the document template objects on exit? Shouldn't CWinApp do that?
øivind
|
|
|
|
|
dolph_loe wrote:
My question is: How do I clean up the document template objects on exit? Shouldn't CWinApp do that?
You don't. CYourApp will delete the doc template object in its destructor.
Can you set the breakpoint in your app destructor and step into CWinApp::~CWinApp from there?
Tomasz Sowinski -- http://www.shooltz.com
Alika masiaka!
|
|
|
|
|
tnx! had to add the following line
pDocTemplate->m_bAutoDelete = true;
øivind
|
|
|
|
|
Hi All,
I am spawning a process from a service. The spawned process hungs for various reasons, (corrupted data, deadlock). I am expecting the process has to complete the task with in the expected time limit, if it exceeds the limit I want to terminate the process (no mercy or graceful, just terminate the process).
The spawnng of the process, counting the time and termination of process all done in C++. Some time I am not able to terminate the process, the error message was "Access denied". I dont want this also happens. The program has to terminate the process even, the process in any state. How to do that? What security permissions I have to give?
Here is the code snippet of the teminate application,
=========================================================
static DWORD WINAPI TerminateApp( DWORD dwPID, DWORD dwTimeout )
{
HANDLE hProc ;
DWORD dwRet ;
// If we can't open the process with PROCESS_TERMINATE rights,
// then we give up immediately.
hProc = OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE,
dwPID);
if(hProc == NULL)
{
return TA_FAILED ;
}
// TerminateAppEnum() posts WM_CLOSE to all windows whose PID
// matches your process's.
EnumWindows((WNDENUMPROC)TerminateAppEnum, (LPARAM) dwPID) ;
// Wait on the handle. If it signals, great. If it times out,
// then you kill it.
if(WaitForSingleObject(hProc, dwTimeout)!=WAIT_OBJECT_0)
dwRet=(TerminateProcess(hProc,0)?TA_SUCCESS_KILL:TA_FAILED);
else
dwRet = TA_SUCCESS_CLEAN ;
CloseHandle(hProc) ;
return dwRet ;
}
static BOOL CALLBACK TerminateAppEnum( HWND hwnd, LPARAM lParam )
{
DWORD dwID ;
GetWindowThreadProcessId(hwnd, &dwID) ;
if(dwID == (DWORD)lParam)
{
PostMessage(hwnd, WM_CLOSE, 0, 0) ;
}
return TRUE ;
}
=========================================================
All suggestion appreciated.
Thanks
GTS
|
|
|
|
|
GTS2020 wrote:
What security permissions I have to give?
MSDN indicates that the handle must have PROCESS_TERMINATE access.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/terminateprocess.asp
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi David thanks for your reply.
It seems the process went in to a deadlock situation. When I tried with pskill it showed "Access denied" message. I have used the following security flag "PROCESS_ALL_ACCESS" while creating the handle. Even it was not able to terminate the process.
Is there any other way to terminate the process, even whatever state it is?
Thanks
GTS
|
|
|
|
|
GTS2020 wrote:
...the error message was "Access denied".
It's because the process you are trying to terminate is running under the Local System security account, which does not have "debugging" access. See this article for more.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello,
How do I get the handle to the accelerator table loaded by the CFrameWnd ?
The problem is I need to translate hot key messages which occur in different parts of my app (in modeless dialog boxes; in a different thread; ...), but TranslateAccelerator needs an handle to the accelerator table and I don't know how to get it -- and I'm not that keen on overriding CFrameWnd's initialitions either.
Can someone help me out here?
Thanks a lot,
David
|
|
|
|
|
How about using LoadAccelerators()
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Compiler - VC6
I'm working on a project that is an activeX control, and that links to several DLL's. In one of the DLL's, I'm having a problem with CStrings - for some reason, I'm getting an access violation (C0000005) in MFC42D.DLL when I try to pass a CString from one class to another. Both classes are in the DLL I'm working in.
I've tried a number of methods for creating the CString in the calling function,but nothing seems to be working. Is there some sort of bizarre rule concerning CStrings that I'm not aware of?
If anyone can suggest something to check, I'd appreciate hearing about it.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote:
Is there some sort of bizarre rule concerning CStrings that I'm not aware of?
I am aware of no such known restrictions.
John Simmons / outlaw programmer wrote:
If anyone can suggest something to check, I'd appreciate hearing about it.
Memory corruption can produce C0000005 access violation errors in blocks (objects) that are not related to the code responsible for the problem.
Is your CString object on the stack? If it is move the location significantly by placing a large block of memory on the stack right in front of it. Then test for the error again.
char buf[0xffff];
CSstring mystring;
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
i am definitely puzzled by this.
i have a small class hierarchy:
result - abstract base class
burnsResult - abstract, derived from result
002burnsResult - concrete, derived from burnsResult
003burnsResult - concrete, derived from burnsResult
textResult - concrete, derived from result
so far so good. the default copy constructor exists for class textResult, but it does not exist for 002burnsResult or 003burnsResult.
i am getting:
error C2582: 'operator =' function is unavailable in 'file'
the VS .NET 2003 help for this error is nice and clear, the only problem is that the word operator does not exist in any of the .h files defining these classes
so how come there is a default copy constructor for one class, but not the other two?
i don't really want to define my own copy constructor, since there should be no need. i am mainly a C programmer, so perhaps i have overlooked something obvious. anyone got any ideas on why this is happening?
|
|
|
|
|
feline_dracoform wrote:
i am getting:
error C2582: 'operator =' function is unavailable in 'file'
On what line of code?
feline_dracoform wrote:
i don't really want to define my own copy constructor, since there should be no need.
Just because you don't see the need does not mean one does not exist. Copy constructors are almost always a good idea. At the very least, they keep the compiler from making (incorrect) assumptions.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
Copy constructors are almost always a good idea. At the very least, they keep the compiler from making (incorrect) assumptions.
i had made the assumption that using the default copy constructor was a good idea, since this made sure i wouldn't forget to copy one of the member variables of my class.
is this a bad assumption on my part?
|
|
|
|