|
Why are you using ::driver in some places and driver in others? I'd also be suspicious of having to array delete loads of things that are used just like single objects. I'd be doubly suspicious of having to delete objects that I didn't allocate with new but that might be just poor design on the part of the library.
That library looks pretty ghastly as well - are you sure there aren't some higher level interfaces in there somewhere you're not using? It looks really fiddly and low level to me.
Cheers,
Ash
|
|
|
|
|
hi,
what is the use ofstdafx header file?
|
|
|
|
|
All code in it, mainly includes, is put in a precompiled header file (*.pch) once. If you compile two translation units (.cpp files) using precompiled headers, only the first will go through all the code in stdafx.h. The second will use the precompiled data found in the .pch file instead.
The main reason for this is compilation speed.
Normally you put stuff in stdafx.h that changes rarely, because if you modify it, it will trigger a full rebuild on the next compilation.
|
|
|
|
|
Dear Friends,
Can you please send any sample code which shows a clear idea of implimentation of IHTMLElement in VC++ for retriving Input element. Please help soon.
Thankx
|
|
|
|
|
Show us what you've done so far.
Steve
|
|
|
|
|
Pk.j wrote: Can you please send any sample code which shows a clear idea of implimentation of IHTMLElement in VC++ for retriving Input element. Please help soon
Are you able to read HTML file in IHTMLDocument?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
If you're looking for an input element, there is an interface called IHTMLInputElement that may be useful to you.
An HTML element has many type of attributes that you can retrieve.
You haven't mentioned what you want to retrieve.
Here is an article that may be of help to you - Adding a custom search feature to CHtmlViews[^]
|
|
|
|
|
Thank you for you advice.
Actually I want to retrieve 'id' Input element of a resource like Password Field in a webpage. I had tried this interface IHTMLInputElement, but it has no memberfunctions to retieve 'id' value. Thats why i'm especting 'IHTMLElement' may help us for getting 'id' value. If you are feeling this is the right way or we should take help of other COM interfaces to get my requiremet ,then please help me by sending a detail sample code for the interface.
Thanks
|
|
|
|
|
Yes, you must use IHTMLElement::get_id to get the id of an element.
Where are you facing the problem and what have you got so far.
|
|
|
|
|
Here is my code stuff through which i'm trying to abstract 'id' value
=======================================================================
IHTMLElement *pElement;
HRESULT hr;
TCHAR tChrID[500];
BSTR bStrID;
hr = pElement->get_id(&bStrID);
if (SUCCEEDED(hr))
{
CString StrS;
if (bStrID)
{
WideCharToMultiByte(CP_ACP, 0, bStrID, -1, tChrID, 500, NULL, NULL);
SysFreeString (bStrID);
}
StrS = tChrID;
WriteToLog(StrS); // Creating LOG of 'id'values
pElement ->Release();
}
int WriteToLog(CString strLog)
{
// Open the existing file, or, if the file does not exist,
// create a new file.
SYSTEMTIME systime;
//get universal system time
GetSystemTime(&systime);
CString strTemp;
strTemp.Format (_T("\n%s"), strLog);
HANDLE hFile;
DWORD dwBytesWritten, dwPos;
hFile = CreateFile (TEXT("\\progra~1\\softex\\omnipass\\LOG.TXT"), // Open Two.txt.
GENERIC_WRITE, // Open for writing
0, // Do not share
NULL, // No security
OPEN_ALWAYS, // Open or create
FILE_ATTRIBUTE_NORMAL, // Normal file
NULL); // No template file
if (hFile == INVALID_HANDLE_VALUE)
{
CloseHandle (hFile); // Close the file.
return 1;
}
else
{
// Append the log file at the end
dwPos = SetFilePointer (hFile, 0, NULL, FILE_END);
WriteFile (hFile, strTemp, (strTemp.GetLength() + 1),&dwBytesWritten, NULL);
}
CloseHandle (hFile);
return 0;
}
===========================================================================
But its crashing my application as soon as any website opened in Internet Explorer-8 .
Please let me knaow any mistake you find in my above stuff or eny other way we should impliment this interface .And please guide me
Thankx
|
|
|
|
|
pElement is only a pointer and is not initialized.
You have to get the IHTMLElement pointer and not just declare it.
This we usually get using a QueryInterface call on some other interface pointer.
|
|
|
|
|
I have modified as per your suggestion.My modified lines are in block letter .Please have a look on below & guide me--
=======================================================================
IHTMLElement *pElement;
IDispatch *pDispInput = NULL;
HRESULT hr;
TCHAR tChrID[500];
BSTR bStrID;
if ( pDispInput->QueryInterface(IID_IHTMLElement, (void **)&pElement)== S_OK)
{ hr = pElementLitu->get_id(&bStrID);
if (SUCCEEDED(hr))
{
CString StrS;
if (bStrID)
{
WideCharToMultiByte(CP_ACP, 0, bStrID, -1, tChrID, 500, NULL, NULL);
SysFreeString (bStrID);
}
StrS = tChrID;
WriteToLog(StrS); // Creating LOG of 'id'values
}
pElement ->Release();
}
pDispInput->Release();
========================================================================================
|
|
|
|
|
You're again start from NULL.
Is this code running in a BHO?
If so you it gives you the IWebBrowser2 object in the SetSite method.
You must start from here.
Search for the required element by tag name and then use QueryInterface on the returned IDispatch pointer to get to the IHTMLElement pointer.
|
|
|
|
|
No my code is not running in BHO. It's an exe.
Actually i want to save WebPage's filled values with 'id'of the field. So that in future i can refer a (saved) perticular field value with respect to it's Input-element 'id' value .
I able to do both save & refer the value of a field with respect to the value of Input-element 'type'. But problem is there, if suppose a web page having 2 TEXT-type fields --Text1 & Text2,then when i'm after saving those values, referring the values ,my code pointing those Text1 & Text2 fields's values as if the values of Text1 field. Because both field's Input 'type' element's value is same "text".
Actually i'hv to save the LoginPage field value of 'www.redbox.com'.But it's most fields don't have common Inpute element 'name'.Other wise we could have a abstract by IHTMLInputElement->get_name()
Only way, we can point both values of 2 different TEXT-type fields separately by saving their values along with Input 'id' element's value respectfully.Because we can notice id's of 2 different TEXT-type field's are different even though their Input 'type' value[text] are same .
So can you please rectify my last code stuff .
|
|
|
|
|
This reply is 2 months after the fact but I'm throwing it in for the benefit of anybody reading later, as LOTS of people come here to solve many problems.
As with most of MSHTML and/or the WebBrowser control, the IHTMLElement::get_id method is grossly misdocumented. It does not take a BSTR as a parameter. If you look at the disassembly of the method actually executing, it requires 12 bytes of parameters before THIS is placed on the stack. The crash is occuring because it's pulling 12 bytes OFF the stack instead of the 4 bytes the docs would have you putting there. And there's your crash: a corrupted stack that just lost 8 bytes it wasn't expecting to lose. Without using machine-dependent assembly language, I'm not sure how you would get the compiler to accept putting 12 bytes on the stack instead of the 4 that's expected. In assembly it's easy. You can tweak the interface definition in the header file as others have had to do on other issues, but I'm not sure what the parameters are supposed to be. I'm not even sure what the method does, I can only promise it has nothing to do with retrieving an ID. The 8 extra bytes on the stack are ignored, and the last parameter (the one that's supposed to be a BSTR) has its lower 16 bits set to 0. That's all it does. Within the scope of very limited time, I tried everything I could think of with the parameters - even puting a VT_BSTR on the stack - and couldn't pin it down. Nothing ever happened except the low word of one dword out of 3 (or 4 if you count THIS) in the parameters was changed to zero.
My advise is, consider the method not to exist.
|
|
|
|
|
I am creating a software suite that will involve mobile platforms along with multiple operating systems
I am mostly efficient in c/c++/c# along with socket communication.
I originally designed the software to use TCP communication to relay information between the "base" application and the client applications.
However I am missing a crucial step in the design... I am not sure how to "connect" to this server or base computer I have a domain name that I can use, but how is it that I relate that information to the server application? I want this server app to be in c# .net, but am willing to migrate to a different solution if deemed easier. Is there a js script that I can make that will do this for me?
For more info on the type of application this is.. think of it like a IM program that the server must know all the clients connected and send global messages to
--addition
I can think of one solution but it truly seems very inefficient
I can have a file on my server and every 30seconds on a worker thread check for connected devices, when a client system connects to the server it registers itself on the list
-- or
when the server comes online the server stores its IP information in this file, when a client comes online it checks this file for the servers IP information and then creates a socket based on the information in the file to communicate with the server
Suggestions, comments are greatly appreciated!
modified on Sunday, June 27, 2010 7:56 PM
|
|
|
|
|
Greg Mort wrote: I am mostly efficient in c/c++/c# along with socket communication.
Greg Mort wrote: However I am missing a crucial step in the design... I am not sure how to "connect" to this server
Surely some contradiction here. If you understand sockets then just use socket connection, standard client server application.
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: Surely some contradiction here. If you understand sockets then just use socket connection, standard client server application.
uh...
you clearly don't see the issue, so thanks but no thanks
For anyone that is willing to help I do greatly appreciate it, to be a little more specific...
It is not a simple intranet connection that I am trying to create
I have a domain name that I can use, this domain name has a dynamic IP and I do not have any server type applications on this domain name I have a computer (not affiliated with the domain) that represents my server application. I have multiple client applications that reside on mobile phones and other computers. These client applications need to be able to know how to connect to the server without knowing the exact IP of the servers computer because it will always be changing. That is why I suggest this file system on my domain name where when a server computer is running it updates the domains server file with its IP information that way a client can access this file and connect to the appropriate IP address.
Greatly Appreciated
Thank you
Greg
|
|
|
|
|
Hi,
How to resize property sheet button?
|
|
|
|
|
|
Hello,
I have a problam : my program is work well at windows xp but not at
windows 7 (I'm opening a file to write and read).
I created a manifest with:
<ms_asmv2:trustinfo xmlns:ms_asmv2="urn:schemas-microsoft-com:asm.v2">
<ms_asmv2:security>
<ms_asmv2:requestedprivileges>
<ms_asmv2:requestedexecutionlevel level="requireAdministrator">
<ms_asmv2:requestedexecutionlevel>
<ms_asmv2:requestedprivileges>
<ms_asmv2:security>
<ms_asmv2:trustinfo>
I added the manifest to the project by:
Properties->Manifest Tool->Input and Output
and adding the name of the manifest file under Additional manifest files.
(I followed the MSDN instructions "Create and Embed an Application Manifest (UAC)")
but its don't work , does anyone can halp me with this?
thanks
|
|
|
|
|
Project settings -> Linker -> UAC-Level.
Better is writing your file to the user dir.
Remember: you cant access the dir that you dont own.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Thank you, it's work wall this way, can you give me more detail about
"Better is writing your file to the user dir.
Remember: you cant access the dir that you dont own"
I'm a new programer.
thanks again
|
|
|
|
|
I found an article from the legendary Mark Russinovich:
http://technet.microsoft.com/en-us/magazine/2007.06.uac.aspx
which is really worth reading and understanding. Believe me investing one or two hours to understand it is good invested time. You wont regret it, thats how Windows works.
Or this one
http://www.codeproject.com/KB/vista-security/UAC__The_Definitive_Guide.aspx
in which I found the link.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
A class is sub of CPropertyPage.
Several classes are sub of the class.
code looks like:
class Base : public CPropertyPage
{
enum { IDD = PAGE_BASE };
};
class Sub0 : public Base
{
};
class Sub5 : public Base
{
};
Non-default constructor of class Base, such as Base(int iType), needs to be used to identify sub classes of Sub0 - sub5.
For this reason,
DECLARE_DYNCREATE(Base)
and
IMPLEMENT_DYNCREATE(Base, CPropertyPage)
have to be deleted.
Is it harmful if deleting the 2 pieces of code?
|
|
|
|