|
Including the bmp image as resource isn't secure (as anyone can tamper easily).
So, I form the raw bitmap data (excluding headers) at runtime using some obfuscated code. The image is 208 pixels wide and has a height of 97 pixels. It takes 24bits per pixel. I'm very weak in GDI. I got a code to display image from resource and I tried modifying. Unfortunately, it didn't work
I'm MFC free till now and would like to remain so
Plz let me know the right approach.
Here is what I tried:
HBITMAP bmpExercising;
BITMAP bitmap;
bmpExercising = CreateCompatibleBitmap(GetDC(myWind), 208, 97);
GetObject(bmpExercising, sizeof(bitmap), &bitmap);
bitmap.bmBits = buf;
bitmap.bmBitsPixel = 24;
bitmap.bmHeight = 97;
bitmap.bmWidth = 208;
bitmap.bmPlanes = 1;
HDC hDC, MemDCExercising;
PAINTSTRUCT Ps;
case WM_PAINT:
hDC = BeginPaint(hwnd, &Ps);
MemDCExercising = CreateCompatibleDC(hDC);
SelectObject(MemDCExercising, bmpExercising);
BitBlt(hDC, 10, 10, 208, 97, MemDCExercising, 0, 0, SRCCOPY);
DeleteDC(MemDCExercising);
DeleteObject(bmpExercising);
EndPaint(hwnd, &Ps);
break;
I want to do it without MFC
I'm using Visual C++ 2005 Professional. Windows XP Professional with SP3.
-
S.V.Kaushik
|
|
|
|
|
There are a number of errors, I will list a few.
Selecting a GDI object into your device context needs to be followed by the same object being selected out of the dc. In your case
HGDIOBJ oldbmp = ::SelectObject(dc, bmp);
::SelectObject(dc, oldbmp);
DeleteDC(dc);
Your paint code will only have a bitmap the first time it paints, since you delete the bitmap there. Delete your bitmap in WM_DESTROY handler instead.
Also:
Your blitting area is 10x10 less than your bitmap.
|
|
|
|
|
thanx for the info... will do the changes and post the result
-
S.V.Kaushik
|
|
|
|
|
look in the source of that great article.
CBitmapEx - Free C++ Bitmap Manipulation Class[^]
You can debug in the MFC code to view some details.
/* ************* After Calls to CreateWindow ********************* */
bmpExercising = CreateCompatibleBitmap(GetDC(myWind), 208, 97);
GetObject(bmpExercising, sizeof(bitmap), &bitmap);
//you cant modify this data in that way.
/*bitmap.bmBits = buf;
bitmap.bmBitsPixel = 24;
bitmap.bmHeight = 97;
bitmap.bmWidth = 208;
bitmap.bmPlanes = 1;*/
//use ::SetPixel() - API for every pixel one time
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Thanks a lot... This is exactly what i needed
-
S.V.Kaushik
|
|
|
|
|
Hi,
I am creating a ownder draw button with Round Edges. I tried the bolw code for round edged in OnDraw()
//make round corner
CRgn rgn;
CRect crt;
GetClientRect(&crt);
rgn.CreateRoundRectRgn( crt.left, crt.top, crt.right, crt.bottom, 13, 13);
SetWindowRgn(rgn,1);
Button is coming with round edges but If button repaints it is becoming rectanglular shape button.
What shall I do?
|
|
|
|
|
Below is a link to Chris Maunder's class that turns rectangular buttons into round buttons.
Round Buttons[^]
|
|
|
|
|
john5632 wrote: Button is coming with round edges but If button repaints it is becoming rectanglular shape button.
What shall I do?
I think your drawing the whole rectangular area of the button in OnDraw function.
Draw only the round rectangular area of the button.
OR
Draw the button with the dialog background first and then draw the remaining things.
|
|
|
|
|
Hi!
I've already asked this question in this forum with the heading "Data Execution Prevention".
Please refer the following link:
How do I check whether I've corrupted the buffer?
I've deleted all the variable I've used.
Please tell me how to get around this error?
Here is my code:
#include "irrlicht.h"
#include "CEGUI.h"
#include "CEGUIIrrlichtRenderer.h"
#define STATUS_ACCESS_VIOLATION ((NTSTATUS)0xC0000005L)
using namespace std;
using namespace CEGUI;
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
IrrlichtDevice* device = createDevice(EDT_DIRECT3D9, core::dimension2d<u32>(800, 600), 16, false);
CEGUI::IrrlichtRenderer &myRenderer = CEGUI::IrrlichtRenderer::bootstrapSystem(*device);
class InitialMenu : public IEventReceiver
{
private:
WindowManager* wmgr;
Window* myRoot, *playWnd, *optionsWnd, *creditsWnd, *initialMnuBG_img, *playMnuBG_img, *optionsMnuBG_img, *creditsMnuBG_img;
FrameWindow* fWnd;
DefaultResourceProvider* rp;
CEGUI::PushButton* play_btn, *options_btn, *credits_btn, *exit_btn;
CEGUI::Image* playercty_img, *oppcty_img;
CEGUI::Combobox* playercty_cbo, *oppcty_cbo;
CEGUI::PushButton* playMnuBack_btn, *playMnuNext_btn, *optionsMnuBack_btn, *optionsMnuNext_btn;
CEGUI::PushButton* creditsMnuBack_btn;
CEGUI::Scrollbar* music_scr, *sound_scr;
public:
InitialMenu()
{
rp = static_cast<DefaultResourceProvider*>(System::getSingleton().getResourceProvider());
rp->setResourceGroupDirectory ("schemes", "datafiles/schemes/");
rp->setResourceGroupDirectory ("imagesets", "datafiles/imagesets/");
rp->setResourceGroupDirectory ("fonts", "datafiles/fonts/");
rp->setResourceGroupDirectory ("layouts", "datafiles/layouts/");
rp->setResourceGroupDirectory ("looknfeel", "datafiles/looknfeel/");
rp->setResourceGroupDirectory ("lua_scripts", "../datafiles/lua_scripts/");
CEGUI::Imageset::setDefaultResourceGroup("imagesets");
CEGUI::Font::setDefaultResourceGroup("fonts");
CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeel");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");
CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme","schemes");
FontManager::getSingleton().createFreeTypeFont("DejaVuSans-10.font",10,false, "DejaVuSans.ttf");
WidgetLookManager::getSingleton().parseLookNFeelSpecification("TaharezLook.looknfeel", "looknfeel");
wmgr = WindowManager::getSingletonPtr();
wmgr->loadWindowLayout("E://CricCEGUI//datafiles//layouts//VanillaWindows.layout", "", "", 0, 0);
myRoot = wmgr->createWindow("DefaultWindow", "root");
System::getSingleton().setGUISheet(myRoot);
fWnd = (FrameWindow*)wmgr->createWindow("TaharezLook/FrameWindow", "");
fWnd->setPosition(UVector2(UDim(0.25f, 0.0f), UDim(0.25f, 0.0f)));
fWnd->setSize(UVector2(UDim(0.5f, 0.5f), UDim(0.5f, 0.5f)));
fWnd->setText("Hello World!");
myRoot->addChildWindow(fWnd);
fWnd->setSizingEnabled(true);
CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);
CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);
play_btn = (PushButton*) wmgr->createWindow("TaharezLook/Button", "play_btn");
options_btn = (PushButton*) wmgr->createWindow("TaharezLook/Button", "options_btn");
credits_btn = (PushButton*) wmgr->createWindow("TaharezLook/Button", "credits_btn");
exit_btn = (PushButton*) wmgr->createWindow("TaharezLook/Button", "exit_btn");
ImagesetManager::getSingleton().createFromImageFile("initialMnuBG_img", "E:\\CricCEGUI\\bg.png", " ");
initialMnuBG_img = wmgr->createWindow("TaharezLook/StaticImage", "initialMnuBG_img");
initialMnuBG_img->setArea(URect (cegui_reldim (0), cegui_reldim (0), cegui_reldim (1), cegui_reldim (1)));
initialMnuBG_img->setProperty("FrameEnabled", "false");
initialMnuBG_img->setProperty("BackgroundEnabled", "false");
initialMnuBG_img->setProperty("Image", "set:initialMnuBG_img image:full_image");
fWnd->addChildWindow(initialMnuBG_img);
fWnd->addChildWindow(play_btn);
fWnd->addChildWindow(options_btn);
fWnd->addChildWindow(credits_btn);
fWnd->addChildWindow(exit_btn);
play_btn->setPosition(UVector2(UDim(0.22f, 11.5f), UDim(0.05f, 11.5f)));
play_btn->setSize(UVector2(UDim(0.2f, 0.15f), UDim(0.15f, 0.15f)));
play_btn->setText("Play");
play_btn->setProperty("NormalImage", "E:/CricCEGUI/bg.png");
options_btn->setPosition(UVector2(UDim(0.25f, 0.25f), UDim(0.25f, 0.25f)));
options_btn->setSize(UVector2(UDim(0.2f, 0.15f), UDim(0.15f, 0.15f)));
options_btn->setText("Options");
credits_btn->setPosition(UVector2(UDim(0.18f, 28.6f), UDim(0.3f, 28.6f)));
credits_btn->setText("Credits");
credits_btn->setSize(UVector2(UDim(0.2f, 0.15f), UDim(0.15f, 0.15f)));
exit_btn->setPosition(UVector2(UDim(0.07f, 71.2f), UDim(0.3f, 71.2f)));
exit_btn->setSize(UVector2(UDim(0.2f, 0.15f), UDim(0.15f, 0.15f)));
exit_btn->setText("Exit");
System::getSingleton().setDefaultFont("DejaVuSans-10.font");
System::getSingleton().setDefaultTooltip("TaharezLook/Tooltip");
CEGUI::System::getSingleton().injectMouseButtonDown(CEGUI::LeftButton);
CEGUI::System::getSingleton().injectMouseButtonUp(CEGUI::LeftButton);
play_btn->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&InitialMenu::playHandler, this));
options_btn->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&InitialMenu::optionsHandler, this));
credits_btn->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&InitialMenu::creditsHandler, this));
exit_btn->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&InitialMenu::exitHandler, this));
}
bool playHandler(const EventArgs& e)
{
wmgr = WindowManager::getSingletonPtr();
playWnd = (FrameWindow*)wmgr->createWindow("TaharezLook/FrameWindow", "playWnd");
playWnd->setPosition(UVector2(UDim(0.25f, 0.0f), UDim(0.25f, 0.0f)));
playWnd->setSize(UVector2(UDim(0.5f, 0.5f), UDim(0.5f, 0.5f)));
System::getSingleton().setGUISheet(playWnd);
playercty_img = (Image*) wmgr->createWindow("TaharezLook/StaticImage", "playercty_img");
oppcty_img = (Image*) wmgr->createWindow("TaharezLook/StaticImage", "oppcty_img");
playercty_cbo = (Combobox*) wmgr->createWindow("TaharezLook/Combobox", "playercty_cbo");
oppcty_cbo = (Combobox*) wmgr->createWindow("TaharezLook/Combobox", "oppcty_cbo");
playMnuBack_btn = (PushButton*) wmgr->createWindow("TaharezLook/Button", "playMnuBack_btn");
playMnuNext_btn = (PushButton*) wmgr->createWindow("TaharezLook/Button", "playMnuNext_btn");
ImagesetManager::getSingleton().createFromImageFile("playMnuBG_img", "E:\\CricCEGUI\\Forest.png", "");
playMnuBG_img = wmgr->createWindow("TaharezLook/StaticImage", "playMnuBG_img");
playMnuBG_img->setArea(URect (cegui_reldim (0), cegui_reldim (0), cegui_reldim (1), cegui_reldim (1)));
playMnuBG_img->setProperty("FrameEnabled", "false");
playMnuBG_img->setProperty("BackgroundEnabled", "false");
playMnuBG_img->setProperty("Image", "set:playMnuBG_img image:full_image");
playWnd->addChildWindow(playMnuBG_img);
playWnd->addChildWindow(playercty_img->getName());
playWnd->addChildWindow(oppcty_img->getName());
playWnd->addChildWindow(playercty_cbo);
playWnd->addChildWindow(oppcty_cbo);
playWnd->addChildWindow(playMnuBack_btn);
playWnd->addChildWindow(playMnuNext_btn);
return true;
}
bool optionsHandler(const EventArgs& e)
{
wmgr = WindowManager::getSingletonPtr();
optionsWnd = (FrameWindow*)wmgr->createWindow("TaharezLook/FrameWindow", "optionsWnd");
optionsWnd->setPosition(UVector2(UDim(0.25f, 0.0f), UDim(0.25f, 0.0f)));
optionsWnd->setSize(UVector2(UDim(0.5f, 0.5f), UDim(0.5f, 0.5f)));
System::getSingleton().setGUISheet(optionsWnd);
music_scr = (Scrollbar*)wmgr->createWindow("TaharezLook/Scrollbar", "music_scr");
sound_scr = (Scrollbar*)wmgr->createWindow("TaharezLook/Scrollbar", "sound_scr");
optionsMnuBack_btn = (PushButton*)wmgr->createWindow("TaharezLook/Button", "optionsMnuBack_btn");
optionsMnuNext_btn = (PushButton*)wmgr->createWindow("TaharezLook/Button", "optionsMnuNext_btn");
optionsMnuBack_btn->setPosition(UVector2(UDim(0.02f, 71.2f), UDim(0.3f, 71.2f)));
optionsMnuBack_btn->setSize(UVector2(UDim(0.2f, 0.15f), UDim(0.15f, 0.15f)));
optionsMnuBack_btn->setPosition(UVector2(UDim(1.5f, 71.2f), UDim(1.5f, 71.2f)));
optionsMnuNext_btn->setSize(UVector2(UDim(0.2f, 0.15f), UDim(0.15f, 0.15f)));
ImagesetManager::getSingleton().createFromImageFile("optionsMnuBG_img", "E:\\CricCEGUI\\bg.png", "");
optionsMnuBG_img = wmgr->createWindow("TaharezLook/StaticImage", "optionsMnuBG_img");
optionsMnuBG_img->setArea(URect (cegui_reldim (0), cegui_reldim (0), cegui_reldim (1), cegui_reldim (1)));
optionsMnuBG_img->setProperty("FrameEnabled", "false");
optionsMnuBG_img->setProperty("BackgroundEnabled", "false");
optionsMnuBG_img->setProperty("Image", "set:optionsMnuBG_img image:full_image");
optionsWnd->addChildWindow(optionsMnuBG_img);
return true;
}
bool creditsHandler(const EventArgs& e)
{
wmgr = WindowManager::getSingletonPtr();
creditsWnd = (FrameWindow*)wmgr->createWindow("TaharezLook/FrameWindow", "creditsWnd");
creditsWnd->setPosition(UVector2(UDim(0.25f, 0.0f), UDim(0.25f, 0.0f)));
creditsWnd->setSize(UVector2(UDim(0.5f, 0.5f), UDim(0.5f, 0.5f)));
creditsMnuBack_btn = (PushButton*)wmgr->createWindow("TaharezLook/Button", "creditsMnuBack_btn");
creditsMnuBack_btn->setPosition(UVector2(UDim(1.5f, 71.2f), UDim(1.5f, 71.2f)));
creditsMnuBack_btn->setSize(UVector2(UDim(0.2f, 0.15f), UDim(0.15f, 0.15f)));
ImagesetManager::getSingleton().createFromImageFile("creditsMnuBG_img", "E:\\CricCEGUI\\bg.png", "");
creditsMnuBG_img = wmgr->createWindow("TaharezLook/StaticImage", "creditsMnuBG_img");
creditsMnuBG_img->setArea(URect (cegui_reldim (0), cegui_reldim (0), cegui_reldim (1), cegui_reldim (1)));
creditsMnuBG_img->setProperty("FrameEnabled", "false");
creditsMnuBG_img->setProperty("BackgroundEnabled", "false");
creditsMnuBG_img->setProperty("Image", "set:creditsMnuBG_img image:full_image");
creditsWnd->addChildWindow(creditsMnuBG_img);
return true;
}
bool exitHandler(const EventArgs& e)
{
WindowManager::getSingleton().destroyWindow(myRoot);
return true;
}
virtual bool OnEvent(const SEvent& event)
{
bool retval = ::myRenderer.injectEvent(event);
if(retval)
{
return true;
}
return false;
}
void Run()
{
video::IVideoDriver* driver = ::device->getVideoDriver();
ISceneManager* smgr = ::device->getSceneManager();
while (::device->run() && driver)
{
if(::device->isWindowActive())
{
driver->beginScene(true, true, SColor(150, 50, 50, 50));
smgr->drawAll();
System::getSingleton().renderGUI();
driver->endScene();
}
::device->drop();
}
}
~InitialMenu()
{
delete[] InitialMenu::play_btn;
delete[] InitialMenu::credits_btn;
delete[] InitialMenu::exit_btn;
delete[] InitialMenu::fWnd;
delete[] InitialMenu::myRoot;
delete[] InitialMenu::oppcty_cbo;
delete[] InitialMenu::oppcty_img;
delete[] InitialMenu::options_btn;
delete[] InitialMenu::playercty_cbo;
delete[] InitialMenu::playercty_img;
delete[] InitialMenu::playMnuBack_btn;
delete[] InitialMenu::playMnuNext_btn;
delete[] InitialMenu::playWnd;
delete[] InitialMenu::rp;
delete[] InitialMenu::wmgr;
delete[] InitialMenu::creditsWnd;
delete[] InitialMenu::creditsMnuBack_btn;
delete[] InitialMenu::optionsMnuBack_btn;
delete[] InitialMenu::optionsMnuNext_btn;
delete[] InitialMenu::optionsWnd;
delete[] InitialMenu::music_scr;
delete[] InitialMenu::sound_scr;
delete[] InitialMenu::initialMnuBG_img;
delete[] InitialMenu::playMnuBG_img;
delete[] InitialMenu::optionsMnuBG_img;
delete[] InitialMenu::creditsMnuBG_img;
delete device;
}
};
int main ()
{
InitialMenu* initMenu = new InitialMenu();
initMenu->Run();
initMenu->~InitialMenu();
return 0;
}
|
|
|
|
|
Which buffer are you talking about? Give us a hint.
This looks messed up:
InitialMenu* initMenu = new InitialMenu();
initMenu->Run();
initMenu->~InitialMenu();
Normally, you should not call the destructor as a function. Use delete initMenu; instead, and the destructor will be called for you (and the memory you allocated will be freed.)
But I suggest
InitialMenu initMenu;
initMenu.Run();
|
|
|
|
|
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.
|
|
|
|
|