Hi All,
Can you please let me know what these two functions do ? I would want to know for what purpose they are being used?
Kindly help
Harish
//CallBack function for EnumChildWindows API call from SetOS2CursorForWindows
BOOL CALLBACK EnumESLChildWindowsCallback(HWND hWnd,LPARAM lParam)
{
//CGI_CONV_OS2WIN_START
//Function body modified according to keep the functionalities under the windows platform
TCHAR szClassName[80]={0};
LONG uWndStyle;
WIN_CTRL_INFO WinCtrlInfo; //for temporary storing of the entry field information in a screen
if (!IsWindowVisible(hWnd) || GetWindow(hWnd, GW_OWNER) != NULL)
return TRUE;
GetClassName(hWnd, szClassName, 80);
//if (lstrcmpi(szClassName,ESL_ENTRY_FIELD) == 0)
//if window is an entry field override its window procedure
if (lstrcmpi(szClassName,ESLEditClass) == 0)
{
uWndStyle = GetWindowLong(hWnd,GWL_STYLE);
if(uWndStyle !=0)
{
if(uWndStyle & ES_MULTILINE){}
else
{
OriginalWindowProc = GetWindowLong(hWnd, GWL_WNDPROC);
OriginalWindowProcChk = SetWindowLong(hWnd, GWL_WNDPROC, (DWORD)(WNDPROC) EntryFieldCursorProc);
if (OriginalWindowProc == 0L)
OriginalWindowProc = OriginalWindowProcChk;
WinCtrlInfo.handle = hWnd;
WinCtrlInfo.OriginalWndProc = OriginalWindowProc;
AttachCtrlInfo(WinCtrlInfo);
}
}
}
//else if (lstrcmpi(szClassName,ESL_DIALOG_BOX) == 0)
//skip the child window enumeration for all other ESL control objects
else if (lstrcmpi(szClassName,ESLButtonClass) == 0 ||
lstrcmpi(szClassName,ESLComboBoxClass) == 0 ||
lstrcmpi(szClassName,ESLComboLClass) == 0 ||
lstrcmpi(szClassName,ESLListBoxClass) == 0 ||
lstrcmpi(szClassName,ESLSliderClass) == 0 ||
lstrcmpi(szClassName,ESLTrackbarClass) == 0 ||
lstrcmpi(szClassName,ESLSpinButtonClass) == 0 ||
lstrcmpi(szClassName,ESLUpDownClass) == 0 ||
lstrcmpi(szClassName,ESLStaticClass) == 0 ||
lstrcmpi(szClassName,ESLEslTblClass) == 0) {}
else //else the window should be an ESL Dialog box
{
EnumChildWindows(hWnd, EnumESLChildWindowsCallback, (LPARAM)NULL);
}
//CGI_CONV_OS2WIN_END
return(TRUE);
}
LONG APIENTRY SetOS2CursorForWindow(HWND* WindowHandle)
{
//CGI_CONV_OS2WIN_START
//Replaced the following code segment with EnumChildWindows API of Windows
//which enumerates all child windows of the *WindowHandle parameter
/* EnumerateHandle = WinBeginEnumWindows(*WindowHandle);
for (;;)
{
if ((WindowChildHandle = WinGetNextWindow(EnumerateHandle)) == (HWND)NULL)
break; //no more child windows
WindowClassType[0] = '\0';
WindowClassTypeLen = 9;
WinQueryClassName(WindowChildHandle, WindowClassTypeLen, WindowClassType);
if (strcmp(WindowClassType, ESL_ENTRY_FIELD) == 0)
{
OriginalWindowProcChk=WinSubclassWindow(WindowChildHandle,
EntryFieldCursorProc);
if (OriginalWindowProc == 0L)
OriginalWindowProc = OriginalWindowProcChk;
}
else
if (strcmp(WindowClassType, ESL_DIALOG_BOX) == 0)
{ //dialog box within a dialog region, enumerate its children
WinEndEnumWindows(EnumerateHandle);
EnumerateHandle = WinBeginEnumWindows(WindowChildHandle);
}
}
WinEndEnumWindows(EnumerateHandle);*/
g_unCtrlCount = 0;
memset(g_ListWinCtrlInfo, 0, sizeof(g_ListWinCtrlInfo));
//Enumerate the child windows of the window represented by *WindowHandle
EnumChildWindows(*WindowHandle, EnumESLChildWindowsCallback, (LPARAM)NULL);
//CGI_CONV_OS2WIN_END
return 0L;
}