|
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
"Don't belong. Never join. Think for yourself. Peace"
- Victor Stone
|
|
|
|
|
Put it in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run if you want it for all users
Nish
|
|
|
|
|
Hello. Thanks for responding so quickly. I've got a followup question:
<br>
CRegKey key;
<br>
key.Open(HKEY_LOCAL_MACHINE, "\\Software\\Microsoft\\Windows\\CurrentVersion\\Run");
key.SetKeyValue("Igloo", "foo");
key.Close();
This tends to ASSERT. Do you immediately spot anything wrong with the method I'm using to add a Name "Igloo" and a value "foo" (which will be the program's filespec.)
-Jason
|
|
|
|
|
I'd say the \\Software\\... should be just Software\\.....
A vast majority of our imports comes from outside the country.
George W. Bush
|
|
|
|
|
In Win2000 in the control panel there is Scheduled Tasks. You can set this up there. It may just make the registery entry for you... but it is easy.
|
|
|
|
|
Not so much of a problem, since i've fixed it now with a workaround. But i am interested as to exactly why it happened.
I created a custom button, derived from cbutton (obviously). I overrode the drawitem function and a few others to do some mouseover effects. The button was drawn to look exactly the same as a standard windows 9x button. I wanted to create a highlight when the user clicked on the button. So, before drawing the rectangle for the border of the button, i created and selected a lighter grey brush for the highlight;
if(lpDrawItemStruct->itemState & ODS_SELECTED)
{
Create and select much lighter gray brush
Draw rectangle
Delete the brush
}
The problem is, when i release the mouse button, the lighter gray brush is still drawn, even though the button isn't selected. It stays there until the cursor moves out of the button's rectangle. Therefore, when drawitem is called, it can't be going through the above if since itemState is not going to contain ODS_SELECTED . I also checked this using TRACE . Anyone know why? It's probably blindingly obvious, but it's getting late and my head hurts.
My workaround was to invalidate the button during OnLButtonUp().
Simon
|
|
|
|
|
When I call CRichEditView::InsertFileAsObject, I can't figure out how to resize the file icon that appears in the rich edit control. I've tried overriding such things as COleContainerItem::OnGetItemPosition and calling COleContainerItem::SetItemRects, but either they do nothing or cause assertions. Thanks for the Help.
|
|
|
|
|
Does anyone know where I can download the Debug symbols for Windows XP? Or is it part of the platform SDK? If so, is there a way to download that information independent of the other information on the SDK?
Thanks in advance for any answer. Sorry if this sounds all dicombobulated, had too much coffee trying to figure out a problem I'm having. :-|
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
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
|
|
|
|
|