|
Chuck O'Toole wrote: Unless you are trying to fool some other program who knows the CRC32 of the data it wants and you are trying to pump some junk at it for some amusing or nefarious reason.
seems likely, to me.
|
|
|
|
|
My Aim is to generate a string from know CRC32 value in fastest way.
|
|
|
|
|
Having read all the above answers why do you persist in believing this is possible?
|
|
|
|
|
Richard MacCutchan wrote: Having read all the above answers why do you persist in believing this is
possible?
Head, meet brick wall.
He just doesnt get it.
==============================
Nothing to say.
|
|
|
|
|
I got it . And everything is possible which can be thought...got it...
|
|
|
|
|
john5632 wrote: And everything is possible which can be thought
Good luck with the impossible.
==============================
Nothing to say.
|
|
|
|
|
Thanks, I was a bit worried it was me!
|
|
|
|
|
Hi Developers,
We are using third party controls, it's a report control ( I have seen that ultimately it was derived from CWnd class). I am working on a searching functionality and we can select related words to the search query as well.
I have added a "Select All/Unselect All" feature for the words that are related to main search. In my function I am checking/unchecking all the words programatically. Suppose I have checked one or more words manually, after i am selecting all. The application is getting crashed. I am replacing that checked item with the new checked item( having true value ).
One intersting point is that if i am hust clicking on select/deselect all it works perfectaly.
Thanks.
Amrit Agrawal
Software Developer
|
|
|
|
|
Did you try and debug upto the point of crash?
It appears that you are trying to read/write from invalid memory locations.
Are you adding and deleting items from the lists that you maintain for checking and unchecking values and performing operations in them?
Please elaborate on the data structure etc that you are using and the operations you perform.
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
I have a dialog form, where I have an listctrl. On listcontrol set focus handler, I need to send a click message, like I would click on listcontrol. I try in follow way, but didn't work it
void CMyPage::OnSetfocusListFeature(NMHDR* pNMHDR, LRESULT* pResult)
{
NMHDR nmh;
nmh.code = NM_CLICK;
nmh.idFrom = m_ListFeature.GetDlgCtrlID();
nmh.hwndFrom = m_hWnd;
SendMessage(WM_NOTIFY,0,(LPARAM)&nmh);
*pResult = 0;
}
... can you tell me hat i'm doing wrong ?
|
|
|
|
|
nmh.hwndFrom = m_hWnd;
is your problem. it should be the hwnd of of the window of the CONTROL you want to send the message to.
WM_NOTIFY uses the id or the hwnd. if you pass the hwnd, it uses it. So you are sending the WM_NOTIFY to the dialog, not the list child of the dialog.
|
|
|
|
|
Thank you, I will try and let you know what I've done.
|
|
|
|
|
Now goes. Thanks.
modified 19-Oct-11 3:03am.
|
|
|
|
|
If you're trying to select a particular item from the list you can do this-
m_ListFeature.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
|
|
|
|
|
No, I don't want to select an specific item, just to make a virtual click on listcontrol.
|
|
|
|
|
Why? Since clicking has the effect of selecting an item selecting it as Superman suggested is superior.
Steve
|
|
|
|
|
I open an custom control on listcontrol and this custom control is hidden on clicked anywhere on list ... that's why I need click message and not select an specific item.
|
|
|
|
|
This is what I've come up with so far but need to find & add values to the form elements for user input and password input, then submit. I'm using C++Builder6.
#include <mshtml.h>
//
TComInterface<IHTMLDocument2>HTMLDoc;
Browser->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&HTMLDoc);
//get all the forms
TComInterface<IHTMLElementCollection>HTMLforms;
HTMLDoc->get_forms(&HTMLforms);
//Get form 0 since login pages have only one form
TComInterface<IHTMLFormElement>HTMLform;
//Get User,Password fields & set values
TComInterface<IHTMLElement>HTMLfield;
//Then submit form
HTMLform->submit();
Thanks!
|
|
|
|
|
I hope this Boland C++ Builder 6 code might work..
#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)))
{
Variant name = inputname;
Variant index = 0;
IDispatch* pDisp = NULL;
if(SUCCEEDED(pAll->item(name, index, &pDisp)))
{
if ( pDisp )
{
IHTMLInputElement* pInput = NULL;
pDisp->QueryInterface(IID_IHTMLInputElement, (LPVOID*)&pInput);
pDisp->Release();
if(pInput)
{
pInput->put_value(WideString(text));
done = true;
pInput->Release();
}
}
}
pAll->Release();
}
HTMLDoc->Release();
}
return done;
}
|
|
|
|
|
/* Well I got this far I get 3 errors in the BrowserDocumentComplete event:
(C++ Error)BrowserFrm.cpp(53): E2285 Could not find match for 'TBrowserFrame::GetHTMLItem<ParentIntf>TComInterface<IHTMLElementCollection,&GUID_NULL>,char *,IHTMLFormElement * *)'
(C++ Error)BrowserFrm.cpp(58): E2285 Could not find match for 'TBrowserFrame::GetHTMLItem<ParentIntf>TComInterface<IHTMLFormElement,&GUID_NULL>,char *,IHTMLInputElement* *)'
(C++ Error)BrowserFrm.cpp(59): E2285 Could not find match for 'TBrowserFrame::GetHTMLItem<ParentIntf>TComInterface<IHTMLFormElement,&GUID_NULL>,char *,IHTMLInputElement* *)' */
//I marked the lines with the errors below:
//BrowserFrm.cpp
#include <vcl.h>
#pragma hdrstop
#include "BrowserFrm.h"
#include <utilcls.h>
#include <mshtml.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SHDocVw_OCX"
#pragma resource "*.dfm"
TBrowserFrame *BrowserFrame;
//---------------------------------------------------------------------------
__fastcall TBrowserFrame::TBrowserFrame(TComponent* Owner)
: TFrame(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TBrowserFrame::Go(AnsiString url)
{
Browser->Navigate(StringToOleStr(url),0,NULL,NULL,NULL);
}
//---------------------------------------------------------------------------
template<class ParentIntf, class ItemIntf>
HRESULT __fastcall TBrowserFrame::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 TBrowserFrame::BrowserDocumentComplete(TObject *Sender,
LPDISPATCH pDisp, Variant *URL)
{
if( Browser->Document )
{
TComInterface<IHTMLDocument2>HTMLDoc;
if(SUCCEEDED(Browser->Document->QueryInterface(
IID_IHTMLDocument2,(LPVOID*)&HTMLDoc) ) )
{
TComInterface<IHTMLElementCollection>forms;
if( SUCCEEDED(HTMLDoc->get_forms(&forms)) )
{
TComInterface<IHTMLFormElement>form;
/*Line 53 error*/ if( SUCCEEDED(GetHTMLItem(forms, "loginform", &form)) )
{
TComInterface<IHTMLInputElement>userid;
TComInterface<IHTMLInputElement>password;
/*Line 58 error*/ GetHTMLItem(form, "userid", &userid);
/*Line 59 error*/ GetHTMLItem(form, "password", &password);
if( userid )
{
userid->put_value(WideString("username"));
}
if( password )
{
password->put_value(WideString("password"));
}
form->submit();
}
}
}
}
}
//---------------------------------------------------------------------------
//BrowserFrm.h file
#ifndef BrowserFrmH
#define BrowserFrmH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "SHDocVw_OCX.h"
#include <OleCtrls.hpp>
#include <utilcls.h>
#include <mshtml.h>
//---------------------------------------------------------------------------
class TBrowserFrame : public TFrame
{
__published: // IDE-managed Components
TCppWebBrowser *Browser;
void __fastcall BrowserDocumentComplete(TObject *Sender,
LPDISPATCH pDisp, Variant *URL);
private: // User declarations
template<class ParentIntf, class ItemIntf>
HRESULT __fastcall GetHTMLItem(ParentIntf *CollectionOrElement, const
WideString &name, ItemIntf** ppIntf);
public: // User declarations
__fastcall TBrowserFrame(TComponent* Owner);
void __fastcall Go(AnsiString url);
};
//---------------------------------------------------------------------------
extern PACKAGE TBrowserFrame *BrowserFrame;
//---------------------------------------------------------------------------
#endif
-- modified 15-Oct-11 21:04pm.
|
|
|
|
|
Change this line:
HRESULT __fastcall GetHTMLItem(ParentIntf *CollectionOrElement, const WideString &name, ItemIntf** ppIntf)
To this:
HRESULT __fastcall GetHTMLItem(TComInterface<ParentIntf> &CollectionOrElement, const WideString &name, ItemIntf** ppIntf)
|
|
|
|
|
That Worked! It Fills the values but when I submit the form the web browser comes up with a dialog with a caption of: _ASSERTE: and Message of:
intf = 0 @ C:\Program Files\Borland\CBuilder6\Include\Vcl\utilcls.h/2916
Press[Y]es to terminate, [N]o to continue and [C]ancel to Debug
My code:
template<class ParentIntf, class ItemIntf>
HRESULT __fastcall TBrowserFrame::GetHTMLItem(TComInterface<ParentIntf> &CollectionOrElement, const WideString &name, ItemIntf** ppIntf)
{
TVariant vName = name;
TVariant vIndex = 0;
TComInterface<IDispatch>disp;
HRESULT hRes = CollectionOrElement->item(vName, vIndex, &disp);
if( SUCCEEDED(hRes) )
hRes = disp->QueryInterface(__uuidof(ItemIntf),(LPVOID*)ppIntf);
return hRes;
}
//---------------------------------------------------------------------------
void __fastcall TBrowserFrame::BrowserDocumentComplete(TObject *Sender,
LPDISPATCH pDisp, Variant *URL)
{
if( Browser->Document )
{
TComInterface<IHTMLDocument2>HTMLDoc;;
if(SUCCEEDED(Browser->Document->QueryInterface(
IID_IHTMLDocument2,(LPVOID*)&HTMLDoc) ) )
{
TComInterface<IHTMLElementCollection>forms;
if( SUCCEEDED(HTMLDoc->get_forms(&forms)) )
{
TComInterface<IHTMLFormElement>form;;
if( SUCCEEDED(GetHTMLItem(forms, "idpform", &form)) )
{
TComInterface<IHTMLInputElement>userid;
TComInterface<IHTMLInputElement>password;
GetHTMLItem(form, "txtUsername", &userid);
GetHTMLItem(form, "txtPassword", &password);
if( userid )
userid->put_value(WideString(username));
if( password )
password->put_value(WideString(pass));
//form->submit();
}
}
}
}
}
//---------------------------------------------------------------------------
|
|
|
|
|
What you are likely seeing is a call to MessageBox() before the
exception is thrown. To turn that off, you can go into the Project
Options and add NO_PROMPT_ON_HRCHECK_FAILURE to the Conditionals list.
The exception will then be thrown without any prompting.
If you are still using the TComInterface wrapper, the '->' operator
validates whether the interface pointer is available or not. If it is
not, an ASSERT is thrown. To disable the prompt on that error, you
can define NO_PROMPT_ON_ASSERTE_FAILURE in the Project Options.
If you implement a try..catch block, it will catch errors normally without messagebox prompt interruptions.
(sample try catch)
try {
buf = new char[512];
if( buf == 0 ) throw "Memory allocation failure!";
}
catch( char * str ) {
cout << "Exception raised: " << str << '\n';
}
|
|
|
|
|
Thankyou very much...every thing worked I added NO_PROMPT_ON_HRCHECK_FAILURE to the Conditionals list. and inserted a try/catch block around my code in the document complete event.
Now if every login page had the same names for their form & input names!
|
|
|
|
|
Is there any difference between the following loops
bool test;
do
{
}
while(!test);
and
bool test;
do
{
}
while(test==false);
Also what is the default value of boolean variable?
|
|
|
|
|