Jump to content
Holographic

C++ WebBrowser control asupra componentelor Flash

Recommended Posts

Salut,

Am si eu o intrebare.

In C++ Builder, sunt componentele CppWebBrowser si WebBrowser.

Pot sa completez programatic formuri de pe site-uri, sa zicem pentru autologin (practic se deschide pagina in WebBrowser, si apoi se preia controlul, se gaseste forma care trebuie completata, dupa nume, si se baga continutul in ea).

Acum, aici: http://demo.swfupload.org/v220/formsdemo/index.php e un exemplu de upload pe flash. Pot sa automatizez completarea tuturor formurilor, inclusiv si ala disabled de la "Resume", ca tot un form simplu e, il el bagam calea catre fisier. Insa cand dau click pe "Submit Application" nu merge uploadul. Am facut putin debuggin pe pagina si am vazut ca doar dupa se se alege fisierul cu componenta flash (butonul upload) se retine intr-o variabila calea catre fisier, si e posibil sa pornesti uploadul.

Intrebarea: stie cineva cum sa preiau controlul asupra componentei alea flash? si mai bine ar fi ca s-o fac sa gandeasca ca fisierul a fost deja ales, astfel sa automatizez total uploadul acestuia pe site.

Putin cod pentru cei interesati cum se completeaza o forma din WebPage in C++ Builder (tot pe acelasi principiu se merge si pentru apasarea unui buton sau completarea unei forme de tip Text Area)

void FillForm(TWebBrowser *WB,String Name, String Data)
{
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> pDoc;
CComQIPtr<IHTMLElementCollection, &IID_IHTMLElementCollection> pColl;
CComQIPtr<IDispatch, &IID_IDispatch> pTmpDisp;
CComQIPtr<IHTMLInputElement, &IID_IHTMLInputElement> pElement;
CComQIPtr<IDispatch, &IID_IDispatch> pDisp;
if ( SUCCEEDED (WB->Document->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pDoc)))
{
if ( SUCCEEDED (pDoc->get_all(&pColl)))
{
if ( SUCCEEDED (pColl->item(TVariant(WideString(Name)), TVariant(0), &pDisp)))
{
pElement = pDisp;
pElement->put_value(Data.c_str());
}
}
}
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...