|
|
I've an MDI app with two different html views and when I dynamicaly change content of first view, with for example:
CComPtr <IDispatch> pDisp = GetHtmlDocument();
if (pDisp)
{
CComQIPtr <IHTMLDocument2> pHtmlDoc2;
pHtmlDoc2 = pDisp;
if (pHtmlDoc2)
{
// ...
// some code here
// ...
}
}
and then I try to do something similar in second view, GetHtmlDocument() returns NULL. I don't know why? Please help.
Best regards
r2-r
|
|
|
|
|
hi- any body helps me
i want to make an application which will stop explorer popup adds.like popkiller.com noads.exe.
i am using vc++ 6 windows 2000.
Please Give an idea not code
Ibrar Ahmad
Softare Engr.
Comcept PVT LTD.
Islamabad
abrar_@yahoo.com
|
|
|
|
|
write it as an http proxy and deny the popup-ads
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I have write this but its not good for doing lot of work on small problem.It should filter entire conents so it slow down net speed.Look at popup add filetr.noadds they dont write any proxy but works fine.there size are just few k
Ibrar Ahmad
Softare Engr.
Comcept PVT LTD.
Islamabad
abrar_@yahoo.com
|
|
|
|
|
Writing a popup window killer is quite easy - write a browser helper object. IE creates an instance of all BHOs when a browser window is created. Your BHO can check the window properties, and make a judgement based on them. For instance, if there's no menu, toolbar, and status bar, chances are it's an ad window, so your BHO can close the window.
Doing good ad filtering requires a proxy so you can intercept the HTML and remove <img> tags and whatnot.
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
How about writinng a BHO that intercepts all OnNewWindow and kills them unless the user specificliy asks to open in a new window. Don't know how the examples you used works, but it is probably some kind of logic depending on how the window created looks like (status bar, explorer bar, document contains only one link and an image...)
/moliate
|
|
|
|
|
can u give me some sample code i am new for ie programming
Ibrar Ahmad
Softare Engr.
Comcept PVT LTD.
Islamabad
abrar_@yahoo.com
|
|
|
|
|
First, create an ATL_COM project, using the AppWizard. Add a new ALT object, and change the implementation so it supports <code>IObjectWithSite</code>. The code will look something like this:
<pre>
class ATL_NO_VTABLE CIEHelp :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CIEHelp, &CLSID_IEHelp>,
public IObjectWithSiteImpl<CIEHelp>, // Add this <H>
public IDispatchImpl<IIEHelp, &IID_IIEHelp, &LIBID_KILLPOPUPLib>
{
....
BEGIN_COM_MAP(CIEHelp)
COM_INTERFACE_ENTRY(IIEHelp)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY_IMPL(IObjectWithSite) // ... and this. <H>
END_COM_MAP()
....
</pre>
Then override <code>IObjectWithSite::SetSite</code> and <code>IDispatch::Invoke</code>. SetSite will get you a pointer to the <code>IWebBrowser2</code> interface, and allow you to <code>Advise</code> to get events. Invoke is where the events go. If you find a new window opening, kill it.. You can switch the DISPID parameter and look for <code>DISPID_NEWWINDOW2</code>. When you got an event you can get the IE instance like this:
<pre>
// in IDispatch implementation
switch(dispidMember)
...
case DISPID_NEWWINDOW2:
IWebBrowser2* pIE;
if (pDispParams->cArgs > 0 && pDispParam->rgvarg[0].vt == VT_DISPATCH)
{
//else we have an error <H>
HRESULT hr = CoCreateInstance(CLSID_InternetExplorer,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2,
(void**)&pIE);
hr = pIE->put_RegisterAsBrowser(TRUE);
hr = pIE->get_Application(pDispParam->rgvarg[0]);
// do stuff, like looking at browser properties, document properties
// and so on, and if the new window is unwanted:
hr = pIE->Quit();
//cleanup
}
break;
</pre>
Finally edit the Registry script to register as a BHO. The rgs file will look something loke this, just edit names and GUIDS:
<pre>
HKCR
{
IEHlprObj.IEHlprObj.1 = s 'IEHlprObj Class'
{
CLSID = s '{CE7C3CF0-4B15-11D1-ABED-709549C10000}'
}
IEHlprObj.IEHlprObj = s 'IEHlprObj Class'
{
CurVer = s 'IEHlprObj.IEHlprObj.1'
}
NoRemove CLSID
{
ForceRemove {CE7C3CF0-4B15-11D1-ABED-709549C10000}
= s 'IEHlprObj Class'
{
ProgID = s 'IEHlprObj.IEHlprObj.1'
VersionIndependentProgID = s 'IEHlprObj.IEHlprObj'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
}
}
}
HKLM
{
SOFTWARE
{
Microsoft
{
Windows
{
CurrentVersion
{
Explorer
{
'Browser Helper Objects'
{
{CE7C3CF0-4B15-11D1-ABED-709549C10000}
}
}
}
}
}
}
}
</pre>
I havn't tested any of the code, but hope it will get you on your way. There are probably lots of tutorials on BHOs if you run into any problems...
/moliate
|
|
|
|
|
Hi,
In my SDK application i want to add a set a strings to a ListBox . I'm searching for a set of files from a directory and i want to add those files to the list box. How can i solve it.
vini
|
|
|
|
|
Check out LB_ADDSTRING and LB_INSERTSTRING
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I don't know how to go to the URL from the program.
As I am the Beginner, I knew basic syntax of C++. However, I do not have the concept of internet programming.
My question is:
When I write the C++ program based on MFC, I want to click the button so that the browser will open automatically and go to the specific URL. I think it is not difficult but I spent much time on it. (This is such like the function "help" of most software program. When the user clicks on the "help" button, the browser is opened and go to the URL) Can anyone help?
Thank you.
Dicky
|
|
|
|
|
Use ShellExecute to run the default browser:
ShellExecute ( hwndYourWindow, "open", "http://xxx.yyy.com/help.html", NULL, NULL, SW_SHOW );
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I've designed the interface to my application in the following manner:
To the left of the application main window are 5 buttons, placed vertically (Button1,Button2 etc). Each button have an associated property sheet.On clicking each button ,it should open its corresponding property sheet within the right hand side of the application window.But the following code displays the property sheet in a new window.
// OnClickButton1 function
// a property sheet is created with two tabbed controls tab1 and tab2
PropertySheet prop1("Option1");
CTab1 Tab1; // CTab1 is derived from PropertyPage
CTab2 Tab2; // CTab2 is derived from PropertyPage
prop1.AddPage(&Tab1);
prop1.AddPage(&Tab2);
prop1.DoModal();
How can i modify the code in such a way that the property sheet opens within the right side of the main window rather than in a new window? ie,the main window should contain the property sheet or the property sheet should not have the titlebar..please help me..
anish
|
|
|
|
|
|
What do you mean by that?
All processes will have their own current directory.
If you mean the shell, then the default directory is the desktop [not 100% sure abt this though]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I have encountered this error
layer.obj : error LNK2005: "public: __thiscall input_layer::input_layer(int,int)" (??0input_layer@@QAE@HH@Z) already defined in back_prp.obj
fatal error LNK1169:one or more multiply defined symbols found
solution for this one is required urgently.
And also can't we declare 2 .CPP files in one project??
Thanks in advance
anila
Student
Masters of Computer Sciences
knowledge seeker
|
|
|
|
|
I'm a little puzzled about the error message but it appears as if you've defined the same variable in those two files.
1. Rebuild the whole project.
2. If that doesn't fix it, take a look at this related explanation I wrote about a while back.
Regards,
Alvaro
|
|
|
|
|
Part of the project that I'm working on is placing text over the child window. The user must be able to set font, resize and move text "object" inside the child window client area at any time.
I succeeded in creating transparent window with some text drawn inside, but window repainting is absolutely unpredictable and it is effecting the whole application.
Any suggestions/ideas on this subject?
Thanks in advance
|
|
|
|
|
Transparent windows are not actually transparent, they just don't redraw properly. They are, as you say, unpredictable.
I did this in a paint type package, and I just kept a vector ( an array ) of structures that told me what string to draw, in what font, and the bounding rect to all me to select items when they were clicked on.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Maybe the simple way is better: draw text in child the window itself using TRANSPARENT background mode?
|
|
|
|
|
Christian and Alex, thanks for your input.
|
|
|
|
|
I hope this is an easy one....
How do I get the time between clicks that counts as a double-click?
I can find the allowed difference via GetSystemMetrics(...) but I can't find the time. I hate hard coding this type of thing.....
|
|
|
|
|
It doesn't happen often but Microsoft actually came up with a function with a good name for this: GetDoubleClickTime.
Regards,
Alvaro
|
|
|
|
|
Thanks. That was too easy!!!! Can you tell it's Friday?
|
|
|
|