
'no case sensitivity

//Flags

% FR_DOWN                         0x00000001
% FR_WHOLEWORD                    0x00000002
% FR_MATCHCASE                    0x00000004
% FR_FINDNEXT                     0x00000008
% FR_REPLACE                      0x00000010
% FR_REPLACEALL                   0x00000020
% FR_DIALOGTERM                   0x00000040
% FR_SHOWHELP                     0x00000080
% FR_ENABLEHOOK                   0x00000100
% FR_ENABLETEMPLATE               0x00000200
% FR_NOUPDOWN                     0x00000400
% FR_NOMATCHCASE                  0x00000800
% FR_NOWHOLEWORD                  0x00001000
% FR_ENABLETEMPLATEHANDLE         0x00002000
% FR_HIDEUPDOWN                   0x00004000
% FR_HIDEMATCHCASE                0x00008000
% FR_HIDEWHOLEWORD                0x00010000
% FR_RAW                          0x00020000
% FR_MATCHDIAC                    0x20000000
% FR_MATCHKASHIDA                 0x40000000
% FR_MATCHALEFHAMZA               0x80000000


// strings used to obtain unique window message for communication
// between dialog and caller

% LBSELCHSTRINGA  "commdlg_LBSelChangedNotify"
% SHAREVISTRINGA  "commdlg_ShareViolation"
% FILEOKSTRINGA   "commdlg_FileNameOK"
% COLOROKSTRINGA  "commdlg_ColorOK"
% SETRGBSTRINGA   "commdlg_SetRGBColor"
% HELPMSGSTRINGA  "commdlg_help"
% FINDMSGSTRINGA  "commdlg_FindReplace"


type FINDREPLACE
  dword  lStructSize
  sys    hwndOwner
  sys    hInstance
  dword  Flags
  char*  lpstrFindWhat
  char*  lpstrReplaceWith
  word   wFindWhatLen
  word   wReplaceWithLen
  sys    lCustData
  sys    lpfnHook
  char*  lpTemplateName
end type

Declare GetModuleHandle       lib "kernel32.dll" alias "GetModuleHandleA" (optional char*n) as sys
Declare ReplaceText           Lib "comdlg32.dll" Alias "ReplaceTextA" (FINDREPLACE*fr) As sys
Declare CommDlgExtendedError  Lib "comdlg32.dll" () as dword
Declare IsDialogMessage       Lib "user32.dll" (sys hDlg,lpMsg) as sys
Declare RegisterWindowMessage Lib "user32.dll" Alias "RegisterWindowMessageA" (char* lpStrMsg) as sys


Function FindReplaceDialog(char *f,*r, sys le, Hwnd, Flags) as sys
'====================

static FINDREPLACE  fr

fr.lStructSize      = sizeof FINDREPLACE
fr.hwndOwner        = hwnd
fr.hInstance        = GetModuleHandle
fr.Flags            = Flags
fr.lpstrFindWhat    = f
fr.lpstrReplaceWith = r
fr.wFindWhatLen     = le
fr.wReplaceWithLen  = le
fr.lCustData        = 0 'lparam
fr.lpfnHook         = 0
fr.lpTemplateName   = null

int retval = ReplaceText(fr)
if retval=0 then print "Dialog Error " CommDlgExtendedError
return retval
'
'http://msdn.microsoft.com/en-us/library/windows/desktop/ms646835(v=vs.85).aspx
'http://msdn.microsoft.com/en-us/library/windows/desktop/ms646946(v=vs.85).aspx
'
'#recordof FINDREPLACE
'
End Sub


