Click here to Skip to main content
15,890,376 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: conversion from MultiByte Character set to UNICODE character set Pin
Purish Dwivedi23-Apr-09 22:12
Purish Dwivedi23-Apr-09 22:12 
QuestionKeybaord hooking Pin
ashtwin23-Apr-09 18:40
ashtwin23-Apr-09 18:40 
AnswerRe: Keybaord hooking Pin
Randor 23-Apr-09 21:31
professional Randor 23-Apr-09 21:31 
GeneralRe: Keybaord hooking Pin
ashtwin26-Apr-09 20:04
ashtwin26-Apr-09 20:04 
QuestionHow can run our application as a Service? Pin
Le@rner23-Apr-09 18:28
Le@rner23-Apr-09 18:28 
AnswerRe: How can run our application as a Service? Pin
_AnsHUMAN_ 23-Apr-09 18:35
_AnsHUMAN_ 23-Apr-09 18:35 
AnswerRe: How can run our application as a Service? Pin
Hamid_RT24-Apr-09 0:04
Hamid_RT24-Apr-09 0:04 
QuestionHow can the callback function streamout be called back about richeditor' StreamOut function. Pin
sunhaiminbnu23-Apr-09 16:25
sunhaiminbnu23-Apr-09 16:25 
AnswerRe: How can the callback function streamout be called back about richeditor' StreamOut function. Pin
Stuart Dootson23-Apr-09 21:56
professionalStuart Dootson23-Apr-09 21:56 
QuestionTrapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
EvScott23-Apr-09 12:38
EvScott23-Apr-09 12:38 
AnswerRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
Stuart Dootson23-Apr-09 12:50
professionalStuart Dootson23-Apr-09 12:50 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
EvScott23-Apr-09 12:55
EvScott23-Apr-09 12:55 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
Stuart Dootson23-Apr-09 13:03
professionalStuart Dootson23-Apr-09 13:03 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
EvScott23-Apr-09 13:53
EvScott23-Apr-09 13:53 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
Stuart Dootson23-Apr-09 14:29
professionalStuart Dootson23-Apr-09 14:29 
EvScott wrote:
I'm not using a dialog box, I'm using CreateWindow to draw my controls.


That's fine - it works just the same.

Here's a code fragment for a small Win32 app I just created - it's just a standard VS2008 Windows app with an edit box created in the standard window. I've sub-classed the edit control to trap the WM_CHAR message and increment the character code (so if you press 'a', the edit control sees 'b'):

// For storing the edit control's original wndproc
WNDPROC wpOrigEditProc;

// The sub-classed edit control's wndproc
LRESULT APIENTRY EditSubclassProc(
                                  HWND hwnd, 
                                  UINT uMsg, 
                                  WPARAM wParam, 
                                  LPARAM lParam) 
{ 
   // Increment the key code for a WM_CHAR message
   if (uMsg==WM_CHAR) 
      ++wParam; 

   // Pass all messages on to the original wndproc. Obviously, the WM_CHAR one has been tampered with :-)
   return CallWindowProc(wpOrigEditProc, hwnd, uMsg, wParam, lParam); 
} 

// The main window's wndproc - I've not shown all of it, just the bit that interacts with the edit control
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   int wmId, wmEvent;
   PAINTSTRUCT ps;
   HDC hdc;

   switch (message)
   {
   case WM_CREATE:
      // Create the window
      editWindow = CreateWindow(_T("EDIT"), _T("edit"), WS_CHILD|WS_BORDER, 10, 10, 300, 300, hWnd, 0, hInst, 0);
      // Sub-class it
      wpOrigEditProc = (WNDPROC) SetWindowLong(editWindow, GWL_WNDPROC, (LONG) EditSubclassProc); 
      // Show it
      ShowWindow(editWindow, SW_SHOWNORMAL);
   break;

// the rest of the WndProc follows here


Simple, eh?

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
EvScott23-Apr-09 15:05
EvScott23-Apr-09 15:05 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
Stuart Dootson23-Apr-09 15:27
professionalStuart Dootson23-Apr-09 15:27 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
EvScott23-Apr-09 15:45
EvScott23-Apr-09 15:45 
GeneralRe: Trapping WM_KEYDOWN and WM_KEYUP on entering text in edit control Pin
EvScott23-Apr-09 16:28
EvScott23-Apr-09 16:28 
Questionadding percentage to calculator Pin
icechef23-Apr-09 12:04
icechef23-Apr-09 12:04 
AnswerRe: adding percentage to calculator Pin
EvScott23-Apr-09 12:48
EvScott23-Apr-09 12:48 
GeneralRe: adding percentage to calculator Pin
icechef23-Apr-09 20:51
icechef23-Apr-09 20:51 
AnswerRe: adding percentage to calculator Pin
CPallini23-Apr-09 21:24
mveCPallini23-Apr-09 21:24 
QuestionThreadsafe Data Class Pin
softwaremonkey23-Apr-09 6:40
softwaremonkey23-Apr-09 6:40 
AnswerRe: Threadsafe Data Class Pin
Stuart Dootson23-Apr-09 6:56
professionalStuart Dootson23-Apr-09 6:56 

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.