Ik heb een probleem, als ik mijn programma opstart krijg ik heel even een CMD schermpje en dan sluit het weer, verder start mijn programma niet.
Ik denk dat het komt door de aero glass effect die ik over het hele form wil.
Dit is nu mijn code:
Imports System.Net
Imports System.Runtime.InteropServices
Public Class Form1
Dim NewPoint As New System.Drawing.Point()
Dim X, Y As Integer
Private WithEvents httpclient As WebClient
<Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> Public Structure MARGINS
Public LeftWidth As Integer
Public RightWidth As Integer
Public TopHeight As Integer
Public Buttomheight As Integer
End Structure
<Runtime.InteropServices.DllImport("dwmapi.dll")> Public Shared Function DwmExtendFrameIntoClientArea(ByVal hWnd As IntPtr, ByRef pMarinset As MARGINS) As Integer
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Me.BackColor = Color.Black
Dim margins As MARGINS = New MARGINS
margins.LeftWidth = -1
margins.RightWidth = -1
margins.TopHeight = -1
margins.Buttomheight = -1
Dim result As Integer = DwmExtendFrameIntoClientArea(Me.Handle, margins)
Catch ex As Exception
MsgBox("Uw besturingsysteem bevat niet de benodigde dll bestanden om het uitvoeren van deze applicatie te kunnen vooltooien.", vbCritical, "Fatale Fout")
Application.Exit()
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Do Until Me.Height > 137
Me.Height = Me.Height + 1
Loop
Button2.Enabled = False
TextBox1.ReadOnly = True
TextBox2.ReadOnly = True
httpclient = New WebClient
Dim sourceURL = TextBox1.Text
Dim filedir = TextBox2.Text
ProgressBar1.Value = 0
ProgressBar1.Maximum = 100
Try
httpclient.DownloadFileAsync(New Uri(sourceURL), (filedir))
ListBox1.Items.Add("Download succesvol, downloadurl was: " & TextBox1.Text)
Catch ex As Exception
ListBox1.Items.Add("Download mislukt, error: " + ErrorToString())
End Try
Button2.Enabled = True
TextBox1.ReadOnly = False
TextBox2.ReadOnly = False
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.WindowState = FormWindowState.Minimized
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim save As New SaveFileDialog
save.Title = "Opslaan in..."
save.ShowDialog()
TextBox2.Text = save.FileName
save.Filter = "Alle bestanden *.*|*.*"
End Sub
Private Sub httpclient_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles httpclient.DownloadProgressChanged
ProgressBar1.Value = e.ProgressPercentage
If ProgressBar1.Value = 100 Then
Do Until Me.Height < 97
Me.Height = Me.Height - 1
Loop
End If
End Sub
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
X = Control.MousePosition.X - Me.Location.X
Y = Control.MousePosition.Y - Me.Location.Y
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If e.Button = MouseButtons.Left Then
NewPoint = Control.MousePosition
NewPoint.X -= (X)
NewPoint.Y -= (Y)
Me.Location = NewPoint
End If
End Sub
Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
End Sub
End Class
Kunnen jullie me helpen?
Alvast bedankt,
Gta-kneuske
Bewerkt: door Thundercover Code-tags toegevoegd. ~~ Thundercover
Ik heb een probleem, als ik mijn programma opstart krijg ik heel even een CMD schermpje en dan sluit het weer, verder start mijn programma niet.
Ik denk dat het komt door de aero glass effect die ik over het hele form wil.
Dit is nu mijn code:
Kunnen jullie me helpen?
Alvast bedankt,
Gta-kneuske
Bewerkt: door Thundercover
Code-tags toegevoegd. ~~ Thundercover