|
-
Sep 7th, 2023, 04:13 PM
#1
Thread Starter
PowerPoster
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&)
-
Sep 7th, 2023, 04:16 PM
#2
Thread Starter
PowerPoster
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.
-
Sep 7th, 2023, 04:54 PM
#3
Thread Starter
PowerPoster
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.
-
Sep 7th, 2023, 05:02 PM
#4
Thread Starter
PowerPoster
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]);
};
-
Sep 7th, 2023, 09:09 PM
#5
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.
-
Sep 8th, 2023, 11:07 PM
#6
Thread Starter
PowerPoster
Re: dropping files from Explorer onto a CHROME HANDLE
 Originally Posted by fafalone
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.
-
Sep 9th, 2023, 12:48 PM
#7
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/
-
Sep 9th, 2023, 02:46 PM
#8
Thread Starter
PowerPoster
Re: dropping files from Explorer onto a CHROME HANDLE
 Originally Posted by LeandroA
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|