|
I want draw rectangle in win98, and I use MM_LOMETRIC mode to draw.
I need vc source code
pls help me!!!
|
|
|
|
|
hi:
you can use class CDC 's function
virtual int SetMapMode( int nMapMode );
BOOL Rectangle( int x1, int y1, int x2, int y2 );
|
|
|
|
|
Hi,
Where I can find any documentation about this ActiveX control.
I've searched in MSDN with no results.
When I use it in my VC++ project, the Class Wizard generates a wrapper
class called CRichText. It has a lot of functions which I don't know
how to use. I mean I don't know the parameters format. That's why
I need any type of documentation or reference. Can anybody help
me with that ?
Best Regards!
Yasen
|
|
|
|
|
hi!
Do you refer to rich edit control?if so,you can find help in msdn
by CRichEditCtrl.
|
|
|
|
|
No, I don't refer to CRichEditCtrl, I know how to deal with it. But it is an ActiveX control it is not a CRichEditCtrl. So, I can't find documentation about it
Yasen
|
|
|
|
|
which one's better to use in a unicode application?
i mean if its so easy to use CString why go for stuff that will make the application more complex harder to read and debug
i am all ears to suggestions and views..
|
|
|
|
|
It depends what type of operations you nedd to perform on the strings. If you use MFC anyway, and if you need to manipulate strings like deleting characters, and another size-modifying functions, it's best to use CStrings, you rife will be much easier and you can avoid spme bugs.
But if you just need to pass unmodified strings to another functions, LPTSTR is more efficient.
rrrado
|
|
|
|
|
CString uses TCHAR internally. (LPTSTR)
so if you define _UNICODE, TCHAR is defined as wchar_t so CString is also using unicode
where is the problem?
|
|
|
|
|
I have a single line edit control and a class derived from CEdit. Now I want that the CFormView class which contains the edit control gets informed if the user presses the Return key if the Edit control has the input focus.
I've tried to react on the NM_RETURN notification in my form view but I don't get the event in the form view (must I use reflection in my edit class?).
Then I tried to capture the VK_RETURN key in the OnChar method of my edit class, but the OnChar method seems not to get any VK_RETURN events.
So what would be the best way to get my form view informed if the user presses the return key in my edit control?
Thanks in advance.
|
|
|
|
|
Try to set "Want return" style in resource editor for edit control,
i think NM_RETURN could start working then
rrrado
|
|
|
|
|
No luck, it seems not to work. I've already tried it and it makes no difference. The documentation also says that "Want return" only effects multiline edit controls.
|
|
|
|
|
Subclass the edit control like this:
pOldEditWindowProc = (WNDPROC)::SetWindowLong(hWndEdit, GWL_WNDPROC, (LONG)EditWindowProc);
.
.
.
LRESULT CALLBACK EditWindowProc(HWND aHwnd, UINT aMsg, WPARAM aWp, LPARAM aLp)
{
if(Return was pressed) ::SendMessage(::GetParent(aHwnd), aMsg, aWp, aLp);
return ::CallWindowProc(pOldEditWindowProc, aHwnd, aMsg, aWp, aLp);
}
--
Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so. (Douglas Adams)
|
|
|
|
|
The other way to handle this is in PreTranslateMessage()
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN && GetFocus() == GetDlgItem(ID_OF_CONTROL))
{
// handle it here!
}
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
I have added some additional code, which seems to work now. But I still find it a bit ugly to perform the check in the application class. But that's ugly windows
Would be nice if someone could add feedback, if this code is correct or not, e.g. the
CWinApp::PreTranslateMessage(pMsg); part.
Thanks for your help!
BOOL CMyApp::PreTranslateMessage(MSG* pMsg)
{
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN))
{
HWND hFocus = GetFocus();
CFrameWnd* pFrmWnd = dynamic_cast<cframewnd*>(GetMainWnd()); if (pFrmWnd == NULL)
{
ASSERT(FALSE);
}
CWnd* pTarget = pFrmWnd->GetActiveView()->GetDlgItem(IDC_EDIT_X);
// We should test, if an active view exists, if we are not sure...
HWND hTarget = NULL;
if (pTarget != NULL)
{
hTarget = pTarget->GetSafeHwnd();
}
if (hFocus == hTarget)
{
// Do what you want
}
return 1;
}
else
{
return CWinApp::PreTranslateMessage(pMsg);
}
}
|
|
|
|
|
I would have overridden PreTranslateMessage() in your edit control, and just sent a message to the parent:
BOOL CMyEdit::PreTranslateMessage(MSG *pMsg)
{
if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
{
CWnd *pParent = GetParent();
if(pParent != NULL)
pParent->SendMessage(WM_KEYDOWN, VK_RETURN, pMsg->lParam);
}
else
return CEdit::PreTranslateMessage(pMsg);
}
And then just handle WM_KEYDOWN like normal in the parent and check for Enter being pressed. If you need to handle it in your main frame window, then use AfxGetMainWnd() instead of GetParent() .
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"
|
|
|
|
|
Thank you for the hint, I will try it.
|
|
|
|
|
I want to prevent a window from being minimized(currently it minimizes itself as soon as it is no longer the foreground window), I think I need to write a hook, but I don't know what message I need to capture... can some one please give some detailed solution? Thanks a lot.
|
|
|
|
|
What about to create that window without minimize button ?
And remove minimize command from it's system menu ?
rrrado
|
|
|
|
|
The target window was not created by me, it's a third party progrram, I just hate it when it keeps minimizing itself so...
|
|
|
|
|
I'm handling WM_CONTEXTMENU message in dialog, invoked by keyboard. It contains two List controls. How to find which one (if any) is activated ?
I tried to get HWND of active window by ::GetActiveWindow()
and comnpare it to HWNDs of list controls get by ::GetDlgItem().
But they are never equal, even if some of the List controls is focused.
Any idea how to do this ?
Thanks
rrrado
|
|
|
|
|
Have you tried GetFocus() ?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes, the same result. But I've solved that,
i'm handling listctrls' NM_SETFOCUS and NM_KILLFOCUS and i remember which was focused last
But another mystery for me is, why NM_RETURN from list control is never sent
I look at messages in Spy++, it's always only finding default dialog item and invoking that.
rrrado
|
|
|
|
|
Hi,
Does naybody know how to get the call stack programaticly in a function
Thanks
Ceri
|
|
|
|
|
MFC has a function named AfxDumpStack() or something like that. There are several articles here on CP for crash handling and dumping the stack. Also see John Robbins's BugSlayer articles on MSDN.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi,
Thanks for the reply.
This is no good to me for 2 reasons.
1.
I am not using MFC
2.
If i where then i dont want to output it, i need to actaully do something with the stack frames.
I have managed it now by using __asm blocks and using the esp pointer.
Not sure i you can help with this question.
Do you know how to get the module name or HMODULE that is mapped for a particualt section of memory. e.g.
A module is loaded at address 0x01000000. There is a function in that module at address 0x01000123. How can I determine which module that 0x01000123 is inside
Many Thanks
Ceri
|
|
|
|