Please Help me
Jul 19, 2013 at 11:16am UTC
Hi,
In my application i created Find Dialog box with
FINDREPLCAE
structure.and processing
FR_FINDNEXT
event also.But i want to process
FR_FINDNEXT
with 'Enter'(
VK_RETURN
) key also.What should I do for that?Please give me solution for this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
UINT uFindReplaceMsg; // message identifier for FINDMSGSTRING
uFindReplaceMsg = RegisterWindowMessage(FINDMSGSTRING);
break ;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_FIND40012:
static FINDREPLACE fr; // common dialog box structure
HWND hwnd; // owner window
static WCHAR szFindWhat[80]; // buffer receiving string
// Initialize FINDREPLACE
ZeroMemory(&fr, sizeof (fr));
fr.lStructSize = sizeof (fr);
fr.hwndOwner = hwnd;
fr.lpstrFindWhat = szFindWhat;
fr.wFindWhatLen = 80;
fr.Flags = 0;
hdlg = FindText(&fr);
break ;
}
break ;
case WM_PAINT ://paint operation
return 0 ;
case WM_DESTROY :
PostQuitMessage (0) ;
return 0 ;
default :
LPFINDREPLACE lpfr;
if (message == uFindReplaceMsg)
{
// Get pointer to FINDREPLACE structure from lParam.
lpfr = (LPFINDREPLACE)lParam;
// If the FR_DIALOGTERM flag is set,
// invalidate the handle that identifies the dialog box.
if (lpfr->Flags & FR_DIALOGTERM)
{
hdlg = NULL;
return 0;
}
// If the FR_FINDNEXT flag is set,
// call the application-defined search routine
// to search for the requested string.
if (lpfr->Flags & FR_FINDNEXT)
{
SearchFile(lpfr->lpstrFindWhat,
(BOOL) (lpfr->Flags & FR_DOWN),
(BOOL) (lpfr->Flags & FR_MATCHCASE));
}
return 0;
}
else
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
}
Last edited on Jul 23, 2013 at 7:16am UTC
Topic archived. No new replies allowed.