|
I have this MFC app. where I have some dialogs, with some controls in. Nothing new there
But, I also have selected "Context Help" and have this little "?" in the corner of every dialog, but when I click the "?" and then click on a control, I can see in the help workshop that it's the dialogs help-id that's called, and not the controls help-id
Anybody knows how I get my app to call the controls help-id instead. I want popup-help for every control, not a general help for the dialog...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
You need to handle MFC-defined WM_HELPINFO message - that's the place to call WinHelp. The tricky part is that handler gets called for both dialog and control help. So you need also to handle WM_SYSCOMMAND, like this:
void CMyDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if (nID == SC_CONTEXTHELP)
{
m_bContextHelp = TRUE;
}
CDialog::OnSysCommand(nID, lParam);
if (nID == SC_CONTEXTHELP)
{
m_bContextHelp = FALSE;
}
}
m_bContextHelp is a BOOL data member which is tested in OnHelpInfo handler. If you have more than one dialog in your app put this stuff into common base class.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks a lot, I'll give it a try
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I use this function, with no need for OnSyscommand()
BOOL CMyDialog::OnHelpInfo(HELPINFO* pHelpInfo)
{
short state = GetKeyState (VK_F1);
if (state & 0x80)
return CDialog::OnHelpInfo(pHelpInfo);
WinHelp (pHelpInfo->dwContextId, HELP_CONTEXTPOPUP);
return TRUE;
}
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
Testing for F1 being pressed is not enough when you have 'Help' pushbutton on your dialog.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
OnHelpInfo() is not called when you click on the 'Help' button (ID_HELP). (at least in my apps it is not)
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
It depends on how you handle the ID_HELP. I remember that for some reason we had to forward the call to CWinApp (which in turn called OnHelpInfo indirectly) - sorry, no source code at hand, can't be more specific Maybe it was related to help on property pages.
Cheers,
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Nice, thanks
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Do you know any kind of class or something that can put a nice texture
as background (dialog background). I've use the 'CxShadeButton' class (found here on CodeProject)
and want preferably a class of the same button class!
Can you help me!?? OFCOURSE!
/*
BETA
*/
|
|
|
|
|
Just draw it onto the background in your OnPaint handler.
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.
|
|
|
|
|
|
http://codeguru.earthweb.com/dialog/BmpDlg.shtml
There you go, works well.
|
|
|
|
|
I have tried to search scientific way of handling retutn key on many
discussion boards and websites but no use.
I have dialog box with two edit boxes. One edit box accepts number.
When user enters number and hits enter (Carriage Return) key it
should display the corresponding data to entered record number
in another edit box.
Since it is single line edit box the enter key will be grabbed by dialog
box and I have no way to intercept enter.
Then I tried
This
In my Edit Control class I added following...
UINT CQSmartEditCtrl::OnGetDlgCode()
{
UINT code = CEdit::OnGetDlgCode();
code |= DLGC_WANTMESSAGE;
return code;
}// OnGetDlgCode
and
void CQSmartEditCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if(nChar == 13 ) // Return Key
{
AfxMessageBox("Need to Display Data");
}
CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}
But now I don't know how to handle displaying of Data because I need to send
notification to dialog that it is time to display record. How to achieve this.
Also, I have question is there any alternative way to get Return Key from within
edit box which is scientific way
Regards,
Vijay
vijay_khot@hotmail.com
|
|
|
|
|
In OnKeyDown handler call CWnd::GetParent and cast the result to proper type - pointer to your dialog class. Then call appropriate method (the one that displays data) using the pointer.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks Tomas...
It helped me. Now I have one more question
UINT CQSmartEditCtrl::OnGetDlgCode()
{
UINT code = CEdit::OnGetDlgCode();
code |= DLGC_WANTMESSAGE;
return code;
}// OnGetDlgCode
This function is making Edit Ctrl to intercept all messages
including TAB and ESC
How to skip these messages?
Bad judgement gives Good experience;
Good judgement comes with Bad experience
|
|
|
|
|
Win2000 DDK SP1 have two constant in ntddk.h:
- PULONG_PTR (in struct _KDPC for exemple)
- ULONG_PTR
These two constants are unknown and undefine
BUILD ERROR
D:\PROGRAM FILES\NTDDK\INC\DDK\ntddk.h(370) : error C2146: syntax error : missing ';' before identifier 'Lock'
D:\PROGRAM FILES\NTDDK\INC\DDK\ntddk.h(370) : error C2501: 'PULONG_PTR' : missing storage-class or type specifiers
D:\PROGRAM FILES\NTDDK\INC\DDK\ntddk.h(370) : error C2501: 'Lock' : missing storage-class or type specifiers
D:\PROGRAM FILES\NTDDK\INC\DDK\ntddk.h(824) : error C2146: syntax error : missing ';' before identifier 'KSPIN_LOCK'
D:\PROGRAM FILES\NTDDK\INC\DDK\ntddk.h(824) : fatal error C1004: unexpected end of file found
??
i use namespace to include ntddk.h. Help Please
i use visual C++ 6.0 and SP 2 on windows 2000 Pro
|
|
|
|
|
These types are defined in basetsd.h
PULONG_PTR, which is a pointer to a ULONG_PTR.
PULONG_PTR is a pointer that is itself 32 bits for 32-bit Windows and 64 bits for 64-bit Windows. It points to an unsigned integer, ULONG_PTR, that is 32 bits for 32-bit Windows and 64 bits for 64-bit Windows
My copy of this faile is from the platform sdk. so make sure it is part of your project's path.
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
#if ( 501 < __midl )
typedef [public] __int3264 INT_PTR, *PINT_PTR;
typedef [public] unsigned __int3264 UINT_PTR, *PUINT_PTR;
typedef [public] __int3264 LONG_PTR, *PLONG_PTR;
typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR;
#else // midl64
#if defined(_WIN64)
typedef __int64 INT_PTR, *PINT_PTR;
typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
typedef __int64 LONG_PTR, *PLONG_PTR;
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
#define __int3264 __int64
#else
typedef _W64 int INT_PTR, *PINT_PTR;
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
typedef _W64 long LONG_PTR, *PLONG_PTR;
typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR;
#define __int3264 __int32
#endif
#endif // midl64
Hope that helps.
Regards
Alfadhly
<marquee>
It is Illogical to define an inventor by his invention
|
|
|
|
|
hey ... quicky question
in the docs it says one must call CWinApp::HideApplication() before calling CWinApp::CloseAllDocuments() but i don't cos i don't want the app to close ... it seems to work ok but does anyone know if there is some terrible screw up happening down in the depths that just hasn't showed itself yet by not calling CWinApp::HideApplication() first ??
answers / hints appreciated
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
I don't think you're going to screw something without HideApplication - if many your app is MDI and many MDI child windows are open you'll see them closing one by one. Just remember that calling CloseAllDocuments will destroy all docs *without* saving modified content.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
I don't kow how to make for including ntddk.h declared in ntdll.dll. I havn't the file ntddk.h in the path
\\VC98\include\*.*
How to make??
|
|
|
|
|
It's in the Windows NT DDK, according to MSDN.
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.
|
|
|
|
|
Thanks for you little help but if i include ntddk.h i have three errors
d:\program files\ntddk\inc\ddk\ntddk.h(370) : error C2146: syntax error : missing ';' before identifier 'Lock'
d:\program files\ntddk\inc\ddk\ntddk.h(370) : error C2501: 'PULONG_PTR' : missing storage-class or type specifiers
d:\program files\ntddk\inc\ddk\ntddk.h(370) : error C2501: 'Lock' : missing storage-class or type specifiers
Do You know??
And i accept this License Agreement
|
|
|
|
|
Is there a tool or a macro that helps in creating a zipfile of your sourcecode. Often when I post a project to codeproject, there's always a file(s) missing I didn't think of. It would be easy when you create such a zipfile from within Visual Studio.
|
|
|
|
|
...a simple DevStudio add-in!
There's an MFC class somewhere on CP which handles Zip/UnZip, so it wouldn't be too hard to do, methinks.
The only trick would be identify which files to add, and which to leave out (whouldn't be too difficult).
If you want to learn how to write add-ins, this sounds like a good project
Andy Metcalfe - Sonardyne International Ltd (andy.metcalfe@lineone.net) http://www.resorg.co.uk
"I used to be a medieval re-enactor, but I'm (nearly) alright now..."
|
|
|
|
|
I know the MFC Zip/Unzip because I developed an ATL-based version from it : SAWZip. Do you know how to program a DevStudio Add-in?
|
|
|
|