


static BOOL CALLBACK EnomRoomTextProps(HWND hwnd, LPCTSTR szProp, HANDLE)
{
char atom_name[64];
//OleDropTargetInterface
//OleDropTargetMarshalHwnd
if (is_atom(szProp)) {
ATOM atom = LOWORD(szProp);
if (!GetAtomName(atom, atom_name, sizeof(atom_name)))
return FALSE;
szProp = atom_name;
}
if (!strncmp(szProp, "OleDrop", 7)) {
SetLastError(0);
return FALSE;
}
return TRUE;
}
static BOOL CALLBACK FindRoomTextProc(HWND hwnd, LPARAM lParam)
{
TCHAR str[128];
if (RealGetWindowClass(hwnd, str, sizeof(str)) == 0)
return TRUE;
if (strcmp(str, "RichEdit20A"))
return TRUE;
if (!IsWindowVisible(hwnd))
return TRUE;
if (!EnumProps(hwnd, EnomRoomTextProps))
return TRUE;
if ((GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_NOPARENTNOTIFY) == 0)
return TRUE;
*((HWND *)lParam) = hwnd;
SetLastError(0);
return FALSE;
}
//...
HWND rich20;
if (EnumChildWindows(hwnd, (WNDENUMPROC)FindRoomTextProc,
PtrToLong(&rich20)) ||
GetLastError() != 0) {
// could not find room text
return;
}
// do whatever with rich20 here




locohacker wrote:I am lzy asz hell cause of school starting now hehehe

autopilot wrote:Here is an update...
Pal 9.4 and up, we had to switch how we found the handle of the control.
Private Function getSubForm(ByVal hWnd As Long, _
ByVal TargetSubClass As String, _
ByVal TargetSubClassIndex As Integer) As Long
'set variables in module
mParentHnd = hWnd
mTargetSubClass = TargetSubClass
mTargetSubClassIndex = TargetSubClassIndex
'set variables for EnumWindows function
Dim lRet As Long
Dim lParam As Long
'Enum sub windows to get hnd for target
lRet = FindSubWindsWithwHnd
'return target hnd
getSubForm = mSubFormHnd
End Function

Private Function ReadTextHnd


intercepter_3 wrote:And I got that to work just fine by changing it to a public function and it works like a charm.
Anyone have any ideas on the autopilot method to get text?
I did a search and could not find anything.

Return to Visual Basic Programming
Users browsing this forum: No registered users and 0 guests