Click here to Skip to main content
16,006,341 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: a simply question about dlls Pin
Joaquín M López Muñoz19-Feb-02 4:53
Joaquín M López Muñoz19-Feb-02 4:53 
GeneralRe: a simply question about dlls Pin
Carlos Antollini20-Feb-02 9:23
Carlos Antollini20-Feb-02 9:23 
GeneralRe: a simply question about dlls Pin
Gérald Mercet20-Feb-02 21:05
Gérald Mercet20-Feb-02 21:05 
GeneralRe: a simply question about dlls Pin
Carlos Antollini22-Feb-02 9:33
Carlos Antollini22-Feb-02 9:33 
GeneralKeyboard Accelerators Pin
louis14-Feb-02 23:09
louis14-Feb-02 23:09 
GeneralRe: Keyboard Accelerators Pin
Mazdak14-Feb-02 23:46
Mazdak14-Feb-02 23:46 
GeneralRe: Keyboard Accelerators Pin
louis17-Feb-02 23:00
louis17-Feb-02 23:00 
GeneralRe: Keyboard Accelerators Pin
Sef Tarbell20-Feb-02 12:30
Sef Tarbell20-Feb-02 12:30 
As far as I can tell from my experimentation with the accelerators functions, you need to do something like the following. In my example, the user would hold down Ctrl and a key they have assigned to the item.

you have the following member variables in your header file:

ACCEL* m_pAccel; //pointer to an array of ACCEL structs
HACCEL m_hAccel; //the actual accel table
int m_count; //number of accelerators

in your implementation file:

//your constructor
void MyListView :: MyListView ()
{
m_count = 20;
m_pAccel = new ACCEL[count];
}

//your handler for double click
void MyListView :: OnDblClk(....,....)
{
int index = HitTest(....,....);
...
// store hotkey information
pAccel[index].fVirt = FCONTROL|FVIRTKEY; //virtual keys work best imho
pAccel[index].key = VK_1; //the key
pAccel[index].cmd = IDM_FIRST_ROW; //a menu id
...
//unregister the hotkeys
::DestroyAcceleratorTable( hAccel );

//register the hotkeys
hAccel = ::CreateAcceleratorTable( pAccel, count );
}

//your handler for pre-translate message
BOOL MyListView :: PreTranslateMessage(MSG* pMsg)
{
::TranslateAccelerator( this->GetSafeHwnd(), hAccel, pMsg );

return CListView::PreTranslateMessage(pMsg);
}

Good luck. Wink | ;)

Sef Tarbell

"A mind all logic is like a knife all blade, it makes the hand bleed that wields it." --Rabindranath Tagore
GeneralRe: Keyboard Accelerators Pin
louis20-Feb-02 19:20
louis20-Feb-02 19:20 
QuestionNewbie: Declaring in CPP or in h files? Pin
14-Feb-02 21:30
suss14-Feb-02 21:30 
AnswerRe: Newbie: Declaring in CPP or in h files? Pin
Jon Hulatt14-Feb-02 22:03
Jon Hulatt14-Feb-02 22:03 
AnswerRe: Newbie: Declaring in CPP or in h files? Pin
Navier15-Feb-02 13:22
Navier15-Feb-02 13:22 
GeneralVC# Standard vs. VC# Pro Pin
Rickard Andersson2014-Feb-02 21:30
Rickard Andersson2014-Feb-02 21:30 
GeneralRe: VC# Standard vs. VC# Pro Pin
Mazdak14-Feb-02 23:52
Mazdak14-Feb-02 23:52 
Generalflibble Pin
14-Feb-02 19:46
suss14-Feb-02 19:46 
GeneralRe: flibble Pin
14-Feb-02 19:59
suss14-Feb-02 19:59 
GeneralRe: flibble Pin
Jon Hulatt14-Feb-02 22:05
Jon Hulatt14-Feb-02 22:05 
Generalproblem in playing a wave file in VC++ Pin
14-Feb-02 18:48
suss14-Feb-02 18:48 
GeneralRe: problem in playing a wave file in VC++ Pin
alex.barylski14-Feb-02 19:01
alex.barylski14-Feb-02 19:01 
Generalstatic constructors and destructors in C++ Pin
Nish Nishant14-Feb-02 16:25
sitebuilderNish Nishant14-Feb-02 16:25 
GeneralRe: static constructors and destructors in C++ Pin
Nish Nishant14-Feb-02 16:37
sitebuilderNish Nishant14-Feb-02 16:37 
GeneralRe: static constructors and destructors in C++ Pin
Nish Nishant14-Feb-02 16:46
sitebuilderNish Nishant14-Feb-02 16:46 
GeneralRe: static constructors and destructors in C++ Pin
Tim Smith14-Feb-02 16:44
Tim Smith14-Feb-02 16:44 
GeneralRe: static constructors and destructors in C++ Pin
Tim Smith14-Feb-02 16:50
Tim Smith14-Feb-02 16:50 
GeneralRe: static constructors and destructors in C++ Pin
Ravi Bhavnani14-Feb-02 19:16
professionalRavi Bhavnani14-Feb-02 19:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.