How to send an image through the Skype API? - vb.net

I am using the Skype4ComLib library to try and send an image to a contact on Skype.
Private Sub Button17_Click(sender As Object, e As EventArgs) Handles btnImageLoad.Click
OpenFileDialog1.ShowDialog()
PicBox.ImageLocation = OpenFileDialog1.FileName.ToString
End Sub
This opens a dialog box for the user to select an image and loads it into a picture box called PicBox.
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
TimerImage.Stop()
End Sub
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button16.Click
TimerImage.Stop()
End Sub
Buttons 15 and 16 start the timer.
I want to send the image from within the timer but I can't use skype.sendmessage as it only accepts a string.
Any ideas?

Using the SendKeys.Send method you can paste the picture from the clipboard in the message via the actual Skype application.
This is how I do it:
My.Computer.Clipboard.SetImage(PicBox.Image)
SkypeClient.Client.OpenMessageDialog("<contact to send to>")
SkypeClient.Client.Focus()
SendKeys.Send("^(V){ENTER}")
Replace <contact to send to> with the name of the contact you want to send the picture to.

Related

Control Properties of LinkLabel when used for HelpProvider

I am working with Visual Studio 2017, working in VB. I am linking to a .CHM file from a LinkLabel which works fine with following code:
Private Sub LinkLabel2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel2.Click
' Create link to help file
System.Windows.Forms.Help.ShowHelp(Me, "RPM_Help.chm", HelpNavigator.AssociateIndex)
End Sub
I use a simple image to indicate the link to the .chm file that is 32x32 pixels in size, I have been playing with the properties of LinkLabel2 but I just can't figure out how to make the entire label a link space. I did find that unless there is a Text property on the label a MouseOver cursor will not show up, but how can I make the entire label image a cursor link?
As shown in the code and image below this can be solved by using LinkLabel2.AutoSize = False and adding a ToolTip from Common Controls to the form in design mode.
Each control, such as Buttons and TextBoxes, will acquire a ToolTip on toolTip1 property when you add a toolTip1 to your designer view. You can access this property in the Properties pane to set the tool tips.
Public Class frmMain
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LinkLabel2.BackColor = Color.CornflowerBlue
LinkLabel2.AutoSize = False
LinkLabel2.Width = 168
LinkLabel2.Height = 40
LinkLabel2.Text = ""
End Sub
Private Sub LinkLabel1_Click(sender As Object, e As EventArgs) Handles LinkLabel1.Click
' --- Open help file - Table of contents
System.Windows.Forms.Help.ShowHelp(Me, "hlp/CHM-example.chm", HelpNavigator.TableOfContents)
End Sub
Private Sub LinkLabel2_Click(sender As Object, e As EventArgs) Handles LinkLabel2.Click
' --- Open help file - Index
System.Windows.Forms.Help.ShowHelp(Me, "hlp/CHM-example.chm", HelpNavigator.Index)
End Sub
Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
' --- Open help file - Search
System.Windows.Forms.Help.ShowHelp(Me, "hlp/CHM-example.chm", HelpNavigator.Find, "")
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
The code corresponds to the image shown. The values can of course also be set via the properties, but are included here in the FormLoad for documentation.
You may want to use a simple PictureBox1_Click event for your needs as shown below (third item in the "Show help" group box).

finding web page source at desired instance VB.NET

IN CODE: At 1 browser clicks a button and takes a time to load. AT 2 i get source code of page in RichTextBox1. but as page take time to load code 2 starts before completion of 1 because of that i am unable to get the web page source at desired state? what do i do ? i want to get web page source when web browser completely loads after the execution of code 1.
i have tried
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.WebBrowser1.Navigate("some website")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
WebBrowser1.Document.GetElementById("notification_address").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.Forms(0).InvokeMember("submit") (-----1-----)
RichTextBox1.Text = WebBrowser1.DocumentText (-----2-----)
End Sub
You can use the DocumentCompleted event.
https://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentcompleted(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
Private Sub DocumentCompleted(ByVal sender As Object, _
ByVal e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
' this is where your code goes RichTextBox1.Text = WebBrowser1.DocumentText (-----2-----)
End Sub

Web popup window from VB?

I want to generate a web popup window when a user clicks a linklabel in my VB application.
Ideally the popup window will be using whatever the users default browser is.
Is this possible?
Any ideas how?
Thanks :)
Process.Start(Url)
should do what you want.
use Process.Start("http://www.google.com") on click event
Use Process.Start in the LinkClicked event of the LinkLabel
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Process.Start("http://www.bbc.co.uk")
End Sub
If you want to specify the URL at some point earlier you could store this in the Tag field:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LinkLabel1.Tag = "http://www.bbc.co.uk"
End Sub
Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Process.Start(LinkLabel1.Tag.ToString)
End Sub

Trying to enter a name in a textbox, hit ok, and have that form close and pass the info to another forms label

***THE CODE FROM THE FIRST WINDOW GOES INTO A TEXT BOX AND YOU HIT THE BUTTON HERE.
Private Sub btnOk_Click(sender As Object, e As EventArgs) Handles btnOk.Click
Me.Close()
End Sub
***THE CODE ON THE FORM WHERE I WANT THE INFO TO BE PLACED IS HERE.
Private Sub Loan1Form_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.lblCompanyName.Text = DataEntryForm.txtCompanyNameInput.Text
End Sub
Anyway's that's what I found on a youtube video and im having trouble getting it to work. Any help would be appreciated.
Thanks.
Pass the data to an instance of the form:
Private Sub btnOk_Click(sender As Object, e As EventArgs) Handles btnOk.Click
Dim f As New OtherForm
f.lblCompanyName.Text = txtCompanyNameInput.Text
f.Show()
Me.Close() 'make sure this form is not the one that closes the app if it closes
End Sub

Drag & drop and get file path in VB.NET

I'd like to be able to drag a file/executable/shortcut into a Windows Forms application and have the application determine the original path of the dropped file then return it as a string.
E.g. drag an image from the desktop into the application and messagebox up the local path of the image.
Is that possible? Could someone provide me with an example maybe?
It's quite easy. Just enable drap-and-drop by setting the AllowDrop property to True and handle the DragEnter and DragDrop events.
In the DragEnter event handler, you can check if the data is of the type you want using the DataFormats class.
In the DragDrop event handler, use the Data property of the DragEventArgs to receive the actual data and the GetData method
Example:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.AllowDrop = True
End Sub
Private Sub Form1_DragDrop(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
Dim files() As String = e.Data.GetData(DataFormats.FileDrop)
For Each path In files
MsgBox(path)
Next
End Sub
Private Sub Form1_DragEnter(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
End If
End Sub
This is just a note to state that if drag and drop does not work, it could be because you are running Visual Studio in Administrator Mode (Windows 7 and up I believe).
This also has to do with the UAC level currently set on your Windows installation.