|
Try to override CDialog::OnCancel().
Something like
void CMyDialog::OnCancel() { return;}
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
It works well after I do as your directions.
|
|
|
|
|
I am glad that it works well. I would also consider kmaz's directions as well even though I have never tried (or for that matter of fact heard that approach [then again, I have a lot to learn]). But it sounds very interesting and probably is worth to try it.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
It seems very difficult
If by overriding the function, I want to do like below:
bool m_bEsc;
void CAbc::OnCancel()
{
if( !m_bEsc)
return;
else
CDialog::OnCancel();
}
bool A()//Some operations to keybord's actions
{
....
}
Do you think that can work well?
|
|
|
|
|
Aleon666 wrote:
bool m_bEsc;
void CAbc::OnCancel()
{
if( !m_bEsc)
return;
else
CDialog::OnCancel();
}
bool A()//Some operations to keybord's actions
{
....
}
I don't see a reason why that would not work. Somebody else correct me please if I am wrong. But you have to try it yourself.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Aleon666 wrote:
Do you think that can work well?
Yep. No problems
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
I would create an accelorator, which would disable the esc key and let you give other key combos functions.
|
|
|
|
|
I am sorry
I don't understand "and let you give other key combos functions"
What's that meaning?
Can you tell me?
|
|
|
|
|
Aleon666 wrote:
I don't understand "and let you give other key combos functions"
What's that meaning?
He means that using an accelerator, you can make other key-combinations perform other operations, as well as preventing the dialog from closing. However, Toni78's solution is the best and easiest one.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
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"
|
|
|
|
|
|
In the psapi.lib, the function getProcessMemoryInfo() returns a PROCESS_MEMORY_COUNTERS struct.I urgently want to know whether PROCESS_MEMORY_COUNTERS.WorkingSetSize can directly indicate the size of memory a process currently occupies.If it can, the value returned is KB,OR B? If it cannot, how can I get the size of memory a process currently occupies?
I am in emergency and long for any help!Thanks!
|
|
|
|
|
WorkingSetSize should be the size of the process that is loaded in RAM in bytes.
John
|
|
|
|
|
i implement multi selection with the help of source code on internet,but i can't do drag drop. it never triggers OnBeginDrag,why?
|
|
|
|
|
I want to add a bitmap as a background to the main Window of SDI document. Can anybody help me what to do? I am really in emergency. I will really appreciate help.
Parvez Pathan
|
|
|
|
|
Draw the bitmap first in your OnDraw method of your view. Then, draw the rest of your view. You may have to pDC->SetBkMode(TRANSPARENT) to prevent your drawing from hiding the bitmap.
onwards and upwards...
|
|
|
|
|
Can u please provide me the code . I am really not an expert in VC++. That will be really helpful.
|
|
|
|
|
I'm trying to make a Help app that is linked to an already funtioning C++ program. The problem I seem to have is that if I change the text of AfxCore.rtf it has an error pop-up when I load the workspace. I have no experience with making a Help app and I'm the one assigned to figure it out. I'f anybody knows what goes on in MSVC++ when it comes to making a Help app, then please help me. The MSDN tutorial is horrid, I can't make heads or tails of it.
|
|
|
|
|
Have a look at this website [^] and if that doesn't help, run a search on google on help file tutorials. That's how I learned how to write help file. Hopefully, it will work for you too. It is not difficult at all. You just have to learn what kind of symbols to insert when you create footnotes.
I have a few tutorials and if you can't find anything, give me your email address and I will email them to you. But I have to go through my CDs and find them first.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I am reading "Windows Graphics Programming", by Feng Yuan, and in the beginning he writes his own custom Window class to demonstrate a number of code techniques. It's C++, and looks a lot like the classic style of Petzold (I'm sure many of you are familiar with Petzold). Anyway, he writes two Windows Procedures for his class, one virtual and one static, (this is kind of confusing) so that the Windows system will dispatch messages to the correct message handler (he subclasses his child windows from this class).
Anyway, forget all that, my question is about something else entirely. In his header file for this custom window class, he lists the usual function calls you would make: the two Windows Procedures, constructor(void), destructor, Create, RegisterClass, and sets up the default message loop. Then, and this is what I don't understand, he does this:
BOOL ShowWindow(int nCmdShow) const<br />
{<br />
return ::ShowWindow(m_hWnd, nCmdShow); <br />
}<br />
<br />
BOOL UpdateWindow(void) const<br />
{ <br />
return ::UpdateWindow(m_hWnd);<br />
}<br />
What exactly do those return statements do?
Oh, sorry, m_hWnd is the handle to the Window(type HWND). In his constructor, he does this:
KWindow(void)
{<br />
m_hWnd = NULL; <br />
}
|
|
|
|
|
I assume this isn't MFC related code. He is wrapping global Windows API functions as functions within his class. The :: in ::ShowWindow() means call the global function, not one in a class. By wrapping these functions he doesn't need to a) use ::FuncName everywhere and b) doesn't need to pass m_hWnd as the wrapped function does this for him.
Hope that helps.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville,
Thanks for the response. And, yes, it is non-MFC code.
The ShowWindow and UpdateWindow calls are standard Win32 functions, I recognize the same calls from Petzold.
But, what I don't understand is: Why return anything? Typically, when creating a window, you just write the same code as above, but without a return statement. I'm thinking that he intends to make the two variables (the HWND and the int type) available for some other potential action, I don't know what.
I realize that it's an insignificant issue, but, his return statements are often of this style (and he never returns a this*). Weird.
|
|
|
|
|
Hi NB,
From the ShowWindow() docs:
Return Values
If the window was previously visible, the return value is nonzero.
If the window was previously hidden, the return value is zero.
And for UpdateWindow()
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Windows NT: To get extended error information, callGetLastError.
So returning the same value as the wrapped function makes perfect sense to me.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
2 questions about VC++:
first, when I close VC++ and then reopen an MFC project in VC++, my resources file is gone...where did it go. I clicked on the .dsw to open my workspace but the resource folder doesn't even show up.
second, I get the following message in my debug window:
"fatal error LNK1104: cannot open file "nafxcwd.lib""
It appears that my library is not linked properly, no? How do I remedy this problem?
tanks much, Dave
|
|
|
|
|
From Michael Dunn's C++ Forum FAQ:
2.8: Why do I get an unresolved external on nafxcw.lib or uafxcw.lib? (top)
The files nafx*.lib and uafx*.lib are the static LIB versions of MFC. The files beginning with "n" are the ANSI version, and the files beginning with "u" are the Unicode version. By default, only the ANSI files are installed on your hard drive. If the linker cannot find these LIB files, copy them from your Visual C++ CD to your <vcdir>\vc98\mfc\lib directory.
If those files are not on your CD, then you have an edition of Visual C++ that does not support static linking to MFC. You will need to change your project settings to use the DLL version of MFC. Click Project->Settings and go the General tab. In the Microsoft Foundation Classes combo box, select Use MFC in a Shared DLL.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thanks...I'm glad you showed me the fax area...lots of good stuff.
|
|
|
|