|
so u mean to say..in a fresh machine MAPI won't work just with visual studio installed in it.,is it what u mean??
ranjani
|
|
|
|
|
I don't know why but recursion is always a problem for me. T_T Actually this is my mid-term test and I screw it. Y_Y Anyways, can anyone help me solve this please?
The teacher gave me 3 files for the problem(1 header file and 2 source files.) This is part of them.
/*Change the implementation of 'find' and 'insert' function to use an iterative algorithm instead of resursion.*/
struct cell // cell in a tree
{
keytype key;
valuetype value;
cell *left;
cell *right;
};
typedef cell *cellptr;
cellptr sortset::find(cellptr temproot, keytype key)
{
if (temproot == 0) return 0;
else
{
int compare = keycmp(key, temproot->key);
if (compare == 0) return temproot;
else if (compare < 0)
return find(temproot->left, key);
else
return find(temproot->right, key);
}
}
void sortset::treeinsert(cellptr &temproot, keytype key, valuetype value)
{
if (temproot == 0)
{
temproot = new cell;
temproot->key = key;
temproot->value = value;
temproot->left = temproot->right = 0;
}
else
{
int compare = keycmp(key, temproot->key);
if (compare < 0)
treeinsert(temproot->left, key, value);
else if (compare > 0)
treeinsert(temproot->right, key, value);
}
}
void sortset::insert(keytype key, valuetype value)
{
treeinsert(root, key, value);
}
Thanks in advance
|
|
|
|
|
This is homework, so it is not fair to provide a full solution. Instead, I can give you some guidance. In a recursive function, each time the function is further invoked a new set of argument and local variables is created. In your particular case, find only uses two argument variables, namely temproot and key . So, you can think of the function in progress as progressively creating variables temproot1 , key1 , temproot2 , key2 and so on. Now, if you want to avoid recursion, you'll have to find a way to reuse the local variables so that they adopt the rol they'd have in a recursive call. find is particularly simple, as key is really a constant value (it never changes inside the function), and as for temproot you can notice that it is no longer used after recursively invoking find , so you can safely change it to hold the value it'd have in the recursive invokation and loop again (instead of calling find .)
Good luck, don't hesitate to post again if you stuck somewhere.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
How to get the number of new and unread emails from an email box??
under vc6?
Thank you very much!!!
|
|
|
|
|
Hi,
Use MAPI
Vitali
http://www.creative-case.com
|
|
|
|
|
I want to use UIDL.
But I don't know how to use.
Any example?
Thank you very much.
|
|
|
|
|
There is some DC,
and I want to know which window owns it..
Is it possible?
thanks you.
|
|
|
|
|
|
There is just API method:
HWND hwnd_parent = ::WindowFromDC(di.hdcDraw);
|
|
|
|
|
Fine
You have answer.
Vitali
http://www.creative-case.com
|
|
|
|
|
Dear sir,
i am doing project in client server program like
we are transferring files from server to client
so, am going to use like FTP implementatins..
so, i want to know how we are using client server program
can u please send how to implement this code. i am going to develope
this in wi32 console application in VC++.
Thanks in advance,
Rathi.
|
|
|
|
|
One solution is raw winsock. Look in CodeProject code section for examples of winsock designs.
Kuphryn
|
|
|
|
|
Hi all,
i have a dialog, i catch the OnPaint() message. here is the code
void CMyDialog::OnPaint()
{
CPaintDC dc(this);
GetWindowRect(m_rectDlg);
PlaceTitleBorder(dc);
}
in in the PlaceTitleBorder() method i draw a bitmap:
void CMyDialog::PlaceTitleBorder(CPaintDC &dc)
{
BITMAP bmp;
memset(&bmp,0,sizeof(bmp));
::GetObject(m_hTitleBorder,sizeof(bmp),&bmp);
HDC compatibleDC = ::CreateCompatibleDC(dc);
HBITMAP hSavedObj;
hSavedObj = (HBITMAP)::SelectObject(compatibleDC,m_hTitleBorder);
BOOL bRes = StretchBlt(dc,
m_rectTitleBorder->left,
m_rectTitleBorder->top,
m_rectTitleBorder->Width(),
m_rectTitleBorder->Height(),
compatibleDC,
0,
0,
bmp.bmWidth,
bmp.bmHeight,
SRCCOPY);
::SelectObject(compatibleDC,hSavedObj);
::DeleteDC(compatibleDC);
}
when dialog appear i see the bitmap ok. when i move the dialog around the screen and go out of the bounds of the screen, and then return to the screen, the bitmap disappears (not redrawn???) can any1 help me??
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi YaronNir,
I think this is not good way to rewrite OnPaint in dialog
(hmmm - f.e. because dialog may contain other elements).
Insted this let try to put cpecial element on the dialog
and draw bitmap in to it.
Hope this help.
Vitali
http://www.creative-case.com[^]
|
|
|
|
|
hi,
thanks for the reply...
What can you suggest i do ??
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
|
I'm doing that too, but it works. Even if the dialog needs a refresh / redraw.
Just to show an example, which should not look very strange from your point of view :
1) Define the handlers for InitDialog and OnPaint and add a CBitmap object in the dialogs header :
class CMyDialog : public CDialog
{
:
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
:
CBitmap m_bmMyBitmap;
:
};
2) make sure that the OnPaint:handler are in the CPP-File :
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
//{{AFX_MSG_MAP(CMyDialog)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
3) Init the Bitmap object in the OnInitDialog function
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_bmMyBitmap.LoadBitmap( IDB_MY_BITMAP );
}
4) Fill the OnPaint-Handler :
void CDialogDruckauswahl::OnPaint()
{
CPaintDC dc(this); // device context for painting
// fill dialog background with some color.....
CRect crRect;
GetClientRect( &crRect );
COLORREF crColor = RGB( 255,255,255 );
CBrush* pFillBrush = new CBrush( crColor );
CBrush* pOldBrush = dc.SelectObject( pFillBrush );
CPen* pNewPen = new CPen( PS_SOLID, 1, crColor );
CPen* pOldPen = dc.SelectObject( pNewPen );
dc.Rectangle( crRect );
dc.SelectObject( pOldPen );
delete pNewPen;
pNewPen = NULL;
dc.SelectObject( pOldBrush );
delete pFillBrush;
pFillBrush = NULL;
// in welchen Bereich ?
DrawBitmap( &dc, crRect, &m_bmMyBitmap );
}
5) at least : define the bitmap drawing function :
void CMyDialog::DrawBitmap( CDC* pDC, CRect crRect, CBitmap* pBM )
{
// create a memory dc to prepare drawing via bitblt ...
CDC* pmemDCBitBlt = new CDC();
pmemDCBitBlt->CreateCompatibleDC( pDC );
CBitmap* pOldBM = pmemDCBitBlt->SelectObject( pBM );
// blit the bitmap into our view using the bitblt-xor-mode
pDC->BitBlt(crRect.TopLeft().x, crRect.TopLeft().y, crRect.Width(), crRect.Height(), pmemDCBitBlt, 0, 0, SRCCOPY );
// free the memory dc and the bitmap ....
pmemDCBitBlt->SelectObject( pOldBM );
delete pmemDCBitBlt;
pmemDCBitBlt = NULL;
}
|
|
|
|
|
Hi,
thanks for the reply,
i wrote something similar to what you've posted and it works!
thanks a lot
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
I need to open a Text file and read the first line which is like "Run","FileNo","Distance",...
Then i've pickup words like Run,FileNo.
I was able to open, read Line using CStdioFile.ReadLine();
How to parse the line and get the words??
Thanks In advance.
Warm Regards,
KKR
|
|
|
|
|
|
Thanks for Flashy Response,
Now My entire line is in a CString , shall i have to convert it to char* , to apply those functions like strtock();
Warm Regards,
KKR
|
|
|
|
|
this is very simple:
use syntax similar:
strtok( (char*)(LPCTSTR)CStringvariable, ... );
or use GetBuffer member from CString
Vitali
http://www.creative-case.com[^]
|
|
|
|
|
Thanks Mr Vitali,
I got the result.
Warm Regards,
KKR
|
|
|
|
|
Hi all.
Can i determine progrommaticaly whether keyboard connected with computer???
Thanks.
|
|
|
|
|
Hi,
I need to call into a library to perform a lengthy operation after a user presses a button.
I would like to bring up a dialog asking the user to wait a moment (no buttons on this dialog).
In the background I would like the operation to be performed. When it is ready, the dialog should be destroyed.
Has anyone done anything similar to this? Could someone point me to a sample or give me a few tips?
I am using MFC.
thanks,
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|