|
A few places to look (in order!):
- Avoid erasing the background prior to redrawing - handle WM_ERASEBKGND
- Avoid changing the window region when the size hasn't changed - in WM_SIZE, store a copy of the current size, and when it's called again, check to make sure the size has actually changed before setting a new region.
- Check the speed of your drawing code. Temporarily replace it with something simple (but not too simple), like a pattern fill. If the flicker disappears, you probably need to work on optimizing your code.
every night, i kneel at the foot of my bed and thank the Great Overseeing Politicians for protecting my freedoms by reducing their number, as if they were deer in a state park. -- C hris L osinger, Online Poker Players?
|
|
|
|
|
All of the above have already been coded and none of them make a difference.
|
|
|
|
|
I want to drag and drop items from the tree control on to the explorer and vice versa.At present drag and drop operation is working fine inside the tree control.Can any one help me in this problem.
Thanks.
|
|
|
|
|
See This article^ of Michael Dunn. It might be useful to you.
2+2 = 5 (For very large values of 2)
|
|
|
|
|
ya,i have gone through it.It is good.But i am not able to implement that to a tree control.Can you help me in that.
Thanks.
|
|
|
|
|
Are you getting the drag/drop notification? Where exactly is the problem?
sig under construction
|
|
|
|
|
I am not able to use it to a tree control.Can you please tell How we can use it to the tree control.Please do help me.I am new to vc++.I am trying since 2 days.
Thanks.
|
|
|
|
|
I think you asked this question already did you see that link?
|
|
|
|
|
Hi,
I am not able to get it.It is very urgent.So,only i asked.I have gone through ur reply also.Thanks for that.
Thanks.
-- modified at 10:15 Saturday 14th October, 2006
|
|
|
|
|
why you cant get it and did you see it or no
|
|
|
|
|
ya,i saw it.What is happening is dragging and dropping occurs with in the tree control itself.But the respective folder is not dropped in the systems windows explorer.And another problem is when i drag the folder outside the application window the item is being dragged but it is not dropping there.Can you suggest me any code for the tree control to drop the item on to the explorer.(My tree control displays the explorer tree in it).Please help out in this.
Thanks.
|
|
|
|
|
Did you search on www.codeguru.com about drag and drop?
|
|
|
|
|
ya i have gone through some applications in that,but no use.Now i have decided to attach a menu to the tree items.It consists of copy and paste menu items.When i copy a tree item from tree contol and pasting it on the explorer it is working.Similaly when i copy from explorer and paste it in the tree control it is not occuring.I have written the code like this.Is there any wrong in this.
void CTreeFileCtrl::OnTreefilectrlPaste()
{
COleDataObject DataObject;
if( DataObject.AttachClipboard() )
{
DataObjectToTree(&DataObject);
}
}
void CTreeFileCtrl::OnUpdateTreefilectrlPaste(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
COleDataObject odj;
pCmdUI->Enable(FALSE);
if( odj.AttachClipboard() )
{
if( odj.IsDataAvailable( CF_HDROP ) )
{
pCmdUI->Enable(TRUE);
}
}
}
void CTreeFileCtrl::OnTreefilectrlCopy()
{
// TODO: Add your command handler code here
FileNamesToClipBoard();
}
void CTreeFileCtrl::OnUpdateTreefilectrlCopy(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
HTREEITEM hItem = GetSelectedItem();
if(hItem){
pCmdUI->Enable(TRUE);
}
else{
pCmdUI->Enable(FALSE);
}
}
void CTreeFileCtrl::FileNamesToClipBoard()
{
CDropFiles DropFiles;
if(!PrepareFileBuff(DropFiles)){
return;
}
if (OpenClipboard())
{
BeginWaitCursor();
::EmptyClipboard();
HGLOBAL hMem = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_MOVEABLE|GMEM_DDESHARE, DropFiles.GetBuffSize());
memcpy( (char*)::GlobalLock(hMem), DropFiles.GetBuffer(), DropFiles.GetBuffSize() );
::SetClipboardData (CF_HDROP, hMem );
::CloseClipboard();
EndWaitCursor();
}
}
BOOL CTreeFileCtrl::PrepareFileBuff(CDropFiles &DropFiles) const
{
HTREEITEM hItem = GetSelectedItem();
if( hItem == NULL){
return FALSE;
}
else if(hItem) {
//int index = mylist.GetNextSelectedItem(pos);
DropFiles.AddFile(ItemToPath(hItem));
}
DropFiles.CreateBuffer();
return TRUE;
}
BOOL CTreeFileCtrl::DataObjectToTree(COleDataObject *const pDataObject)
{
if( pDataObject->IsDataAvailable( CF_HDROP ) )
{
STGMEDIUM StgMed;
FORMATETC fmte = { CF_HDROP,
(DVTARGETDEVICE FAR *)NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL };
if( pDataObject->GetData( CF_HDROP, &StgMed, &fmte ) )
{
HDROP hDrop= (HDROP)StgMed.hGlobal;
UINT cFiles = ::DragQueryFile(hDrop, (UINT)-1, NULL, 0);
char szFile[MAX_PATH];
CString pszFileTo=ItemToPath(GetSelectedItem());
SHFILEOPSTRUCT shfo;
WORD wFunc=FO_COPY;
//TCHAR pszTo[1024] = {0};
// TCHAR pszFrom[1024] = {0};
WORD wFlags = 0;
// wFlags |= FOF_SILENT;
ZeroMemory(&shfo, sizeof(SHFILEOPSTRUCT));
//szFileTo +="\0"
if(cFiles <= 0){
ASSERT(0);
return FALSE;
}
else
{
for( UINT count = 0; count < cFiles; count++ )
{
::DragQueryFile(hDrop, count, szFile, sizeof(szFile));
CString szFileFrom = szFile;
//szFileFrom+="\\0";
shfo.wFunc = wFunc;
shfo.fFlags = static_cast<fileop_flags>(wFlags);
shfo.pTo = pszFileTo;
shfo.pFrom = szFileFrom;
CopyFile(szFileFrom, pszFileTo,0);
SHFileOperation(&shfo);
if(shfo.fAnyOperationsAborted)
{
MessageBox("Aborted!");
return FALSE;
}
}
}
if (StgMed.pUnkForRelease){
StgMed.pUnkForRelease->Release();
}
else {
::GlobalFree(StgMed.hGlobal);
}
return TRUE;
}
}
}
Thanks.
|
|
|
|
|
I cant check you code but I see it seems it doesnt problem and I think I saw a loop(while) in your code for most a file and I think structure of your code is ok
|
|
|
|
|
i want to record the image screen behind one dialog,
when Pessing the OK button, this dialog don't disappear at once,and delay a while, sometimes my program may record this dialog's image, which covered
real image behind. why ?
here is my function:
void RecordScreen()
{
CMyDialog dlg;
if (dlg.DoModal()==IDOK)
{
//only click ok button to exit
RecordRectScreen(); //sometimes it records dlg'background
//this may cover the image screen in demand
}
}
void CMyDialog::OnOK()
{
....
BOOL aa = this->RedrawWindow(); //check aa , is true
CDialog::OnOK();
}
|
|
|
|
|
Did you search on codeproject I think I saw an article of course output of that program is a avi file
|
|
|
|
|
RedrawWindow(), this function has returned the value, but refreshing the action for the backgroud is not complete, the next function, RecordRectScreen() has executed,the bad thing happens.
thanks.
one flag
|
|
|
|
|
You can hide your program and keep it on sysem tray.
|
|
|
|
|
I read the article of Michael Dunn drag drop beteen yor program and explorer.
It works for List control.Now i want for tree control, how can i register tree control as a drop target,
Plz Hel me out?
|
|
|
|
|
Getting the drag/drop notifications works the same way as with a list control.
|
|
|
|
|
Can u show me some code......
I tried to register through m_droptarget.Register();
When it enter in to Register funtcion returns FALSE.
Plz Help me out Regarding this drag and drop am trying from three days no one replies ohter than you....
Plz help me.....
|
|
|
|
|
I am told that there is a better way to accomplish this task, but using bitwise operators to eliminate the need for the 3rd variable.
void switch_digits(short *numberOne, short *numberTwo)<br />
{<br />
short tempSwitch;<br />
<br />
tempSwitch = *numberOne;<br />
*numberOne = *numberTwo;<br />
*numberTwo = tempSwitch;<br />
}
How is it done?
|
|
|
|
|
a = a^b;
b = a^b;
a = a^b;
and I wouldn't do this unless there was a very good reason to
|
|
|
|
|
|