|
Hi,
I want to login (a htmlpage in ie control)
But ,I don't know the id or name of the button
How to click the login button?
I found some code,but you must know the name or id of login button?
void SubmitPage(IHTMLElementCollection *pobjAllElement,CString strName)
{
CComPtrp Disp;
pobjAllElement->item(COleVariant(strName),COleVariant((long)0),&pDisp);
CComQIPtr pElement;
if(pDisp==NULL)
{
AfxMessageBox(strName + "????!");
}
else
{
pElement=pDisp;
pElement->click();
}
}
Thank you!
|
|
|
|
|
for your question how to submit, try this; get the form element and submit form, IHTMLFormElement::Submit().
But what is your scenario how you are entering the login info without knowing the id?
|
|
|
|
|
I dont know the login button's name or ID
|
|
|
|
|
if the login button is of type submit, you can explicitly submit the form without knowing the button id using IHTMLFormElement::Submit() (refer for more handling) .
chinakknd wrote: I dont know the login button's name or ID
this you already mentioned in your origial post, I am asking how you enter login info (login name login password) without knowing the ids. In order to automate such things I think you need to know the information of the elements.
|
|
|
|
|
|
Here's a ridiculously simple question. What's the equivalent of SetCursor for MFC MDI child windows? I have looked through the documentation but can't find it. (I found the WaitCursor functions, but that's not what I want.)
How do I set and reset the cursor for an MFC MDI application?
Thanks.
|
|
|
|
|
|
I need to have a C++ MFC project use an icon that has 8 bit alpha transparency ... not just 1 color transparency.
The furthest I've gotten is converting
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME)
to
m_hIcon = (HICON)LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 0, 0, LR_CREATEDIBSECTION);
and trying some variations on the last parameter such as LR_LOADTRANSPARENT.
Please help. Thanks!
|
|
|
|
|
Is your icon already authored to be 32-bit?
If so, a simple load like this should work (don't use LR_SHARED if you want to destroy the icon yourself)...
m_hIcon = (HICON)LoadImage(::AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 0, 0, LR_SHARED);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi everyone,
I'm trying to use some registry functions from the Windows API in a native C++ project.
The thing is that I'm getting an error that says RegGetValueA cannot be found in ADVAPI32.dll, but I'm not using that function. Instead I'm using RegQueryValueEx.
Anybody knows why this happens?
Thanks
rotter
The metaller programmer
|
|
|
|
|
Nevermind. I found the problem.
I used the problematic function before and it seems it remained somewhere in the compiled code.
A rebuild solved it.
Thanks anyway
rotter
The metaller programmer
|
|
|
|
|
I have the follwing code:
class MyStruct {
public:
std::string s;
};
class Test {
public:
operator std::string() const {
return std::string();
}
operator void* () const {
return NULL;
}
operator char () const {
return 'a';
}
};
It's nonsensical but bear with we. The idea is that the Test class should convert to various types, so the expression:
Test t;
std::string s = t;
compiles fine, where "s" is assigned whatever the result of Test::operator std::string().
Why then do I get compiler errors ( both on VC6 and VC8) when I do
Test t;
MyStruct m;
m.s = t;
It complains about "error C2593: 'operator =' is ambiguous"? What am I missing??!
If I remove the operator char() converter then it compiles fine. But why does this work in the first case and not the second?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
It's not C++, is it string class (operator overloading) interaction with your ones.
Jim Crafton wrote: What am I missing??!
Nothing.
Jim Crafton wrote: If I remove the operator char() converter then it compiles fine. But why does this work in the first case and not the second?
Because of the string::= operator, that accepts a string as well a character, hence the ambiguity.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
OK, but why does the second example fail? It's also assigning it to a string class?
The only difference is that it's now a member variable.
m.s = t;
where "m" is a MyStruct type and m.s references the member variable MyStruct::s which is a std::string. So how is that any different than doing
std::string b = t;
The first one fails, the second one doesn't, yet both reference a std::string variable!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Because in the
std::string b = t;
example the compiler, under the hood, is calling the string contructor instead of the assignment operator. You can test the following little change:
std::string b;
b = t;
BTW to be honest, I missed your first example, before .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
first takes "copy constructor" while the second takes "assignment operator". string doesnot have copy constructor that takes char.
to avoid ambiguity in "assignment operator" specify explicit typecast.
m.s = std::string(t);
|
|
|
|
|
Hello experts,
I have the need to create a small, non-GUI application, which would consume no more than 300k~320k of memory...
My code should also have the ability to use Win32 API.
When I tried a "Win32 Application" project, even with no more than an empty WinMain() function, it consumes about 1000k of RAM...
BTW, I use windows Task Manager to read memory consumption...
What kind of project should I create?
Any guidelines?
I know C++ as a language, but have never actually written anything with it...
Thanks in advance,
Shy.
|
|
|
|
|
Shy Agam wrote: have the need to create a small, non-GUI application, which would consume no more than 300k~320k of memory...
Why?.
(i.e. do you really need such a strict contraint?)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
I was asked to write the app... It's no me who decide...
|
|
|
|
|
Try (I didn't make a test) to change the STACK linker option [^] that defaults to 1 MB .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi,
How about console application?
Best Regards,
Suman
|
|
|
|
|
I've created an empty console project, added a new .cpp file, and written the following code:
#include <windows.h>
void main()
{
Sleep(10000);
} This simple code uses 600k of RAM...
Furthermore, it opens a console window, but I suppose it's possible to hide it...
|
|
|
|
|
In generated code, check which part displays console.
Is "windows.h" the only header included or something else?
Try not including header except which needed for Win32 API.
Best Regards,
Suman
|
|
|
|
|
rp_suman wrote: In generated code, check which part displays console.
What do you mean by "In generated code"?
Nothing was auto-generated...
rp_suman wrote: Is "windows.h" the only header included or something else?
Yes, it's the only header included.
However, when I included it and linked the project, basetsd.h was automatically added to the project as an external dependency.
|
|
|
|
|
Which version of vc++ you are trying?
I am not sure, but there may be difference in memory between different versions of vc++(6.0, 7.0 and 8.0).
|
|
|
|