Search This Blog

Thursday, January 1, 2009

How to include library File without using project seettings

include following line in your program

#pragma comment (lib, "yourLibname.lib")

Example:
#pragma comment (lib, "wbemuuid.lib")

Getting all Titles in Internet explorer running instance using COM

#import "mshtml.tlb" // Internet Explorer 5
#include "msHtml.h"
#include "ExDispID.h"
#import "shdocvw.dll"

#include "ExDisp.h"

void CIETabTiltleDlg::OnBnClickedOk() // Copy the following lines
{
SHDocVw::IShellWindowsPtr m_spSHWinds;
m_spSHWinds.CreateInstance(__uuidof(SHDocVw::ShellWindows));
ASSERT(m_spSHWinds != NULL);

CString strCount,m_strWinCount;
long nCount = m_spSHWinds->GetCount();
strCount.Format("%i", nCount);
m_strWinCount = strCount;

IDispatchPtr spDisp;
for (long i = 0; i <>
{
_variant_t va(i, VT_I4);
spDisp = m_spSHWinds->Item(va);
SHDocVw::IWebBrowser2Ptr spBrowser(spDisp);
if (spBrowser != NULL)
{
//m_ctlListLoc is the name of list box of your application

m_ctlListLoc.AddString(spBrowser->GetLocationName());
MSHTML::IHTMLDocument2Ptr spDoc(spBrowser->GetDocument());
if (spDoc != NULL)
{
//m_ctlListTitle is the name of list box of your application
m_ctlListTitle.AddString(spDoc->Gettitle());
}
}
}
m_spSHWinds=NULL;
}

Windows Vista User Account Control article

A nice article about "Windows Vista User Account Control" tips and problems in your programs about Administrators privileges.

Using DLLs and The Windows API in Visual Basic 6.0

Following Link has tutorials about Using DLLs and The Windows API in Visual Basic 6.0

error C2664: 'void ATL::CStringT::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wc

If you are getting following error:
error C2664: 'void ATL::CStringT::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [3]' to 'const wchar_t *'

Solution1:
In Project Menu select your Project Properties.

In Configuration Properties
Set "Character Set" as "Use Multi-Byte Character Set"

Solution2:
where ever you are declaring "CString" variable add Unicode support.
Example:
CString csStr(_T("")); //_T("") is for unicode support