从 WinForm C# 在 WhatsApp 桌面聊天中添加文件

Add file in WhatsApp Desktop chat from WinForm C#

最近怎么样?我想看看是否可以从 C# 中的 WinForms 应用程序附加文件并将其发送到 WhatsApp Desktop。要启动 WhatsApp Desktop 应用程序,我使用以下命令:

var process = $"whatsapp://send?phone={numero}&text={text}";
Process.Start(process);

有了它,我得到 WhatsApp Desktop 打开默认文本和用户输入的数字。现在,我想知道是否可以附加文件 (image / pdf)。我尝试了以下方法:

I create an OpenDialog from which I select the file and get its path, I put it in a TextBox.

然后,对于流程我说如下:

string pathFile = txtRuta.Text;
var process = $"whatsapp://send?phone={numero}&text={text}&attachment={pathFile}";
Process.Start(process);

这会启动 WhatsApp Desktop,但它只显示文本和将发送到的号码。有什么方法可以附加文件吗?

从知识上讲,它不可行,因为它只支持字符串,

请改用图片URL。

此外,您还可以使用网站URL。通常 Web Scraper 将网站的图像预览传送到 Whatsapp,以便用户可以看到网站的快照。