CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    Aug 2005
    Posts
    27

    [RESOLVED] F1Book - Drag and Drop

    Does anyone know how to disable drag and drop on an F1Book (Tidestone Formula One ActiveX grid control)? I want to prevent users from dropping data from other applications onto the control. Not sure what other information will be helpful. Thanks for your help.

  2. #2
    Join Date
    Apr 1999
    Posts
    3,585

    Re: F1Book - Drag and Drop

    How are you using the control? Do you have a wrapper class? How is the control instantiated?
    Gort...Klaatu, Barada Nikto!

  3. #3
    Join Date
    Aug 2005
    Posts
    27

    Re: F1Book - Drag and Drop

    The control is linked to a resource on my dialog through DDE. The wrapper class for the control is CF1Book (generated by Visual Studio). I have the User's Guide for the control, but haven't been able to find anything related to disabling drag and drop.

  4. #4
    Join Date
    Apr 1999
    Posts
    3,585

    Re: F1Book - Drag and Drop

    If the wrapper is dervied from COleControl, you can try to use DragAcceptFiles().
    Gort...Klaatu, Barada Nikto!

  5. #5
    Join Date
    Aug 2005
    Posts
    27

    Re: F1Book - Drag and Drop

    The wrapper is derived from CWnd.

  6. #6
    Join Date
    Apr 1999
    Posts
    3,585

    Re: F1Book - Drag and Drop

    Not a problem. COleControl is derived from CWnd and DragAcceptFiles is actually a method of CWnd.
    Gort...Klaatu, Barada Nikto!

  7. #7
    Join Date
    Aug 2005
    Posts
    27

    Re: F1Book - Drag and Drop

    I tried calling DragAcceptFiles(FALSE) on my CF1Book in OnInitDialog and it still accepts the drop.

  8. #8
    Join Date
    Aug 2005
    Posts
    27

    Re: F1Book - Drag and Drop

    Found the answer...

    Code:
    WINOLEAPI RevokeDragDrop(
      HWND hwnd  //Handle to a window that can accept drops
    );
    Code:
    // m_f1 is a member variable of type CF1Book (the wrapper class)
    RevokeDragDrop((HWND)m_f1.GetHWnd());
    );
    Thanks for helping, Mike!

  9. #9
    Join Date
    Feb 2012
    Posts
    1

    Re: F1Book - Drag and Drop

    anybody knows where could get F1Book?

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: F1Book - Drag and Drop

    Quote Originally Posted by germanrachid View Post
    anybody knows where could get F1Book?
    Perhaps, from Tidestone web site?
    Victor Nijegorodov

  11. #11
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: [RESOLVED] F1Book - Drag and Drop

    In related to the drag and drop functionality in the above thread discussion, I have some doubts.

    I have some 4 cstatic controls on my dialog box and drag and drop functionality works randomnly.
    But I want specific file to be loaded on to that specific CStatic box window when the user drags and drops over it.

    Please let me know how to do this in specific for each individual cstatic controls

  12. #12
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: [RESOLVED] F1Book - Drag and Drop

    1. You should have started the new thread with your problem, since it has nothing to do with the F1Book ActiveX control.
    2. What would you like to accomplish with the "drag and drop functionality" with the static controls? What did you expect and what have you got?
    3. How did you implement your "drag and drop functionality"?
    4. Define "drag and drop functionality works randomnly".
    Victor Nijegorodov

  13. #13
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: [RESOLVED] F1Book - Drag and Drop

    Quote Originally Posted by VictorN View Post
    1. You should have started the new thread with your problem, since it has nothing to do with the F1Book ActiveX control.
    2. What would you like to accomplish with the "drag and drop functionality" with the static controls? What did you expect and what have you got?
    3. How did you implement your "drag and drop functionality"?
    4. Define "drag and drop functionality works randomnly".
    sorry for continuing in this thread itself.

    I have written the below code to capture drag and drop file names on my dialog box:

    Code:
    void CDashOfflineSelMapDumpFile::OnDropFiles(HDROP hDropInfo)
    {
    
    	UINT fileCount = DragQueryFile(hDropInfo, 0xFFFFFFFF, NULL, 0);
    
    	for (UINT i = 0; i < fileCount; i++ )
    	{
    		char* pBuf = fileName.GetBuffer(MAX_PATH+11);
    		UINT fnchars = DragQueryFile(hDropInfo, i, pBuf, MAX_PATH);
    		fileNames.AddTail(pBuf);
    		fileName.ReleaseBuffer();
    	}
    
    	 // Free the memory block containing the dropped-file information
        DragFinish(hDropInfo);
    
    	CDialogEx::OnDropFiles(hDropInfo);
    }
    in the OnIntiDialog() function I am calling "this->DragAcceptFiles();"

    my question is I have some 4 CStatic controls, how can I redirect each file that is selected from window explorer and dropped on each CStatic control seperately. I tried capturing the mouse click point as shown below

    Code:
    POINT p;
    					GetCursorPos(&p);
    					CRect rect;
    					
    					GetWindowRect(&rect);
    					//GetClientRect(&rect);
    					//POINT pt = rect.CenterPoint();
    			
    					//ScreenToClient(hwnd, &p);
    					//if(rect.PtInRect(p))
    					if(m_control_str_event_log_ioc.DragDetect(p))
    					{
    						//cursor position now in p.x and p.y
    						//if((p.x > rect.TopLeft().x) && (p.y < rect.BottomRight().y) )
    						{
    							m_str_event_log_ioc = fileName;
    							UpdateData(FALSE);
    						}
    					}
    my question how exactly can I capture the mouse file drag point onthe different CStatic control so that I can update that file on that particular control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured