//---------------------------------------------------------------------------
HWND __fastcall TForm1::IpmsgOpen(AnsiString ClassName)
//IPmsg送信窓を開く
//ClassName:IPmsgクラス名(例:ipmsg_class_2427)
//返値:送信窓ハンドル(0:取得失敗)
{
HWND hWnd; //TaskTray内IPmsgのハンドル
//IP Messengerハンドルの取得
if((hWnd = ::FindWindow(ClassName.c_str(),NULL)) != NULL){
::SendMessage(hWnd,WM_USER + 121,0,0); //送信ウィンドゥを開く
::Sleep(100);
//新規に開いた送信ウィンドゥを探す
return ::FindWindow("#32770","Send Message");
//IP Messengerが起動していない
}else{
//起動しているIP Messengerを列挙
mnuSend->Clear();
mnuRSend->Clear();
::EnumWindows((WNDENUMPROC)EnumWindowsProc,(LPARAM)0);
//ハンドル取得NG
ShowMessage("IP Messenger Open Error.");
return 0;
}
}
//---------------------------------------------------------------------------
bool __fastcall TForm1::IpmsgPaste(HWND hWnd,AnsiString msg)
//Clipboardから送信ウィンドゥに貼り付け
//hWnd:送信ウィンドゥハンドル
//msg:貼り付けるメッセージ
//戻り値:結果(true:OK,false:NG)
{
HWND hEdit; //Editハンドル
char buf[256]; //ClassName格納用
//Editハンドル取得
if((hEdit = ::GetWindow(hWnd,GW_CHILD)) != NULL){
//Windowの確認
::GetClassName(hEdit,buf,256);
if((AnsiString)buf == "Edit"){
//貼り付け
::SendMessage(hEdit,WM_SETTEXT,0,(LPARAM)(msg.c_str()));
//カーソルを最後に移動
::SendMessage(hEdit,EM_SETSEL,msg.Length(),msg.Length());
return true;
}
}
//ハンドル取得NG
ShowMessage("Edit Error");
return false;
}
Ly8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KSFdORCBfX2Zhc3RjYWxsIFRGb3JtMTo6SXBtc2dPcGVuKEFuc2lTdHJpbmcgQ2xhc3NOYW1lKQovL0lQbXNn6YCB5L+h56qT44KS6ZaL44GPCi8vQ2xh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