|
There is no keyword super in C++. It's available only in Java.
I am not seeing any problem whatsoever using the Sort function of the Base class. Just call the method Sort(...) and pass the parameters. As long as the Sort method is not virtual, you will always end-up in the Base class method.
Alternatively you can think of making Sort(...) method static as long as it is not refering any class memebers and you are passing all the values in the parameter list. You can invoke the method using CGenericListCtrl::Sort(...)
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Thanks for the response guys. Problem is that OnColumnClick is invoked from the dervied class and during that event I am not sure how can I pass this additional variable containing type of the header. Is there any lParam type of thing that I use to fill in this info? Thanks
|
|
|
|
|
I was browsing through the site a few weeks ago, and came a cross a simple http client that would run from a command line in the command prompt. I have tried searching again for it to no avail.. do projects sometimes get taken off of this site? If not, does anyone know which one I am talking about, and maybe provide a link?
|
|
|
|
|
conrad10781 wrote: do projects sometimes get taken off of this site?
Occasionally, authors request that their articles are removed, so yes. Also, sometimes articles are moved between categories.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I'm clueless about using the IHTMLDocument2 interface. How do I use it to load a url or a html document? What about IDispatch Interface, do I need to use it?
|
|
|
|
|
|
Hmm what about the IHTMLDocument2 interface? how do I link the url to this interface?
|
|
|
|
|
|
Hmm what if I want to load the html document saved to disk?
|
|
|
|
|
Try this. It uses ATL. It extracts the text from google and prints it in a message box. I wipped it up pretty quickly so it's not perfect, but it works.
---
// Only needed if you're using an old SDK that hasn't got this. Remove
// if it clashes with your SDK.
MIDL_INTERFACE("3050f613-98b5-11cf-bb82-00aa00bdce0b")
HTMLDocumentEvents2 : public IDispatch
{
};
// Class to wait for the ready state to change to "complete"
// while running a message loop.
class ATL_NO_VTABLE CReadyStateComplete :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatch
{
public:
CReadyStateComplete() : m_spDoc2(NULL)
{
m_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
}
~CReadyStateComplete()
{
CloseHandle(m_hEvent);
}
void SetDocument(IHTMLDocument2* pDoc2)
{
m_spDoc2 = pDoc2;
}
DECLARE_NO_REGISTRY()
BEGIN_COM_MAP(CReadyStateComplete)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
void Wait()
{
AtlWaitWithMessageLoop(m_hEvent);
}
public:
STDMETHOD(GetTypeInfoCount)(UINT* pctinfo)
{
return E_NOTIMPL;
}
STDMETHOD(GetTypeInfo)(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
{
return E_NOTIMPL;
}
STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames,
LCID lcid, DISPID* rgdispid)
{
return E_NOTIMPL;
}
STDMETHOD(Invoke)(
/*[in]*/ DISPID dispIdMember,
/*[in]*/ REFIID riid,
/*[in]*/ LCID lcid,
/*[in]*/ WORD wFlags,
/*[in, out]*/ DISPPARAMS * pDispParams,
/*[out]*/ VARIANT * pVarResult,
/*[out]*/ EXCEPINFO * pExcepInfo,
/*[out]*/ UINT * puArgErr)
{
if ( dispIdMember == DISPID_READYSTATECHANGE )
{
CComBSTR State;
if ( SUCCEEDED(m_spDoc2->get_readyState(&State)) )
{
if ( wcscmp(State, L"complete")==0 )
{
SetEvent(m_hEvent);
}
}
return S_OK;
}
return DISP_E_MEMBERNOTFOUND;
}
private:
CComPtr<IHTMLDocument2> m_spDoc2;
HANDLE m_hEvent;
};
void ExtractText()
{
HRESULT hr;
// Get a stream on the URL.
CComPtr<IMoniker> spMk;
hr = CreateURLMoniker(NULL, OLESTR("http://www.google.com/"), &spMk);
if ( FAILED(hr) )
{
return;
}
CComPtr<IBindCtx> spCtx;
hr = CreateBindCtx(0, &spCtx);
if ( FAILED(hr) )
{
return;
}
CComPtr<IStream> spStream;
hr = spMk->BindToStorage(spCtx, 0, IID_IStream, (void**)&spStream);
if ( FAILED(hr) )
{
return;
}
// Create the HTMLDocument object.
CComPtr<IUnknown> spUnk;
hr = spUnk.CoCreateInstance(CLSID_HTMLDocument);
if ( FAILED(hr) )
{
return;
}
CComQIPtr<IPersistStreamInit> spPSI(spUnk);
if ( !spPSI )
{
return;
}
CComQIPtr<IHTMLDocument2> spDoc2(spUnk);
if ( !spDoc2 )
{
return;
}
// Set up our object which watches the ready state of the document.
CComObjectGlobal<CReadyStateComplete> RS;
RS.SetDocument(spDoc2);
DWORD Cookie;
hr = AtlAdvise(spUnk, &RS, __uuidof(HTMLDocumentEvents2), &Cookie);
if ( FAILED(hr) )
{
return;
}
// Load the data from the URL into the object.
hr = spPSI->Load(spStream);
if ( FAILED(hr) )
{
AtlUnadvise(spUnk, __uuidof(HTMLDocumentEvents2), Cookie);
return;
}
// Wait (while running a message pump so MSHTML can work) till ready.
RS.Wait();
AtlUnadvise(spUnk, __uuidof(HTMLDocumentEvents2), Cookie);
// Print out the text in a message box.
CComPtr<IHTMLElement> spBodyElement;
hr = spDoc2->get_body(&spBodyElement);
if ( FAILED(hr) )
{
return;
}
CComBSTR Text;
hr = spBodyElement->get_outerText(&Text);
if ( FAILED(hr) )
{
return;
}
MessageBoxW(NULL, Text, L"Text", MB_OK);
}
Steve
-- modified at 7:41 Friday 3rd February, 2006
Added AtlUnadvise calls without testing......
|
|
|
|
|
Hi,
I am using Visual Studio .Net 2003. I compiled my MFC application in release mode. I then clicked on the executable, and my MFC GUI started. However, when I transfer the executable to other companies, the GUI doesn't start (actually, no response at all) when I click on the executable file. So does anyone why is this?
Thank you very much!!!!!!
|
|
|
|
|
the problem would be related mfc 7.0 dlls or dotnet 1.1 env..
Anderson Sheen (exteide@gmail.com)
The Extension IDE: http://www.exteide.com
|
|
|
|
|
You need to make sure that you send the MFC libraries along with your application. The libraries for the version of MFC in VS2003 are version 7.1.
I'm not sure this is all of your problem, however. Missing libraries usually causes a message box to appear. If you're not getting any response from the application, then there may be an additional problem involved.
Software Zen: delete this;
|
|
|
|
|
Thanks for your help
Now, I ask my friend to open my project and then re-compile, however, he got these 2 error messages:
LNK4098: defaultlib "LIBC" conflicts other libraries, please use /NODEFAULTLIB:Libray
LNK4098: reference to all of 'OLEAUT32.dll' are deleted by /OPT:REF
So what do these two messages mean? How can I fix them?
Thanks a lot
|
|
|
|
|
Hi all,
I am trying to write an application that will allow me to create a new Email account in Outlook Express.
The app has 3 fields that will need to be filled out:
- Display Name
- Username
- Password
Now, the problem that I have is, that the Password value from this field doesn't get written correctly into the Registry.
I am using the following code:
RegSetValueEx(hKey, "POP3 Password2", 0, REG_BINARY,(const BYTE *)&custpass,sizeof(custpass));
Can anyone help me out with this???
Thanks
amano
|
|
|
|
|
Could you show the type of the variable custpass .
Steve
|
|
|
|
|
Hi Steve,
I think that's the type here
CString custpass;
amano
|
|
|
|
|
Ok then. Try this:
<br />
RegSetValueEx(<br />
hKey,<br />
"POP3 Password2",<br />
0,<br />
REG_BINARY,<br />
reinterpret_cast<const BYTE*>(static_cast<LPCTSTR>(custpass))<br />
);<br />
Steve
PS: This is the kind of problem you get when you mix the low level (the RegSetValueEx API) with the high level (CString).
|
|
|
|
|
I just tried to compile it with the new code, but am getting the following error message:
error C2660: 'RegSetValueExA' : function does not take 5 parameters
|
|
|
|
|
Ok, I forgot the size parameter. Try this:
RegSetValueEx(<br />
hKey,<br />
"POP3 Password2",<br />
0,<br />
REG_BINARY,<br />
reinterpret_cast<const BYTE*>(static_cast<LPCTSTR>(custpass)),<br />
(custpass.GetLength()+1)*sizeof(TCHAR)<br />
);
Steve
|
|
|
|
|
Ok...just been able to try this out.
The password is still not being saved to the Registry.
Does it matter where i am trying to write it to?
I am writing it to HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts\
amano
|
|
|
|
|
amano8u wrote: HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts\
HI,
first try by writing some dummy text there!, if you successful in writing that, then try the ansqwer mentioned by Mr. Hewitt
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow cheers, Alok Gupta VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi Alok,
I don't understand what you mean? I am able to write text there and create the keys and etc. if that is what you are referring to. I am unable to write the correct data there.
amano
|
|
|
|
|
Are you sure you need to save it as binary, not as text? I don't know what OE expects.
Also, does your user account have permissions to alter this part of the registry?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hey Ryan,
i am trying to replicate what the OE wizard does. That one stores the value as a Binary.
But if text will do the trick i am happy to use that. Do you have an example how it would be written if it is to store it as text?
Would i be replacing the "REG_BINARY" to "REG_SZ" ??
and yeah permissions are available to alter the Registry.
amano
|
|
|
|