Hi ,
I have used the following code to send Message to a vb window,
While using this code in win32 application i can able to find the child window and no problem with my code,
But while using this in an mfc application cant able to find the child window and
it is always null.
Please help to solve my problem,
Thanks in advance.
Code:
HWND FormhWnd;
long uClickYes;
long Res ;
long lngresult;
UINT sendtxtmsg;
sendtxtmsg = RegisterWindowMessage("SEND.TEXT.MSG");
LPCSTR strCaption ;
LPCSTR strClass ;
LPCSTR TextBoxCaption ;
strCaption = "WINDOWNAME";
strClass = "ThunderRT6TextBox";
TextBoxCaption = "";
FormhWnd = ::FindWindow(NULL, "WINDOWNAME");
CString txtval;
txtval.Format("%d",sendtxtmsg);
if (FormhWnd != NULL) 
{
HWND findchild;
AfxMessageBox("FormhWnd not null");
findchild = FindWindowEx(FormhWnd, NULL, strClass, NULL);
if (findchild != NULL)
{
AfxMessageBox("findchild not null");
FILE *fp;
fp=fopen("sendmsg.txt","w");
fputs("joined Channel..",fp);
fclose(fp);
Res = ::SendMessage(findchild, sendtxtmsg, 1,0);
}
else
{
AfxMessageBox("findchild null");
}
else
{
AfxMessageBox ("PARENT WINDOW NULL");
}
thanks and regards,
chithra