Find dialog box not working

Hi
I am trying to create a find dialog box with function FindText();.But i am gettting access violation.Please help me.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
case ID_FIND40012:
{
FINDREPLACE fr;       // common dialog box structure
static CHAR szFindWhat[80];  // buffer receiving string
HWND hdlg = NULL;     // handle to Find dialog box

// Initialize FINDREPLACE
ZeroMemory(&fr, sizeof(fr));
fr.lStructSize = sizeof(fr);
fr.hwndOwner = hwnd;
fr.lpstrFindWhat = (LPWSTR)szFindWhat;
fr.wFindWhatLen = 80;
fr.Flags = 0;

hdlg = FindText(&fr);
}
Last edited on
Another Unicode problem, does not that been discusses over and over again on these forums ???????????????????????

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
case ID_FIND40012:
{
FINDREPLACEW fr;       // common dialog box structure
static WCHAR szFindWhat[80];  // buffer receiving string
HWND hdlg = NULL;     // handle to Find dialog box

// Initialize FINDREPLACE
ZeroMemory(&fr, sizeof(fr));
fr.lStructSize = sizeof(fr);
fr.hwndOwner = hwnd;
fr.lpstrFindWhat = szFindWhat;
fr.wFindWhatLen = _countof (szFindWhat);
fr.Flags = 0; // not sure about this

hdlg = FindTextW(&fr);
}
above code also getting access violation some time.Correct code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
case ID_FIND40012:
{
static FINDREPLACEW fr;       // common dialog box structure
static WCHAR szFindWhat[80];  // buffer receiving string
HWND hdlg = NULL;     // handle to Find dialog box

// Initialize FINDREPLACE
ZeroMemory(&fr, sizeof(fr));
fr.lStructSize = sizeof(fr);
fr.hwndOwner = hwnd;
fr.lpstrFindWhat = szFindWhat;
fr.wFindWhatLen = _countof (szFindWhat);
fr.Flags = 0; // not sure about this

hdlg = FindTextW(&fr);
}
Last edited on
Topic archived. No new replies allowed.