|
|
|
Hi friends,
Are there any POP3 supporting MFC classes ?? I want to get copy of mail when the mail lands at the Server. Please suggests any links if available.
Thanks
Satya
|
|
|
|
|
there are many..search in www.codeproject.com/internet you will find many..
cheers
Himanshu
|
|
|
|
|
I try to write double values to a file. The problem is that all values have different precisions.
Example:
double d = 1.234
CString.Format("%.5f", d) causes the output to be 1.23400.
I only want to print 1.234
How can I determine the precision of a given double value?
|
|
|
|
|
What about CString.Format("%ls",d); ?
~RaGE();
|
|
|
|
|
Thanks, Rage, but that doen't work. The Prefic "l" before the type specifier has no effect on the precision. I suppose you meant "%ld" !?
Heiko
|
|
|
|
|
Sorry, i mistake myself with ascanf specifiers. Right code is
str.Format("%g",d); . This gives out 1.234 for double d=1.2340000 or d=1.234 .
~RaGE();
|
|
|
|
|
I've a problem with Property Pages within a Property Sheet.
The Font Property is set to a 10 point Font in the Resource Editor, but the Property Pages still appear in a 8 Point(I think this is default) Font.
Changing the font via SetFond function of the PropertySheet or PropertyPages doesn't change anything.
GetTabControl()->SetFont(&App.m_CLabelBoldFont) only changes the Font of the Labels in the Tab Control.
Does anybody know a solution?
I already thought of looping throug the Elements of the Property Page in the OnInitDialog function, but I don't know how. Even such a solution would be helpful to me. Thanks.
|
|
|
|
|
Here's sth. from MSDN:
"Even if the font of the property pages is changed in the Resource Editor, property pages will be displayed at run time with the system font. If it is necessary to change the font, call SetFont() in OnInitDialog; then use an appropriate MoveWindow() to resize the sheet and move and resize all the controls on the page. Also, the property sheet is set back to its original size whenever a page is activated, so it will be necessary to resize the page in response to a click on the tab control. "
And that's an excerpt from the provided sample, a helper function to set the font (pWnd = pointer to your CPropertySheet):
void ChangeDialogFont(CWnd* pWnd, CFont* pFont, int nFlag)<br />
{<br />
CRect windowRect;<br />
<br />
TEXTMETRIC tmOld, tmNew;<br />
CDC * pDC = pWnd->GetDC();<br />
CFont * pSavedFont = pDC->SelectObject(pWnd->GetFont());<br />
pDC->GetTextMetrics(&tmOld);<br />
pDC->SelectObject(pFont);<br />
pDC->GetTextMetrics(&tmNew);<br />
pDC->SelectObject(pSavedFont);<br />
pWnd->ReleaseDC(pDC);<br />
<br />
long oldHeight = tmOld.tmHeight+tmOld.tmExternalLeading;<br />
long newHeight = tmNew.tmHeight+tmNew.tmExternalLeading;<br />
<br />
if (nFlag != CDF_NONE)<br />
{<br />
CRect clientRect, newClientRect, newWindowRect;<br />
<br />
pWnd->GetWindowRect(windowRect);<br />
pWnd->GetClientRect(clientRect);<br />
long xDiff = windowRect.Width() - clientRect.Width();<br />
long yDiff = windowRect.Height() - clientRect.Height();<br />
<br />
newClientRect.left = newClientRect.top = 0;<br />
newClientRect.right = clientRect.right * tmNew.tmAveCharWidth / tmOld.tmAveCharWidth;<br />
newClientRect.bottom = clientRect.bottom * newHeight / oldHeight;<br />
<br />
if (nFlag == CDF_TOPLEFT)
{<br />
newWindowRect.left = windowRect.left;<br />
newWindowRect.top = windowRect.top;<br />
newWindowRect.right = windowRect.left + newClientRect.right + xDiff;<br />
newWindowRect.bottom = windowRect.top + newClientRect.bottom + yDiff;<br />
}<br />
else if (nFlag == CDF_CENTER)
{<br />
newWindowRect.left = windowRect.left - <br />
(newClientRect.right - clientRect.right)/2;<br />
newWindowRect.top = windowRect.top -<br />
(newClientRect.bottom - clientRect.bottom)/2;<br />
newWindowRect.right = newWindowRect.left + newClientRect.right + xDiff;<br />
newWindowRect.bottom = newWindowRect.top + newClientRect.bottom + yDiff;<br />
}<br />
pWnd->MoveWindow(newWindowRect);<br />
}<br />
<br />
pWnd->SetFont(pFont);<br />
<br />
CWnd* pChildWnd = pWnd->GetWindow(GW_CHILD);<br />
<br />
while (pChildWnd)<br />
{<br />
pChildWnd->SetFont(pFont);<br />
pChildWnd->GetWindowRect(windowRect);<br />
<br />
CString strClass;<br />
::GetClassName(pChildWnd->m_hWnd, strClass.GetBufferSetLength(32), 31);<br />
strClass.MakeUpper();<br />
if(strClass==_T("COMBOBOX"))<br />
{<br />
CRect rect;<br />
pChildWnd->SendMessage(CB_GETDROPPEDCONTROLRECT,0,(LPARAM) &rect);<br />
windowRect.right = rect.right;<br />
windowRect.bottom = rect.bottom;<br />
}<br />
<br />
pWnd->ScreenToClient(windowRect);<br />
windowRect.left = windowRect.left * tmNew.tmAveCharWidth / tmOld.tmAveCharWidth;<br />
windowRect.right = windowRect.right * tmNew.tmAveCharWidth / tmOld.tmAveCharWidth;<br />
windowRect.top = windowRect.top * newHeight / oldHeight;<br />
windowRect.bottom = windowRect.bottom * newHeight / oldHeight;<br />
pChildWnd->MoveWindow(windowRect);<br />
<br />
pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);<br />
}<br />
}
Hope it'll help you.
|
|
|
|
|
Wow! That was fast. Yes it works! Thanks a lot.
|
|
|
|
|
Hi
I create a splitter wnd with 2 panes. Each pane is a form with a few dialog boxes. When I am at the last dialog item of 1st pane, I want the TAB key to activate the next pane and SetFocus to the first dialog item there. Can someone please tell me how to do so?
Thanks!
|
|
|
|
|
Intercept the WM_KILLFOCUS sent by the dialog item leaving the focus (in MFC with a OnKillFocus ) and set it to the other one with a SetFocus .
~RaGE();
|
|
|
|
|
i am doing an Instant Messenger i have no idea of programming voice in vc++ please help
|
|
|
|
|
There are voice chat samples in the DirectX SDK
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
hi thanx, for ur concern
btw i found some nice audio stuff wave audio form
in the charles petzoldi book..
|
|
|
|
|
check out articles at..
http://www.codeproject.com/audio/
you will get wat you want..
cheers
Himanshu
|
|
|
|
|
Hello everyone,
I want to know the status of a completion port before dequeuing a io request, Can I determine how many pending I/O requests in a completion port before calling GetQueuedCompletionStatus()?
Thanks.
Kerry Chou from STU
|
|
|
|
|
ok guys, this is driving me crazy:
#include "comdef.h"<br />
<br />
HRESULT fn(VARIANT v)<br />
{<br />
HRESULT hr = VariantChangeType(&v, &v, 0, VT_BSTR);<br />
return hr;<br />
}<br />
int main(int argc, char* argv[])<br />
{<br />
variant_t v1(L"1"); <br />
variant_t v2(L"2");<br />
fn(v1);<br />
fn(v2);
return 0;<br />
}
now, when fn(v2); is called, the value of v1 is changed to "2".
i believe that i'm doing something wrong, but i can't see what.
|
|
|
|
|
Perhaps pass v to fn() by reference?
i.e. HRESULT fn(VARIANT& v);
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
That would work correctly, and i would do that if it was a "real" code.
but the code in the snippet is perfectly legal c++ (or at least i think so)
so i'm not sure what's the reason for such behavior
|
|
|
|
|
You are right. Do I feel like an idiot or what?
However, the reason for this strange behaviour (I think) is that
the BSTR is deallocated within ChangeType and then reallocated.
(It probably doesn't check whether it is changing into the same type, i.e. BSTR->BSTR)
This means that the new pointer is lost since it was assigned to a temp. object.
The _variant_t contains the old pointer that now points to deallocated memory.
I.e. the _variant_t BSTR pointer is dangling after the fn() call.
Then the ghost value is a result of the memory allocation implementation.
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
yes, i came to the same conclusion during the lunch
thanks for help, anyway
|
|
|
|
|
Hi,
Anyone have any suggestions on how to solve the following prob?
The interface of my app is built out of several different child windows and one of those contains a small coloured square. When you move the mouse over it some text is displayed.
The problem is that when you move the mouse out of the square AND out of the child window too fast the text doesn't disappear, because the WM_MOUSEMOVE message doesn't fire fast enough.
I suppose I could solve it by letting the rollover trigger a timer loop that keeps checking whether the mouse is still over the square, but that seems like a difficult solution.
Perhaps there is a more graceful solution; like an event that fires when the mouse leaves the child window or something?
Thanks,
ren
|
|
|
|
|
perhaps WM_MOUSELEAVE could do this
|
|
|
|