|
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
|
|
|
|
|
|
|
Hi all,
I have developed a windows service which runs executable files received from
some remote machine. Now i dont want to give my service all the rights so i
decided to run the service in "NT AUTHORITY\\LocalService" Account... but
when i do that i am unable to create any files or destroy any files in the
system
Now i want mmy service to have capability of creating new files but it shud
not be able to destroy any pre-exisiting files....also if possible i want to
restrict this file creation to only one particulat folder....meaning for e.g
if i have a folder called p2p then any excutable ran frm my service shud be
able to create files in that folder only and not in any other folder like
program files etc.
How do i achieve the above thing
thanks
kunal
|
|
|
|
|
I have project on hand where i have to lock all the exes on the client machine except the one exe that is to be retieved from the server database.This exe will be unlocked for a particular duration of time after that it has to be locked depending on its time duration.
|
|
|
|
|
dhawi wrote: This exe will be unlocked for a particular duration of time after that it has to be locked depending on its time duration.
Interesting, but what did you have for breakfast? do you want?
led mike
|
|
|
|
|
Hello everyone!
OK, I have a dialog with many checkboxes, buttons, radios, listboxes, edits, and all that stuff... Each item is an option for the saved file that the program generates... Is there an easy way to add an event handler for the form itself so that on every change the Saved variable gets set to 0? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
I do not if it standard or not, but what I do is generate a checksum of all the controls on the dialog and then I check that checksum in the idle handler. If the checksum changes then I know that the user has made a change. If the checksum reverts back to the saved value then I know that the user undid the changes.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|