예제 #1
0
DWORD WINAPI ThreadProc(LPVOID lParam)
{
    TCHAR szPath[MAX_PATH] = {0,};
    TCHAR *p = NULL;

    OutputDebugString(L"ThreadProc() start...");

    GetModuleFileName(NULL, szPath, sizeof(szPath));

    if( p = _tcsrchr(szPath, L'\\') )
    {
        _tcscpy_s(p+1, wcslen(DEF_INDEX_FILE)+1, DEF_INDEX_FILE);

        OutputDebugString(L"DownloadURL()");
        if( DownloadURL(DEF_URL, szPath) )
        {
            OutputDebugString(L"DropFlie()");
            DropFile(szPath);
        }
    }

    OutputDebugString(L"ThreadProc() end...");

    return 0;
}
예제 #2
0
// ----------------------------------------------------------------------- RHTML_text_view - MessageReceived -
void RHTMLtextview::MessageReceived(BMessage *msg)
{
 switch (msg->what)
  {
   case 'PPOP':
   {
	Window()->Lock();
	if (pushmenu)
    {
     int32 c,d;
     GetSelection(&c,&d);
     pushmenu=false;
     if (mode==1) fTagMenu->Start(ConvertToScreen(PointAt(c)),c,R_TAG_MENU,tags);
     if (mode==2) fTagMenu->Start(ConvertToScreen(PointAt(c)),c,R_PARAM_MENU,tags,BString(buf1));
     if (mode==3) fTagMenu->Start(ConvertToScreen(PointAt(c)),c,R_VALUE_MENU,tags,BString(buf1),BString(buf2));

    }
	Window()->Unlock();
	fTimer->EndTimer();
   }
   break;
   case 'TIMR':
   {
	Window()->Lock();
	UpdateParamMenu();
    fTarget->fNumView->UpdateNum();
	Window()->Unlock();
	fUpdateTimer->EndTimer();
   }
   break;
   case 'PTFC':
   {
    int32 c,d;
    BString oldstring;
    msg->FindInt32("sel1",&c);
    msg->FindInt32("sel2",&d);
    msg->FindString("oldstring",&oldstring);
    BString *newtext = new BString(Text());
    fFileTypes->SetFontAndColor(&oldstring, newtext,0,c,d);
    delete newtext;
   }
   break;
   case 'CWFC':
   {
    int32 c,d;
    GetSelection(&c,&d);
    BString *newtext = new BString(Text());
    fFileTypes->SetFontAndColor(newtext, newtext, 0, c);
    delete newtext;
   }
   break;
   case 'VALE':
   {
    msg->FindString("tag",&buf1);
    msg->FindString("param",&buf2);
    pushmenu=true;
    mode=3;
    fTimer->StartTimer(fOptions->ReakcioIdoTM);
   }
   break;
   case 'UPPM':
   {
    if (fUpdateTimer->IsActive())
     fUpdateTimer->ResetTimer();
    else
     fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
   }
   break;
   default:
   {
    if (msg->WasDropped())
    {
     int32		num;
     uint32		type;
     char*		name;
     BPoint		aPoint;
     BPoint		point;
     entry_ref ref;
     status_t err;
     
     msg->FindPoint("_drop_point_", &aPoint);

     point = aPoint;
     this->ConvertFromScreen(&point);

     const int32 offset = OffsetAt(point);
    
     if (msg->GetInfo(B_REF_TYPE, 0, &name, &type, &num) == B_NO_ERROR && num >= 1)
     {
		// - File
      for(int32 i = 0; i < num; i++)
      {
       BEntry entry;
       BPath path;
       BFile fFile;
       BNodeInfo fNodeInfo;
       entry_ref ref;
       char fFileType[B_MIME_TYPE_LENGTH];
       if(msg->FindRef("refs", i, &ref) != B_NO_ERROR)
       {
        continue;
       }
       if ((err=entry.SetTo(&ref)) == B_OK)
       {
        entry.GetPath(&path);
       } 
       fFile.SetTo(&ref,B_READ_ONLY);
       fNodeInfo.SetTo(&fFile);
       fNodeInfo.GetType(fFileType);
       DropFile(path.Path(), fFileType, offset);
      }
     }
    } else
    {
     BTextView::MessageReceived(msg);
    }
   }
   break;
  }
}