Results 1 to 8 of 8

Thread: dropping files from Explorer onto a CHROME HANDLE

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    dropping files from Explorer onto a CHROME HANDLE

    MAYBE IT'S LIKE WEBVIEW2,OR QT EXE??

    web control hwnd:Intermediate D3D Window
    exe classname:Chrome_WidgetWin_1

    Process path:
    "abc.exe" --type=gpu-process --user-data-dir="C:\Users\admin\AppData\app1" --gpu-preferences=UAAAAAAAAADgAAAYAAAAAAAAAAAAAAAAAABgAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgA AAAAAAAASAAAAAAAAAAYAAAAAgAAABAAAAAAAAAAGAAAAAAAAAAQAAAAAAAAAAAAAAAOAAAAEAAAAAAAAAABAAAADgAAAAgAAAAA AAAACAAAAAAAAAA= --mojo-platform-channel-handle=1700 --field-trial-handle=1784,i,17425394976030928647,15251993890451894824,131072 --disable-features=SpareRendererForSitePerProcess,WinRetrieveSuggestionsOnlyOnDemand /prefetch:2

    SEND MESSAGE WM_DROPFILES,No drag-and-drop file event was generated on the web page

    Code:
    szFileName = StrConv(File1, vbFromUnicode)
     Call GetWindowThreadProcessId(HWND, dwPid)
            hProc = OpenProcess(&H8& + &H20&, False, dwPid)
            If hProc Then
                pmem = VirtualAllocEx(hProc, 0&, dwBuffSize, MEM_COMMIT, PAGE_READWRITE)
                If pmem Then
                    Debug.Print pmem
                    If WriteProcessMemory(hProc, pmem, pBuff(0), dwBuffSize, 0&) Then
                        'Call SendMessage(hWnd, WM_DROPFILES, pmem, ByVal 0&)
                        Call PostMessage(HWND, WM_DROPFILES, pmem, ByVal 0&)

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: dropping files from Explorer onto a CHROME HANDLE

    Want to simulate the mouse drag and drop event, perhaps only like a human to operate? Open the Explorer, or add an Explorer control on the VB6 software to display a PNG file, and then click the file, and then drag and drop to another process.
    The process may display a WEBVIEW2 web control that accepts file drag-and-drop events in parts of the page.
    Analog mouse operation, will occupy the entire computer, it can not work normally.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: dropping files from Explorer onto a CHROME HANDLE

    https://deepinout.com/html/html-ques...webdriver.html

    Code:
    WebDriver driver = new FirefoxDriver();
    driver.get("https://www.example.com");
    
    WebElement fileInput = driver.findElement(By.id("fileInput"));
    
    Actions actions = new Actions(driver);
    actions.moveToElement(fileInput).build().perform();  // Move the mouse over the Upload button
    
    File file = new File("path/to/file.txt");
    String filePath = file.getAbsolutePath();  // Get the absolute path of the file
    
    actions.dragAndDropBy(fileInput, 0, 0).build().perform();  // Drag the file to the upload button
    actions.release().build().perform();  // Release the file
    
    fileInput.sendKeys(filePath);  // Use sendKeys to upload the file
    The above code will open a web page in the browser, and then simulate the user to drag and drop the file onto the upload button with the id "fileInput". Move the mouse over the upload button using the moveToElement method of the Actions class and drag the file over the upload button using the dragAndDropBy method. Finally, release the file using the release method and upload the file using the sendKeys method.

    Sum up
    In this article, we have shown how to simulate HTML5 drag-and-drop operations in Selenium Webdriver. By using the dragAndDrop method of the Actions class, we can simulate user drag-and-drop operations in automated tests. At the same time, we also showed how to simulate drag-and-drop file operations to meet different testing requirements. I hope this article will be helpful to developers using Selenium Webdriver for HTML5 drag-and-drop simulation.

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: dropping files from Explorer onto a CHROME HANDLE

    https://blog.51cto.com/ITEvan/6459885

    Code:
    var dropHandler = function(e) {
    e.preventDefault();  // Get the file list
    var fileList = e.dataTransfer.files;
    // Detects whether a file is dragged to the page
    if (fileList.length == 0) {
    return;
    }
    // Check whether the file is a picture
    if (fileList[0].type.indexOf("image") === -1) {
    return;
    }
    // Instantiate the file reader object
    var reader = new FileReader();
    var img = document.createElement("img");
    reader.onload = function(e) {
    img.src = this.result;
    oDragWrap.appendChild(img);
    };
    reader.readAsDataURL(fileList[0]);
    };

  5. #5
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,653

    Re: dropping files from Explorer onto a CHROME HANDLE

    https://learn.microsoft.com/en-us/an...rop-from-my-lo

    It's VB.NET but should be easy enough to translate to VB6, just be careful with the INPUT stuff, search for existing threads on that as it's a little tricky.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: dropping files from Explorer onto a CHROME HANDLE

    Quote Originally Posted by fafalone View Post
    https://learn.microsoft.com/en-us/an...rop-from-my-lo

    It's VB.NET but should be easy enough to translate to VB6, just be careful with the INPUT stuff, search for existing threads on that as it's a little tricky.
    This is almost 100% correct, the rest is a matter of luck, thank you very much.
    I can't get a message at all with SPY++ or something, for some reason.

  7. #7
    Hyperactive Member
    Join Date
    Dec 2008
    Location
    Argentina
    Posts
    440

    Re: dropping files from Explorer onto a CHROME HANDLE

    Hello, I was able to do it with SHDoDragDrop and a timer calling mouse_event MOUSEEVENTF_LEFTUP

    here I attach files to web whatsapp
    http://leandroascierto.com/blog/envi...tsapp-con-vb6/
    leandroascierto.com Visual Basic 6 projects

  8. #8

    Thread Starter
    PowerPoster
    Join Date
    Jan 2020
    Posts
    5,538

    Re: dropping files from Explorer onto a CHROME HANDLE

    Quote Originally Posted by LeandroA View Post
    Hello, I was able to do it with SHDoDragDrop and a timer calling mouse_event MOUSEEVENTF_LEFTUP

    here I attach files to web whatsapp
    http://leandroascierto.com/blog/envi...tsapp-con-vb6/
    http://leandroascierto.com/blog/
    Is this your blog and some of your work? There are many interesting projects, you are a really great CB programmer, many beautiful interfaces and powerful functions.

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