|
Oriocat wrote:
...don't know ehre to find Gdiplus.dll.
Have you looked for it? On my machine, it's in the c:\winnt\system32 folder.
Oriocat wrote:
i can't recompile the source...
Which tells us nothing. What compiler/linker errors are you getting? What do the lines in error look like?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Oriocat wrote:
also i can't recompile the source which i'm not sure why
I am almost certain you need a compiler for that.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
1. How can I drag my dialog when draging over a certain portion of the dialog??? When I'm using:
UINT CNBinderDlg::OnNcHitTest(CPoint point)
{
UINT ret = CDialog::OnNcHitTest(point);
if(ret == HTCLIENT)
{
return HTCAPTION;
}
return ret;
}
I can drag the window by draging anywhere in the window.
2. Is it posible to hide or lock a directory, not only in explorer(with ".{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}") but in other file managers like TotalCommander too??? Thanx!
|
|
|
|
|
1. Easily.
As you can see in the WM_NCHITTEST message handler, you receive a CPoint object that specifies the point, in screen coordinates, where the hit test was made. If you first use ScreenToClient function to convert the CPoint into client coordinates then you can compare the coordinates to a pre-made list of where the function should return HTCAPTION . Everywhere where HTCAPTION is returned, the dialog becomes draggable.
Thus, if, for example, the x-coordinate of the CPoint is smaller than a half of the dialog's width, then you return HTCLIENT . Otherwise you return HTCAPTION . As a result, when you click and hold on the right-most half of your dialog, it can be dragged.
2. Some advanced file managers by-pass the security settings placed in the registry. To go around this, you could try the _access and _waccess functions of the Run-Time C Library. Not sure if they work though...
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
...you could try the _access and _waccess functions...
These are "get" functions not "set" functions, or did I miss your intent?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
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)
|
|
|
|