|
if (pMsg->message == WM_KEYDOWN)
{
then wParam is the keycode
}
IMO, OnKeyDown or OnChar is a nicer way to handle most keystroke actions.
-c
For men use, if they have an evil turn, to write it in marble:
and whoso doth us a good turn we write it in dust.
-- Sir Thomas More
|
|
|
|
|
Chris Losinger wrote:
OnKeyDown or OnChar is a nicer way to handle most keystroke actions.
I want to do it in FormView and OnKeyDown and OnChar didn't work there so I have to ovverriden Pretranslatemessae.
Anyway,thank you.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hi,
I got a Listview control which is ownerdata driven. I want to sort it but the LVM_SORTITEMS function just fails... I am not sure if it's relevant, but the GetLastError() return that the params are invalid. I checked it 20 times, the compare function is all right (CALLBACK, right params, return... all). I tried passing both NULL and some dummy to as the LPARAM (though it shouldn't ake any difference cause I don't do anything with them later). The HWND is valid and is used before and after this piece of code. The only thing that comes on my mind is that sorting isn't supported with ownderdata, but I haven't found a single line regarding this...
Thanks!
|
|
|
|
|
CaesarCZ wrote:
The only thing that comes on my mind is that sorting isn't supported with ownderdata, but I haven't found a single line regarding this...
It is supported with CListBox.
With CListBox an owner-drawn list box created w/ style LBS_SORT and items are added to it w/ AddString, then CListBox::CompareItem must be overridden with a version that compares two arbitrary items packaged in COMPAREITEMSTRUCT structures.
Soliant | email
"The whole of science is nothing more than a refinement of everyday thinking." -Albert E.
|
|
|
|
|
I am a little usure of how to do this. I want a function to run after the user slides to a new position. It would be nice if it ran at every instant of the slider movement. This function ses the brightness and it would be nice to see it brightening smoothly as you slide. How to I tie my slider which is in the toolbar, to this function? It has a varaible m_slider of type control.
Thanks,
ns
|
|
|
|
|
|
Well,(my slider is in the toolbar. I added it by Create -ing a CSliderCTRl in mainframe class)
I tried this:
void CMainFrame::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
CSliderCtrl* pSliderCtrl;
pSliderCtrl= (CSliderCtrl*)pScrollBar;
int x = pSliderCtrl->GetPos();
CString s;
s.Format("%d",x);
AfxMessageBox(s);
CMDIFrameWnd::OnHScroll(nSBCode, nPos, pScrollBar);
}
I only have one slider m_slider, which I didnt know how to put into the above code.
When I slid, the execution didnt go into the function above. My slider is in the toolbar. Actually, though I added the slider in the toolbar via the mainframe class, I really want it to execute a function that belongs to my view class, when I slide it.SO
1. What am I doing wrong (need to involve m_slider somehow? )
How to get the view function to run if I slide?
Thanks,
ns
|
|
|
|
|
If I put a slider on the view form, then this works:
void CSliderctrlView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CFormView::OnHScroll(nSBCode, nPos, pScrollBar);
int nPos1 = m_sl1.GetPos();
CString temp ;
temp.Format(" the position is %d ",nPos1);
AfxMessageBox(temp);
}
But
1. My slider is a mainframe variable, and exists in the toolbar.
It doesnt respond to WM_HSCROLL trapped by the mainframe class. When I did the Add windows handler, the filter (right hand bottom) was set to "TopMost frame".
When I added the handler to the view class, the filter was "window"
Looks like I need to do something special to trap hscroll in the toolbar....but what? ??
thanks,
ns
|
|
|
|
|
Your slider will send it's messages to the toolbar, so you have to relay it from the toolbar to your view.
void CMyToolbar::OnHScroll(UINT code, UINT pos, CScrollbar *pBar)
{
CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
CMDIChildWnd *pChild = pFrame->MDIGetActive();
CView *pView = pChild->GetActiveView();
pView->SendMessage(WM_HSCROLL, MAKEWPARAM(code, pos), (LPARAM)pBar->GetSafeHwnd());
}
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
New to sendmessage. I see youre sending WM_HScroll to the view. That clear. Now shall I put a handler for this in the view class? And within it call my function? What if some other scrolling operation happens, like when I scroll the mainframe or the view? I dont want the custom function to run then, which it will since I'm trapping all HScroll stuff.....How do I restrict the WM_HSCROLL handler of the view class to run only when I slide the slider?
Thanks,
ns
|
|
|
|
|
Check the value of the pScrollBar pointer passed into your view's OnHScroll() handler. It will be NULL if the scroll message was generated by the view's own scroll bars, otherwise it will point to the control that generated the message (the lparam value in the SendMessage()).
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
|
In the second link, he has a docking toolbar. By defaut its showing up at the bottom of the MDI app, near the status bar> i want it to be near the top toolbar, docked in the remaining space alongside it (my custom toolbar has two controls in it). How do I get this to happen? It looks pretty awful sitting at the bottom...
Thanks,
ns.
|
|
|
|
|
My mfc mdi app has 15x15 or 16x16 toolbar button pictures in it. I'm looking for this size picture for Brightness and Contrast functions. I usually cut and paste from the customize toolbar menu.
Any links or know where I can get it? If its in an ico file, I dont know how to grab it and paste it on the button.
Thanks,
ns
|
|
|
|
|
Why not grabbing such common pictures from other apps? Common icon pictures are not copyrighted. Make a screenshot (press the Print key on your keyboard), paste into a new Paint bitmap, use Zoom, copy the icon and paste it in MsDev.
|
|
|
|
|
I found out how to adda combobox to the toolbar. so its the same to put in a generic class in the toolbar - say a slider. I really want a spin-edit buddied up pair in the toolbar. How do I insert that? I am referring to http://www.codeproject.com/docking/toolbarcombo.asp?
If I cant figure this out I'll have to use a slider which I'd rather not, because it mnight not look so good if its not dockable separately, ....
Any links or ideas?
Thanks,
ns
|
|
|
|
|
Hi,
I added some buttons to the standard toolbar in my mfc MDI app and want to have tooltips on hovering. Can someone please point me to a link on how to do this (programmatically or manually)?
Also is there any MFC sample code for adding a spinbutton+ buddy edit ctr lto the toolbar? Actually if I can see how to get the spin-edit to work, I can incorporate it with the article on embedding non button ctrls into the toolbar.
Thanks,
ns
|
|
|
|
|
Adding tooltips to toolbar buttons in MFC is damned easy. Let's say you have "Paste" button to paste clipboard contents. The button command ID is ID_EDIT_PASTE. Then you should create a string with the same ID (ID_EDIT_PASTE) and assign it a value "Insert Clipboard contents\nPaste". Note that the string consists of two lines separated by line feed symbol ("\n"). The second line provides information for the button's tooltip.
Vagif Abilov
MCP (Visual C++)
Oslo, Norway
If you're in a war, instead of throwing a hand grenade at the enemy, throw one of those small pumpkins. Maybe it'll make everyone think how stupid war is, and while they are thinking, you can throw a real grenade at them.
Jack Handey, Deep Thoughts
|
|
|
|
|
That was like magic!!!! Thank you so much! WHats the purpose of the first part:
"Insert Clipboard contents".
Does it show up anywhere?
Thnaks a bunch. That was easy like you said!!!
|
|
|
|
|
ns wrote:
WHats the purpose of the first part:
"Insert Clipboard contents".
Does it show up anywhere?
Yes it does. It will be shown in application's status bar.
Thanks a bunch.
You're welcome.
Vagif Abilov
MCP (Visual C++)
Oslo, Norway
If you're in a war, instead of throwing a hand grenade at the enemy, throw one of those small pumpkins. Maybe it'll make everyone think how stupid war is, and while they are thinking, you can throw a real grenade at them.
Jack Handey, Deep Thoughts
|
|
|
|
|
|
Hi all,
I am receiving the following error:
error LNK2019: unresolved external symbol __imp__FindCloseUrlCache@4 referenced in function "public: __thiscall cache_iterator::cache_iterator(void)" (??0cache_iterator@@QAE@XZ)
I am working on WinXP, VS.NET C++. I am trying to compile Win32 project with reference to the WININET.H file.
I have tried the following:
#include <wininet.h>
#include "wininet.h" //copied wininet.h to same directory as file being compiled
#include "D:\Program Files\Microsoft Visual Studio\VC98\Include\WININET" //use full path
none of the above work, I used \VERBOSE:LIB to verify compiler wasn't linking the library
There seems to be something I am overlooking, please help??
Thanks in Advance.
Soliant | email
"The whole of science is nothing more than a refinement of everyday thinking." -Albert E.
|
|
|
|
|
Did you check that you actually linked the library? The error is either missing library in input library list or wrong method decoration (for example, not using 'extern "C"').
Vagif Abilov
MCP (Visual C++)
Oslo, Norway
If you're in a war, instead of throwing a hand grenade at the enemy, throw one of those small pumpkins. Maybe it'll make everyone think how stupid war is, and while they are thinking, you can throw a real grenade at them.
Jack Handey, Deep Thoughts
|
|
|
|
|
It's a linker problem, and therefore not a "#include" problem...
You need to link with Wininet.lib, you can do that either in the project settings, or by typing #pragma comment(lib, "Wininet.lib") in the sourcefile...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
In my neverending struggle to eliminate all overhead, I recently chose to do without the default libraries in my application, resulting in the following errors:
main.obj : error LNK2001: unresolved external symbol ___CxxFrameHandler<br />
main.obj : error LNK2001: unresolved external symbol __except_list
How do I get rid of them? What am I still using that needs these functions? And how on earth am I ever going to replace the recently thrown out *operator new in my application that I use every twenty lines?
Regards,
Georg-Hendrik Haan (.NL)
|
|
|
|