|
This way allows to avoid wrong drawing,but it waste one more redrawing...
void CBridgeProfView::SetFitToViewPort()
{
ShowScrollBar(SB_BOTH,false);
....
....
....
SendMessage(WM_PAINT,0,0);
Invalidate();
}
Alex Kekukh
|
|
|
|
|
I have tried to look at having tooltips on my tree ctrl items but I have problems. One is that if my item text is longer than the tree control width it nicely shows the whole text in a tooltip like window so maybe I should not have a tooltip now. What I like now is to have option to right click on an item then get a tooltip displayed.
Can any one help with this?
Thank you
|
|
|
|
|
Go into Classwizard and implement a function for the NM_RCLICK message. You can then call GetSelectedItem() to get your item, and then other functions like GetItemData() and GetItemText . To display your item's text in a tooltip, look here[^]
"Oh, I'm sick of doing Japanese stuff! In jail we had to be in this dumb kabuki play about the 47 Ronin, and I wanted to be Oshi, but they made me Ori!"
|
|
|
|
|
That works now
Now when I right-click on my item it is not selected. I have to left click first which selects it. Then I must right-click on it to get the right item. How must right clicking select an item as though it is left clicking?
|
|
|
|
|
I have a question concerning the declaration of an operator. I'd like to define a "+" operator. Looks below this:
const CTimeCode CTimeCode:perator+ (const CTimeCode &TimeCode1, const CTimeCode &TimeCode2)
{
CTimeCode &TimeCodeResult;
TimeCodeResult.m_lTimeCode = TimeCode1.m_lTimeCode + TimeCode2.m_lTimeCode;
}
with those constructors :
CTimeCode::CTimeCode(int iFormat, long lTimeCode)
{
m_iFormat = iFormat;
if ((m_iFormat != 25) || (m_iFormat != 30))
m_iFormat = 25;
m_lTimeCode = lTimeCode;
}
CTimeCode::CTimeCode(int iFormat, CString csTimeCode)
{
m_iFormat = iFormat;
if ((m_iFormat != 25) || (m_iFormat != 30))
m_iFormat = 25;
m_lTimeCode = GetLongTimeCode(csTimeCode);
}
CTimeCode::CTimeCode(int iFormat, int iH, int iM, int iS, int iF)
{
m_iFormat = iFormat;
if ((m_iFormat != 25) || (m_iFormat != 30))
m_iFormat = 25;
m_lTimeCode = GetLongTimeCode(iH,iM,iS,iF);
}
I have a problem at compilation... :
"binary 'operator +' has too many parameters"
That comes perhaps from a syntax error... Any idea about this ?
|
|
|
|
|
When you make a binary operator a member of the class, it only takes one parameter. The left-side parameter is this .
class CTimeCode
{
public:
CTimeCode operator+ ( const CTimeCode rhs ) const
{
CTimeCode ret;
ret.m_lTimeCode = m_lTimeCode + rhs.m_lTimeCode;
return ret;
}
};
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
Anonymous wrote:
const CTimeCode CTimeCode:perator+ (const CTimeCode &TimeCode1, const CTimeCode &TimeCode2)
{
CTimeCode &TimeCodeResult;
TimeCodeResult.m_lTimeCode = TimeCode1.m_lTimeCode + TimeCode2.m_lTimeCode;
}
You just need one parameter wich is the second operand of the +. The first operand is this class (you can access it using the this keyword).
So change your function to this:
const CTimeCode CTimeCode:operator+ (const CTimeCode &TimeCode)<br />
{<br />
CTimeCode &TimeCodeResult;<br />
TimeCodeResult.m_lTimeCode = this.m_lTimeCode + TimeCode.m_lTimeCode;<br />
<br />
return TimeCodeResult;<br />
}
|
|
|
|
|
Huum ok, yes the this is not an obligation (sorry, little bit tired today ). Of course, you can access directly your class members...
|
|
|
|
|
And how to initialize "CTimeCode &TimeCodeResult" ?
|
|
|
|
|
Don't you have a default constructor ??
|
|
|
|
|
you also forgot to return a value from you operator+()
TOXCCT >>> GEII power
|
|
|
|
|
Generally I would implement:
class CTimeCode
{
CTimeCode& operator+=( const CTimeCode& rhs )
{
m_lTimeCode += rhs.m_lTimeCode;
return *this;
}
};
CTimeCode operator+( const CTimeCode& lhs, const CTimeCode& rhs )
{
CTimeCode ret( lhs );
ret += rhs;
return ret;
} Using a global- or namespace-scope operator+ allows conversions to happen on both operands (say, if you have a conversion operator or a single-operand constructor) whereas a class member only allows conversion on the right-hand operand.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
i'm really tired of manual converting which make me doubt whether am i a man or a machine.
thx
|
|
|
|
|
|
Hi,
I have SDI app that load files through CWinApp::OnFileOpen.
When the file dialog opens it is in the last opened directory. Normally this is the wrong directory.
When My program starts and File open is selected I want it to open in my default directory.
How can I set this without overriding OnFileOpen and using a CFileDialog
Thanks
---
|
|
|
|
|
You could override CDocManager::DoPromptFileName , but bear in mind that CDocManager is an undocumented class and could change.
Note that Windows itself is providing this default behaviour, which users may have come to expect from their other applications. See the documentation for the OPENFILENAME structure's lpstrInitialDir member (MSDN Library[^]).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Mike Dimmick wrote:
You could override CDocManager::DoPromptFileName
Yep thats what I have done,
and that works fine (as long as CDocManager doesnt change)
Thanks
---
|
|
|
|
|
Anybody been able to get CLSID_WebBrowser to work without having to use MFC and ATL but instead with CoCreateInstance? Mainly, the problem I see is that Navigate or Navigate2 seems to fail.
My code looks something like this:
//hr = CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_SERVER, IID_IWebBrowser2, (void**)&Browser);
hr = CoCreateInstance(CLSID_WebBrowser, NULL ,CLSCTX_INPROC, IID_IWebBrowser2, (void**)&Browser);
CLSID_InternetExplorer seems to work fine but the only problem is I cannot query IHTMLElementRender which is a problem because I want to do a SaveToDC. I can query IHTMLElement perfectly fine though. Here's some more code I have on that.
if (FAILED(hr) || (HtmlElement == NULL))
{
printf("Error: IHTMLDocument2::get_body failed\n");
return FALSE;
}
hr = HtmlElement->QueryInterface(IID_IHTMLElementRender, (void**)&HtmlRender);
if (FAILED(hr) || (HtmlRender == NULL))
{
printf("Error: Unable to QueryInterface for IID_IHTMLElementReader\n");
return FALSE;
}
Has anybody else had this problem? I've checked all over the web and have found little for using CoCreateInstance in conjunction with IHTMLElementRender.
Thanks,
Nathan
Nathan
|
|
|
|
|
What's the return value of CoCreateInstance in this case?
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
hiiii
i want that somebody give me code to get the RGB values from an image and show in edit boxes.
somebody told me use GetRValue , GetRValue , GetRValue by using GetPexil method but i don't know how to do it.
its a bit urgent plz
regards
tahir
|
|
|
|
|
GetPixel() with :
GetRValue()
GetGValue()
GetBValue()
TOXCCT >>> GEII power
|
|
|
|
|
Hi,
Is DDE still being use in programms, or is some thing newer? Is any examples of DDE (or newer thing) availabel some where?
Thanksing
|
|
|
|
|
quzi wrote:
Is DDE still being use in programms...
Yes, the clipboard uses it, or at least it used to in earlier versions of Windows. A cursory glance at the documentation indicates it probably still does.
quzi wrote:
...or is some thing newer?
There are a variety of IPC mechanisms, such as COM, Mailslots, Pipes, and RPC, just to name a few.
quzi wrote:
Is any examples of DDE (or newer thing) availabel some where?
Here is but one. Try Googling for others.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Use of DDE is discouraged on Windows Server 2003.
The DDE is a gaping security hole, as I understand it.
You are supposed to use the Micosoft Message Queue, or the other methods as David suggested.
|
|
|
|
|
hi all,
i need a good "send email sample" of vc for my project,
i do have few samples in hand, but none of them can be tested properly.
thx for any links
includeh10
|
|
|
|