Click here to Skip to main content
16,010,876 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Profeller Pin
David Crow20-Jan-06 7:21
David Crow20-Jan-06 7:21 
AnswerRe: Profeller Pin
Toby Opferman20-Jan-06 7:27
Toby Opferman20-Jan-06 7:27 
AnswerRe: Profeller Pin
Cedric Moonen20-Jan-06 8:17
Cedric Moonen20-Jan-06 8:17 
Questionwhy is my control BEEPING??? Pin
stephen.hazel20-Jan-06 6:25
stephen.hazel20-Jan-06 6:25 
AnswerRe: why is my control BEEPING??? Pin
David Crow20-Jan-06 7:25
David Crow20-Jan-06 7:25 
GeneralRe: why is my control BEEPING??? Pin
stephen.hazel20-Jan-06 7:48
stephen.hazel20-Jan-06 7:48 
GeneralRe: why is my control BEEPING??? Pin
stephen.hazel20-Jan-06 8:00
stephen.hazel20-Jan-06 8:00 
GeneralRe: why is my control BEEPING??? Pin
stephen.hazel20-Jan-06 8:29
stephen.hazel20-Jan-06 8:29 
Ok. I needed to handle WM_GETDLGCODE for my custom control to get wm_keyup/down...
No more beeping.
Buuuut, now I can't tab outa the field once I'm in it.
I can click out, but can't tab/shift-tab out...

Anybody know how to correctly handle tab, shift-tab, cursor up/down/left/right, mnemonic???

Sighhh...

...Steve



struct CtlKbd {
public:
   void Init ()
   {
TRC("CtlKbd::Init bgn");
      MemSet (& _wc, 0, sizeof (_wc));
      _wc.lpszClassName = "KBD";
      _wc.lpfnWndProc   = WinProc;
      _wc.cbSize        = sizeof (WNDCLASSEX);
//    _wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
      _wc.hCursor       = ::LoadCursor (0, IDC_ARROW);
      if (::RegisterClassEx (& _wc) == 0)
         DieWn ("CtlKbd::CtlKbd  RegisterClassEx");
TRC("CtlKbd::Init end");
   }
private:
   WNDCLASSEX _wc;
   static LRESULT CALLBACK WinProc (HWND hwnd, UINT msg, WPARAM w, LPARAM l)
   { static bool  foc = false;
     static ubyte oct = 4;
     static ubyte vel = 100;
      switch (msg) {
      case WM_GETDLGCODE:
         return DLGC_WANTALLKEYS;
      case WM_LBUTTONDOWN:
         ::SetFocus (hwnd);
         return 0;
      case WM_SETFOCUS:
         foc = true;    ::RedrawWindow (hwnd, NULL, NULL, RDW_INVALIDATE);
         return 0;
      case WM_KILLFOCUS:
         foc = false;   ::RedrawWindow (hwnd, NULL, NULL, RDW_INVALIDATE);
         return 0;
      case WM_PAINT:
         { PAINTSTRUCT p;
           Canvas      c (::BeginPaint (hwnd, & p));
            c.SetBg (foc ? 0 : 255, foc ? 255 : 0, 0);
            c.Text (0, 0, "in");
            ::EndPaint (hwnd, & p);
         }
         return 0;
      case WM_ERASEBKGND:
         return 0;
//    case WM_SYSKEYDOWN:  case WM_SYSKEYUP:
      case    WM_KEYDOWN:  case    WM_KEYUP:
      { KeyMap km;
        key    k;
        ubyte  i;
        TrkEv  e;
char buf [900];
     // if keyup or keydown-nonrepeat
         if ((l & 0x80000000) || (!(l & 0x40000000)))  if (k = km.Map (w)) {
            for (i = 0; i < BITS (KyNt); i++)
               if (k == KyNt [i].k) {
                  e.ctrl = (ubyte)(KyNt [i].nt + oct*12);
                  e.valu = (l & 0x80000000) ? 0 : vel;
                  if ((l & 0x80000000) == 0) e.valu |= 0x80;
                  e.chan = 0;
                  sprintf (buf, "kbd ctl: $%02X $%02X\n", e.ctrl, e.valu);
                  DBG(buf);
                  return 0;
               }
         }
         break;
      }
      }
      return ::DefWindowProc (hwnd, msg, w, l);
   }
};

QuestionRe: why is my control BEEPING??? Pin
David Crow20-Jan-06 8:40
David Crow20-Jan-06 8:40 
AnswerRe: why is my control BEEPING??? Pin
stephen.hazel20-Jan-06 9:23
stephen.hazel20-Jan-06 9:23 
GeneralRe: why is my control BEEPING??? Pin
Blake Miller20-Jan-06 12:01
Blake Miller20-Jan-06 12:01 
GeneralRe: why is my control BEEPING??? Pin
stephen.hazel21-Jan-06 16:46
stephen.hazel21-Jan-06 16:46 
QuestionWindows 2003 Pin
zinc_z20-Jan-06 6:06
zinc_z20-Jan-06 6:06 
AnswerRe: Windows 2003 Pin
Divyang Mithaiwala20-Jan-06 6:16
Divyang Mithaiwala20-Jan-06 6:16 
GeneralRe: Windows 2003 Pin
zinc_z20-Jan-06 7:03
zinc_z20-Jan-06 7:03 
GeneralRe: Windows 2003 Pin
Divyang Mithaiwala20-Jan-06 17:06
Divyang Mithaiwala20-Jan-06 17:06 
GeneralRe: Windows 2003 Pin
zinc_z21-Jan-06 15:09
zinc_z21-Jan-06 15:09 
AnswerRe: Windows 2003 Pin
Michael Dunn20-Jan-06 6:55
sitebuilderMichael Dunn20-Jan-06 6:55 
GeneralRe: Windows 2003 Pin
zinc_z20-Jan-06 7:53
zinc_z20-Jan-06 7:53 
GeneralRe: Windows 2003 Pin
Toby Opferman20-Jan-06 14:05
Toby Opferman20-Jan-06 14:05 
Questioncan i store a character variable to chararacter pointer variable? Pin
Harrison Ford20-Jan-06 5:33
Harrison Ford20-Jan-06 5:33 
AnswerRe: can i store a character variable to chararacter pointer variable? Pin
Divyang Mithaiwala20-Jan-06 5:58
Divyang Mithaiwala20-Jan-06 5:58 
QuestionRe: can i store a character variable to chararacter pointer variable? Pin
David Crow20-Jan-06 7:28
David Crow20-Jan-06 7:28 
QuestionDebug Assertion Failed when calling dll function Pin
Jordan C. Atlas20-Jan-06 5:11
Jordan C. Atlas20-Jan-06 5:11 
AnswerRe: Debug Assertion Failed when calling dll function Pin
Chris Losinger20-Jan-06 6:46
professionalChris Losinger20-Jan-06 6:46 

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.