Click here to Skip to main content
15,902,275 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Suggest a fast way to do? Pin
App_17-Oct-11 1:41
App_17-Oct-11 1:41 
GeneralRe: Suggest a fast way to do? Pin
Goto_Label_17-Oct-11 2:05
Goto_Label_17-Oct-11 2:05 
AnswerRe: Fast way = Use a CRC32 TABLE Pin
Software_Developer17-Oct-11 2:18
Software_Developer17-Oct-11 2:18 
GeneralRe: Fast way = Use a CRC32 TABLE Pin
john563217-Oct-11 3:43
john563217-Oct-11 3:43 
GeneralRe: Fast way = Use a CRC32 TABLE Pin
Software_Developer17-Oct-11 8:03
Software_Developer17-Oct-11 8:03 
AnswerRe: Suggest a fast way to do? PinPopular
Chuck O'Toole17-Oct-11 4:52
Chuck O'Toole17-Oct-11 4:52 
GeneralRe: Suggest a fast way to do? Pin
Chris Losinger17-Oct-11 5:11
professionalChris Losinger17-Oct-11 5:11 
QuestionRe: Suggest a fast way to do? Pin
john563217-Oct-11 19:30
john563217-Oct-11 19:30 
AnswerRe: Suggest a fast way to do? Pin
Richard MacCutchan17-Oct-11 23:13
mveRichard MacCutchan17-Oct-11 23:13 
GeneralRe: Suggest a fast way to do? Pin
Erudite_Eric18-Oct-11 1:09
Erudite_Eric18-Oct-11 1:09 
GeneralRe: Suggest a fast way to do? Pin
john563218-Oct-11 1:26
john563218-Oct-11 1:26 
GeneralRe: Suggest a fast way to do? Pin
Erudite_Eric18-Oct-11 20:12
Erudite_Eric18-Oct-11 20:12 
GeneralRe: Suggest a fast way to do? Pin
Richard MacCutchan18-Oct-11 2:41
mveRichard MacCutchan18-Oct-11 2:41 
QuestionCrashing problem in Report control Pin
Amrit Agr16-Oct-11 20:25
Amrit Agr16-Oct-11 20:25 
AnswerRe: Crashing problem in Report control Pin
_AnsHUMAN_ 16-Oct-11 20:51
_AnsHUMAN_ 16-Oct-11 20:51 
QuestionHow to send a click message to an listctrl ? Pin
_Flaviu15-Oct-11 7:30
_Flaviu15-Oct-11 7:30 
AnswerRe: How to send a click message to an listctrl ? Pin
MartyTPS15-Oct-11 16:25
MartyTPS15-Oct-11 16:25 
GeneralRe: How to send a click message to an listctrl ? Pin
_Flaviu15-Oct-11 22:01
_Flaviu15-Oct-11 22:01 
GeneralRe: How to send a click message to an listctrl ? Pin
_Flaviu16-Oct-11 19:56
_Flaviu16-Oct-11 19:56 
AnswerRe: How to send a click message to an listctrl ? Pin
«_Superman_»15-Oct-11 21:08
professional«_Superman_»15-Oct-11 21:08 
GeneralRe: How to send a click message to an listctrl ? Pin
_Flaviu15-Oct-11 22:00
_Flaviu15-Oct-11 22:00 
GeneralRe: How to send a click message to an listctrl ? Pin
Stephen Hewitt16-Oct-11 2:36
Stephen Hewitt16-Oct-11 2:36 
GeneralRe: How to send a click message to an listctrl ? Pin
_Flaviu16-Oct-11 19:56
_Flaviu16-Oct-11 19:56 
Questionsetting form element values using ie TCppWebBrowser control Pin
Andrew J. Burke15-Oct-11 3:32
Andrew J. Burke15-Oct-11 3:32 
AnswerRe: setting form element values using ie TCppWebBrowser control Pin
App_15-Oct-11 8:37
App_15-Oct-11 8:37 
I hope this Boland C++ Builder 6 code might work..

C#
#include utilcls.h
#include Mshtml.h

template<class ParentIntf, class ItemIntf>
HRESULT __fastcall GetHTMLItem(ParentIntf *CollectionOrElement, const
WideString &name, ItemIntf** ppIntf)
{
	TVariant vName = name;
	TVariant vIndex = 0;
	TComInterface disp;

	HRESULT hRes = CollectionOrElement->item(vName, vIndex, &disp);
	if( SUCCEEDED(hRes) )
	hRes = disp->QueryInterface(__uuidof(ItemIntf),(LPVOID*)ppIntf);
	return hRes;
}

void __fastcall TForm1::CppWebBrowser1DocumentComplete (TObject*
Sender, LPDISPATCH pDisp, TVariant *URL)
{
	if( CppWebBrowser->Document )
	{
		TComInterface HTMLDoc;
		if(SUCCEEDED(CppWebBrowser->Document->QueryInterface(
		IID_IHTMLDocument2,(LPVOID*)&HTMLDoc) ) )
		{
			TComInterface forms;
			if( SUCCEEDED(HTMLDoc->get_forms(&forms)) )  
			{
				TComInterface form;
				if( SUCCEEDED(GetHTMLItem(forms, "loginform", &form)) )
				{
				TComInterface userid;
				TComInterface password;

				GetHTMLItem(form, "userid", &userid);
				GetHTMLItem(form, "password", &password);

				if( userid )
				userid->put_value(WideString("username"));

				if( password )
				password->put_value(WideString("password"));
				}
			}
		}
	}
}


I hope this Boland C++ Builder 6 code might work too..

bool TForm1::Login(char* inputname, const AnsiString& text)
{
 bool done = false;
 
 IHTMLDocument2* HTMLDoc = NULL;
 
 if(SUCCEEDED(CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument2,  (LPVOID*)&HTMLDoc)))
{
 IHTMLElementCollection* pAll = NULL;
 if(SUCCEEDED(HTMLDoc->get_all(&pAll)))
 {
   // <input type="text" name="the_tag">
 
   Variant name = inputname;
   Variant index = 0;
 
   IDispatch* pDisp = NULL;
 
   if(SUCCEEDED(pAll->item(name, index, &pDisp)))
   {
    if ( pDisp )
    {
      // IHTMLInputFileElement* pInput = NULL;     // mshtml.h
     IHTMLInputElement* pInput = NULL;     // mshtml.h
      // IHTMLFormElement* pForm = NULL;         // mshtml.h
 
    pDisp->QueryInterface(IID_IHTMLInputElement, (LPVOID*)&pInput);
    pDisp->Release();
 
    if(pInput)
    {
     pInput->put_value(WideString(text));
 
     done = true;
 
      /*
      WideString mybuffer;
      pInput->get_value ( &mybuffer );
      ShowMessage ( mybuffer );
      */
 
     pInput->Release();
     }
    }
   }
    pAll->Release();
  }
 
  HTMLDoc->Release();
 }
  return done;
}

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.