|
What's the easiest way to get IE browser version? I'm using: The "Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++" called CWebBrowser2, and the IWebBrowser2 interface.
|
|
|
|
|
I think the most reliable way is to read the version resource (or call DllGetVersion) in shdocvw.dll. 4.71.* is IE 4, 4.72.* is IE 4.01, 5.* is IE 5, and 6.* is IE 6.
--Mike--
http://home.inreach.com/mdunn/
This posting is provided "as was" with no warranties, guarantees, lotteries, or any of those little bags of peanuts you get on planes. You assume all risk for crossing the street without holding mommy's hand. © 2001 Mike's Classy Software. Member FDIC. If rash develops, discontinue use.
your with and
|
|
|
|
|
My program uses OpenGL to animate in a window. But when that window is minimized the pictures still remain on screen and still animate. Does anyone know how to get rid of this problem.
|
|
|
|
|
You need the CS_OWNDC flag when you create the opengl window.
Todd Smith
|
|
|
|
|
do you know were to place the CS_OWNDC
|
|
|
|
|
the reason I ask is because I placed it at the precreatewindow() and it does not work
|
|
|
|
|
struct a
{
double Val1;
double Val2;
double Val3;
}
how do I overload the operator (+,-,*,/) and (+=,-=,*=,/=,=)
I know that I will be something like
a a::operator + (a paramA1,a paramA2)
{
paramA1.Val1 += paramA2.Val1;
paramA1.Val1 += paramA2.Val1;
paramA1.Val1 += paramA2.Val1;
return paramA1;
}
but for the X= (+=,-=...)
I want it clean... and I was'nt able to find the ABC of overloading operator's the rules and the basis.
thanks
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
I was'nt able to find the ABC of overloading operator's the rules and the basis.
Where did you search?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
in msdn...
I've found that I can overload many operator, += << etc.
and I cannot overload . :: ?:
but no example, for a struct, a class, they said that we can define them as global but when I tried to do it with the = operator.. it didn't work (I've uderstand that I need "this->data"). So, what I want it's the philosophy, my overloaded operator work but I don't think it's the way to do that...
struct AStruct
{
double data[100];
AStruct &AStruct::operator= (AStruct paramA);
};
It's a very beginner info I know but "overloading operator" I'm Ok, but do it well... it's may be an other thing
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
You should read some good C++ book first - 'C++ Language' by Stroustrup or 'Effective C++' by Meyers.
You should pass AStruct by const reference. It's much more effective than passing by value, which involves calling a copy constructor. This applies to all operators and 'normal' functions as well.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
For operators where the left argument is an "a" object, make the method a member of the class:
struct a
{
double d1, d2, d3;
a operator+ (const a& rhs) const;
};
a a::operator+ ( const a& rhs ) const
{
a retval;
retval.d1 = d1 + rhs.d1;
retval.d2 = d2 + rhs.d2;
retval.d3 = d3 + rhs.d3;
return retval;
} For operators where the left argument is not an "a", you need to make the method global:
a operator+ (const double d, const a& rhs )
{
a retval;
a.d1 = d + rhs.d1;
a.d2 = d + rhs.d2;
a.d3 = d + rhs.d3;
return retval;
} Note that if you had a class, and the global operator+ needed to access protected/private members of "a", then the global func would have to be declared as a friend.
--Mike--
http://home.inreach.com/mdunn/
This posting is provided "as was" with no warranties, guarantees, lotteries, or any of those little bags of peanuts you get on planes. You assume all risk for crossing the street without holding mommy's hand. © 2001 Mike's Classy Software. Member FDIC. If rash develops, discontinue use.
your with and
|
|
|
|
|
Hi
Is there a way to start an application (using ShellExecute(Ex)) and send it into the Systray instead of the taskbar?
regards
|
|
|
|
|
Is this your own application which you can modify or is it a third party app?
If it is your app, then you could add code so it checks for a command line parameter which if present minimizes the application to the system tray.
Michael
|
|
|
|
|
And if it's not your own app, perhaps you could SW_HIDE its main window (after locating it) and creating your own systray icon that SW_SHOWs the the main window. Rehiding the app to the systray would be a neat trick.
I believe there's a PC Mag utility (source code included) that does this.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I've been working on this task forever, but...
I am using IPropertyStorage and IPropertySetStorage to obtain and save the summary properties for an
xml file. When I save the xml file with new file data, it creates a new file and therefore doesn't
save the summary properties stream.
USES_CONVERSION;
TCHAR l_szChar[MAX_STR_SIZE+1];
long l_hGeneralInfo = 0;
CComBSTR l_vtPlanInfo;
CComPtr<ispwpersistenceagent> l_spIspwPersistenceAgent;
HRESULT hr = l_spIspwPersistenceAgent.CoCreateInstance(CLSID_spwPersistenceAgent);
if (FAILED(hr))
{
BSTR l_lErrMsg = L"Could not create instance of Persistence Agent";
MessageBox(p_hDlg, l_lErrMsg, _T(""), MB_ICONWARNING);
}
hr = l_spIspwPersistenceAgent->Load(m_szFilePath, VARIANT_TRUE, NULL);
if (FAILED(hr))
{
BSTR l_lErrMsg = L"Could not Load instance of Persistence Agent";
MessageBox(p_hDlg, l_lErrMsg, _T(""), MB_ICONWARNING);
}
// Prepare Persistence Agent for saving command and mission
hr = l_spIspwPersistenceAgent->CreateOrOpenSubElement(
0, GENERAL_INFO, &l_hGeneralInfo);
if (FAILED(hr))
{
BSTR l_lErrMsg = L"Could not Open subelement General Info";
MessageBox(p_hDlg, l_lErrMsg, _T(""), MB_ICONWARNING);
}
// Save the store plan command.
GetDlgItemText(p_hDlg, IDC_SOMEINFO, l_szChar, NSPW_PROP_MAX_STR_SIZE);
l_spIspwPersistenceAgent->put_SubElementValue(l_hGeneralInfo,
SOMEINFO,
CComVariant(T2OLE(l_szChar) ) );
// Save the store plan mission.
GetDlgItemText(p_hDlg, IDC_SOMEOTHERINFO, l_szChar, NSPW_PROP_MAX_STR_SIZE);
l_spIspwPersistenceAgent->put_SubElementValue(l_hGeneralInfo,
SOMEOTHERINFO,
CComVariant(T2OLE(l_szChar) ) );
l_spIspwPersistenceAgent->SaveAs(m_szFilePath, VARIANT_TRUE, NULL);
TCHAR szBuffer[256];
// Save the file properties.
CComPtr<ipropertysetstorage> l_spIPropertySetStorage;
// Open the existing root storage object in the file system.
HRESULT hr = StgOpenStorageEx(m_szFile, STGM_DIRECT|STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
STGFMT_ANY, NULL, NULL, NULL,
IID_IPropertySetStorage,
(void**)&l_spIPropertySetStorage );
if (FAILED(hr))
{
wsprintf(szBuffer, _T("StgOpenStorageEx: 0x%x\n"), hr);
::MessageBox(NULL, szBuffer, _T("StgOpenStorageEx Call"), MB_OK);
I've been working on this task forever, but...
I am using IPropertyStorage and IPropertySetStorage to obtain and save the summary properties for an xml file. When I save the xml file with new file data, it creates a new file and therefore doesn't save the summary properties stream.
USES_CONVERSION;
TCHAR l_szChar[MAX_STR_SIZE+1];
long l_hGeneralInfo = 0;
CComBSTR l_vtPlanInfo;
CComPtr<ispwpersistenceagent> l_spIspwPersistenceAgent;
HRESULT hr = l_spIspwPersistenceAgent.CoCreateInstance(CLSID_spwPersistenceAgent);
if (FAILED(hr))
{
BSTR l_lErrMsg = L"Could not create instance of Persistence Agent";
MessageBox(p_hDlg, l_lErrMsg, _T(""), MB_ICONWARNING);
}
hr = l_spIspwPersistenceAgent->Load(m_szFilePath, VARIANT_TRUE, NULL);
if (FAILED(hr))
{
BSTR l_lErrMsg = L"Could not Load instance of Persistence Agent";
MessageBox(p_hDlg, l_lErrMsg, _T(""), MB_ICONWARNING);
}
// Prepare Persistence Agent for saving command and mission
hr = l_spIspwPersistenceAgent->CreateOrOpenSubElement(
0, GENERAL_INFO, &l_hGeneralInfo);
if (FAILED(hr))
{
BSTR l_lErrMsg = L"Could not Open subelement General Info";
MessageBox(p_hDlg, l_lErrMsg, _T(""), MB_ICONWARNING);
}
// Save the store plan command.
GetDlgItemText(p_hDlg, IDC_SOMEINFO, l_szChar, MAX_STR_SIZE);
l_spIspwPersistenceAgent->put_SubElementValue(l_hGeneralInfo,
SOMEINFO,
CComVariant(T2OLE(l_szChar) ) );
// Save the store plan mission.
GetDlgItemText(p_hDlg, SOMEOTHERINFO, l_szChar, MAX_STR_SIZE);
l_spIspwPersistenceAgent->put_SubElementValue(l_hGeneralInfo,
SOMEOTHERINFO,
CComVariant(T2OLE(l_szChar) ) );
l_spIspwPersistenceAgent->SaveAs(m_szFilePath, VARIANT_TRUE, NULL);
TCHAR szBuffer[256];
// Save the file properties.
CComPtr<ipropertysetstorage> l_spIPropertySetStorage;
// Open the existing root storage object in the file system.
HRESULT hr = StgOpenStorageEx(m_szFile, STGM_DIRECT|STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
STGFMT_ANY, NULL, NULL, NULL,
IID_IPropertySetStorage,
(void**)&l_spIPropertySetStorage );
if (FAILED(hr))
{
wsprintf(szBuffer, _T("StgOpenStorageEx: 0x%x\n"), hr);
::MessageBox(NULL, szBuffer, _T("StgOpenStorageEx Call"), MB_OK);
::MessageBox(NULL, L"StgOpenStorageEx FAILED", L"ApplySummaryDialog", MB_OK);
return S_OK;
}
CComPtr<ipropertystorage> l_spIPropertyStorage;
// Open an interface pointer to the existing property set.
hr = l_spIPropertySetStorage->Open(FMTID_SummaryInformation,
STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
&l_spIPropertyStorage);
wsprintf(szBuffer, _T("Open Summary: 0x%x\n"), hr);
::MessageBox(NULL, szBuffer, _T("HI"), MB_OK);
// If there is no existing property set,
if (FAILED(hr))
{
::MessageBox(NULL, L"l_spIPropertySetStorage->Open returned a FAILED", L"ApplySummaryDialog", MB_OK);
if (hr == STG_E_FILENOTFOUND )
::MessageBox(NULL, L"l_spIPropertySetStorage->Open returned STG_E_FILENOTFOUND so creating one", L"ApplySummaryDialog", MB_OK);
// Create the property set.
hr = l_spIPropertySetStorage->Create(FMTID_SummaryInformation,
&CLSID_spwFilePropShlExt,
PROPSETFLAG_DEFAULT,
STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
&l_spIPropertyStorage);
{
TCHAR tchBuffer[256];
_stprintf(tchBuffer, __TEXT("l_spIPropertySetStorage->Create failed w/error 0x%x\n", hr));
CComBSTR l_bstrErrorMsg(tchBuffer);
::MessageBox(NULL, l_bstrErrorMsg, L"ApplySummaryDialog", MB_OK);
}
return S_OK;
}
PROPSPEC l_aPropertySpec[1];
l_aPropertySpec[0].ulKind = PRSPEC_PROPID;
l_aPropertySpec[0].propid = PIDSI_AUTHOR;
PROPVARIANT l_aResults[1];
// Obtain the author.
hr = l_spIPropertyStorage->ReadMultiple( 1, l_aPropertySpec, l_aResults);
if (FAILED(hr))
{
wsprintf(szBuffer, _T("l_spIPropertyStorage->ReadMultiple: 0x%x\n"), hr);
::MessageBox(NULL, szBuffer, _T("l_spIPropertyStorage->ReadMultiple Call"), MB_OK);
l_aResults[0].pszVal = "";
}
if ( l_aResults[0].vt != VT_LPSTR ) throw _T("vt is not VT_LPSTR");
CComBSTR l_bstrAuthor = l_aResults[0].pszVal;
// Save the author.
hr = l_spIPropertyStorage->WriteMultiple( 1, l_aPropertySpec, l_aResults, NULL );
if (FAILED(hr))
{
wsprintf(szBuffer, _T("l_spIPropertyStorage->WriteMultiple: 0x%x\n"), hr);
::MessageBox(NULL,
szBuffer,
_T("l_spIPropertyStorage->WriteMultiple Call"),
MB_OK);
NSPWPASSERROR(hr,
L"Failed to write author property to storage stream ",
CspwPropPageCtrl::ApplySummaryDialog);
}
l_aPropertySpec[0].ulKind = PRSPEC_PROPID;
l_aPropertySpec[0].propid = PIDSI_COMMENTS;
::MessageBox(NULL,
L"CALLING l_spIPropertyStorage->ReadMultiple",
_T("l_spIPropertyStorage->WriteMultiple Call"),
MB_OK);
// Obtain the comments.
hr = l_spIPropertyStorage->ReadMultiple( 1, l_aPropertySpec, l_aResults);
if (FAILED(hr))
{
wsprintf(szBuffer, _T("l_spIPropertyStorage->ReadMultiple: 0x%x\n"), hr);
::MessageBox(NULL,
szBuffer,
_T("l_spIPropertyStorage->ReadMultiple Call"),
MB_OK);
l_aResults[0].pszVal = "";
}
CComBSTR l_bstrComment = l_aResults[0].pszVal;
::MessageBox(NULL,
L"Calling l_spIPropertyStorage->WriteMultiple",
_T("Comments"),
MB_OK);
// Save the comments.
hr = l_spIPropertyStorage->WriteMultiple( 1, l_aPropertySpec, l_aResults, NULL );
if (FAILED(hr))
{
wsprintf(szBuffer, _T("l_spIPropertyStorage->WriteMultiple: 0x%x\n"), hr);
::MessageBox(NULL, szBuffer, _T("l_spIPropertyStorage->WriteMultiple Call"), MB_OK);
NSPWPASSERROR(hr,
L"Failed to write comments property to storage stream ",
CspwPropPageCtrl::ApplySummaryDialog);
}
::MessageBox(NULL,
L"Calling FreePropVariantArray",
_T("Comments"),
MB_OK);
hr = FreePropVariantArray(2, l_aResults);
::MessageBox(NULL, L"CALLED FreePropVariantArray", _T("FreePropVariantArray Call"), MB_OK);
A colleague has told me it's because I'm trying to save a compound document as a non-compound document.
The l_spIPropertySetStorage->Open call normally fails, so I create the interface pointer. Can someone
please tell me how to fix this?
return S_OK;
}
CComPtr<ipropertystorage> l_spIPropertyStorage;
// Open an interface pointer to the existing property set.
hr = l_spIPropertySetStorage->Open(FMTID_SummaryInformation,
STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
&l_spIPropertyStorage);
wsprintf(szBuffer, _T("Open Summary: 0x%x\n"), hr);
::MessageBox(NULL, szBuffer, _T("HI"), MB_OK);
// If there is no existing property set,
if (FAILED(hr))
{
::MessageBox(NULL, L"l_spIPropertySetStorage->Open returned a FAILED", L"ApplySummaryDialog", MB_OK);
if (hr == STG_E_FILENOTFOUND )
::MessageBox(NULL, L"l_spIPropertySetStorage->Open returned STG_E_FILENOTFOUND so creating one", L"ApplySummaryDialog", MB_OK);
// Create the property set.
hr = l_spIPropertySetStorage->Create(FMTID_SummaryInformation,
&CLSID_spwFilePropShlExt,
PROPSETFLAG_DEFAULT,
STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
&l_spIPropertyStorage);
{
TCHAR tchBuffer[256];
_stprintf(tchBuffer, __TEXT("l_spIPropertySetStorage->Create failed w/error 0x%x\n", hr));
CComBSTR l_bstrErrorMsg(tchBuffer);
::MessageBox(NULL, l_bstrErrorMsg, L"ApplySummaryDialog", MB_OK);
}
return S_OK;
}
PROPSPEC l_aPropertySpec[1];
l_aPropertySpec[0].ulKind = PRSPEC_PROPID;
l_aPropertySpec[0].propid = PIDSI_AUTHOR;
PROPVARIANT l_aResults[1];
// Obtain the author.
hr = l_spIPropertyStorage->ReadMultiple( 1, l_aPropertySpec, l_aResults);
if (FAILED(hr))
{
wsprintf(szBuffer, _T("l_spIPropertyStorage->ReadMultiple: 0x%x\n"), hr);
::MessageBox(NULL, szBuffer, _T("l_spIPropertyStorage->ReadMultiple Call"), MB_OK);
l_aResults[0].pszVal = "";
}
if ( l_aResults[0].vt != VT_LPSTR ) throw _T("vt is not VT_LPSTR");
CComBSTR l_bstrAuthor = l_aResults[0].pszVal;
// Save the author.
hr = l_spIPropertyStorage->WriteMultiple( 1, l_aPropertySpec, l_aResults, NULL );
if (FAILED(hr))
{
wsprintf(szBuffer, _T("l_spIPropertyStorage->WriteMultiple: 0x%x\n"), hr);
::MessageBox(NULL,
szBuffer,
_T("l_spIPropertyStorage->WriteMultiple Call"),
MB_OK);
NSPWPASSERROR(hr,
L"Failed to write author property to storage stream ",
CspwPropPageCtrl::ApplySummaryDialog);
}
l_aPropertySpec[0].ulKind = PRSPEC_PROPID;
l_aPropertySpec[0].propid = PIDSI_COMMENTS;
::MessageBox(NULL,
L"CALLING l_spIPropertyStorage->ReadMultiple",
_T("l_spIPropertyStorage->WriteMultiple Call"),
MB_OK);
// Obtain the comments.
hr = l_spIPropertyStorage->ReadMultiple( 1, l_aPropertySpec, l_aResults);
if (FAILED(hr))
{
wsprintf(szBuffer, _T("l_spIPropertyStorage->ReadMultiple: 0x%x\n"), hr);
::MessageBox(NULL,
szBuffer,
_T("l_spIPropertyStorage->ReadMultiple Call"),
MB_OK);
l_aResults[0].pszVal = "";
}
CComBSTR l_bstrComment = l_aResults[0].pszVal;
::MessageBox(NULL,
L"Calling l_spIPropertyStorage->WriteMultiple",
_T("Comments"),
MB_OK);
// Save the comments.
hr = l_spIPropertyStorage->WriteMultiple( 1, l_aPropertySpec, l_aResults, NULL );
if (FAILED(hr))
{
wsprintf(szBuffer, _T("l_spIPropertyStorage->WriteMultiple: 0x%x\n"), hr);
::MessageBox(NULL, szBuffer, _T("l_spIPropertyStorage->WriteMultiple Call"), MB_OK);
NSPWPASSERROR(hr,
L"Failed to write comments property to storage stream ",
CspwPropPageCtrl::ApplySummaryDialog);
}
::MessageBox(NULL,
L"Calling FreePropVariantArray",
_T("Comments"),
MB_OK);
hr = FreePropVariantArray(2, l_aResults);
::MessageBox(NULL, L"CALLED FreePropVariantArray", _T("FreePropVariantArray Call"), MB_OK);
A colleague has told me it's because I'm trying to save a compound document as a non-compound document. The l_spIPropertySetStorage->Open call normally fails, so I create the interface pointer.
Can someone please tell me how to fix this?
Lilian
|
|
|
|
|
Hi,
I have a graphics ActiveX control sitting on a CFormView derived class in an SDI application. I recently found an article about tooltips from April '97 in MSJ searching through MSDN. I've implemented that solution and it seems to work except for a few little problems that I was wondering if someone has seen before.
When I get the tooltip that is over a particular area of the image (hotspot) the tooltip shows up right under the mouse. It also shows up at the bottom of the CFormView window, so I now get two tooltips and I can't figure out how to get rid of the one along the bottom of the window.
Following is the code that I'm using, any help in this matter is greatly appreciated.
Thanks,
Craig
void CImageViewer::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
if (m_ToolTip.Create(&m_lead, TTS_ALWAYSTIP) &&
m_ToolTip.AddTool(&m_lead))
{
m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, SHRT_MAX);
m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_AUTOPOP, SHRT_MAX);
m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_INITIAL, 200);
m_ToolTip.SendMessage(TTM_SETDELAYTIME, TTDT_RESHOW, 200);
}
else
{
TRACE("Error in creating ToolTip");
}
}
BOOL CImageViewer::PreTranslateMessage(MSG* pMsg)
{
if (::IsWindow(m_ToolTip.m_hWnd) && pMsg->hwnd == m_lead.m_hWnd)
{
switch(pMsg->message)
{
case WM_LBUTTONDOWN:
case WM_MOUSEMOVE:
case WM_LBUTTONUP:
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MBUTTONUP:
{
if(vecRects.size() > 0)
{
CPoint pt(pMsg->pt);
ScreenToClient(&pt);
float zoom = m_lead.GetPaintZoomFactor();
float ix, iy;
int xscroll, yscroll;
xscroll = m_lead.GetScrollPos(SB_VERT);
yscroll = m_lead.GetScrollPos(SB_HORZ);
float newzoom = zoom / 100;
ix = (pt.x + xscroll) * newzoom;
iy = (pt.y + yscroll) * newzoom;
pMsg->pt.y = iy;
pMsg->pt.x = ix;
m_lead.SetAutoRepaint(TRUE);
m_ToolTip.RelayEvent(pMsg);
}
m_ToolTip.RelayEvent(pMsg);
break;
}
default:
break;
}
}
return CFormView::PreTranslateMessage(pMsg);
}
BOOL CImageViewer::OnToolTipNeedText(UINT id, NMHDR * pNMHDR, LRESULT * pResult)
{
BOOL bHandledNotify = FALSE;
CPoint CursorPos;
VERIFY(::GetCursorPos(&CursorPos));
ScreenToClient(&CursorPos);
CRect ClientRect;
GetClientRect(ClientRect);
if (ClientRect.PtInRect(CursorPos))
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
m_pRectHit = HitTest(CursorPos);
if (m_pRectHit)
{
CString strTip;
strTip.Format("%s %s", m_pRectHit->szPartNumber.c_str(),
m_pRectHit->szDescription.c_str());
ASSERT(strTip.GetLength() < sizeof(pTTT->szText));
::strcpy(pTTT->szText, strTip);
bHandledNotify = TRUE;
}
else
{
pTTT->szText[0] = 0;
}
}
return bHandledNotify;
}
void CImageViewer::OnMouseMoveLeadctrl(short Button, short Shift, long x, long y)
{
if (::IsWindow(m_ToolTip.m_hWnd))
{
CPoint point(x, y);
const CRects* pRectHit = HitTest(point);
if (!pRectHit || pRectHit != m_pRectHit)
{
m_ToolTip.Activate(FALSE);
}
if (pRectHit)
{
m_ToolTip.Activate(TRUE);
m_pRectHit = pRectHit;
}
}
}
|
|
|
|
|
Hi,
When I print a draft I want to draw in the top of the page a little subindex, something like "(1/1)"...("1/2"), ...
I would like to print it in the smallest possible readable and common font for Windows, wich one is it ?
I would like to know how to calculate the size of that in milimeters in order to substract it to the actual size of the paper just to resize the metafile ( or if it´s possible to print it in the margin and not to take any extra place).
Can you help me ? Thanks, Bye
Braulio
|
|
|
|
|
If you have a printer DC to print with, you can query it to find out how many pixels/inch you get like this:
x_pixels = pDC->GetDeviceCaps(LOGICALPIXELX) ;
y_pixels = pDC->GetDeviceCaps(LOGICALPIXELSY) ;
x_size = pDC->GetDeviceCaps(HORZRES) ;
y_size = pDC->GetDeviceCaps(VERTRES) ;
From these values you can determine what minimum font size you would need, (lets say you wanted your test to be .1 inch high). You can then offset you regular printing from that point on.
The above was written from memory , so the passed parameters may not be exactly correct.
Roger Allen the man
|
|
|
|
|
Problem:
I am trying to get an IHTMLWindow2 interface from the WebBrowser control. I am successful at querying for a IWebBrowser2 interface, but I have yet to figure out how to retrieve an IHTMLWindow2 interface. Anyone that has information reguarding this please feel free to respond.
Jamie Parent
VC++ Software Deveoloper
Digital Immersion
|
|
|
|
|
I tried to get an IHTMLWindow2 interface using your suggestion, but was unsuccessful. I need to use the function HRESULT IHTMLWindow2::get_history(IOmHistory **p), but I have yet to find a way to reach that interface.
Perhaps I am not looking at the right place or that interface is not reachable. I am a little new to this area of VC++, please excuse me if the answer might be apparent.
|
|
|
|
|
I have used the makefile(s) that VC++ generates in order to create a batch file that could automate system rebuilds. The problem with it is that it is still a manual process to export the makefile, especially following some project change, ie. adding new files. Is there a way to put together a batch file that can be executed such that it will cause VC++ projects to be completely rebuilt.
What I'm lookng for is something like the following
C:\...\msdev.exe -RebuildAll Project1.dsp -Silent -ErrorLog BuildProject1Error.txt
and to then have the project loaded and all configurations rebuilt from scratch. This would also include any special pre-build and post build operations.
Anyone know of some way of doing this?
Thanks.
Chris Meech
Is such a
|
|
|
|
|
VC++ User's Guide/Working with Projects/How Do I.../Building a Project/Building a Project from the Command Line.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Tomasz, you keep this up and you will be getting my Gold Star for the week.
I have just traversed into the User's manual to the page you hilighted for me and that is exactly what I'm looking for.
Thanks once again.
Chris Meech
|
|
|
|
|
How can i let the users browse a DIRECTORY ( not a file! )
(let's say when cliking on the BROWSE button)???
it would be a great help
|
|
|
|
|
If you are looking for a DirOpenDialog, use this function:
SHBrowseForFolder( BROWSEINFO *mPtrBInfo );
Look in MSDN for detail info about the BROWSEINFO structure.
You can use this for Printer, Network resource, etc...
BOOL SelectFolder( CString& nFolderName, LPCTSTR nTitulo, UINT nFlags )
{
BOOL bRet;
char pszPath[MAX_PATH];
BROWSEINFO mPtrBInfo;
mPtrBInfo.hwndOwner = NULL; // HWND
mPtrBInfo.pidlRoot = NULL; // LPCITEMIDLIST
mPtrBInfo.pszDisplayName = pszPath; // LPTSTR
mPtrBInfo.lpszTitle = nTitulo; // LPCTSTR
mPtrBInfo.ulFlags = nFlags | BIF_RETURNONLYFSDIRS;
mPtrBInfo.lpfn = NULL; // BFFCALLBACK
mPtrBInfo.lParam = 0L; // LPARAM
mPtrBInfo.iImage = 0; // int
if ( OleInitialize( NULL ) != S_OK )
AfxMessageBox( "Error inicializando OLE" );
ITEMIDLIST *mPtrIList = SHBrowseForFolder( &mPtrBInfo );
bRet = SHGetPathFromIDList( mPtrIList, pszPath );
OleUninitialize();
if ( bRet )
nFolderName = pszPath;
return bRet;
}
|
|
|
|
|