ビジュアルベーシック言語を使ってプログラムを作るのは初めてです。Visual Studioを使用してデバッグするたびにプログラムは問題ないので、プロジェクトはスムーズに実行されていると思ったので、プログラムの.exeファイルをチェックしてもかまいませんでしたが、今日、プログラムの.exeファイルでこのエラーを見つけました
フォームの作成中にエラーが発生しました。詳細については、Exception.InnerException を参照してください。エラー: ファイルまたはアセンブリを読み込めませんでした 'AxInterop.WMPLib.Version=1.0.0.0 Culture=neutral. PublicKeyToken=null' またはその依存関係の 1 つ。システムは、指定されたファイルを見つけることができません
Visual Studio でプログラムが正常に動作する理由がわかりません。しかし、.exeにエラーがあります
エラーのあるフォームのコードは次のとおりです
Public Class formVideo
Private Sub TestForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Location = New Point((Screen.PrimaryScreen.WorkingArea.Width - Me.Width) / 2,
(Screen.PrimaryScreen.WorkingArea.Height - Me.Height) / 2)
Call Disable(Me)
End Sub
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal revert As Integer) As Integer
Private Declare Function EnableMenuItem Lib "user32" (ByVal menu As Integer, ByVal ideEnableItem As Integer, ByVal enable As Integer) As Integer
Private Const SC_CLOSE As Integer = &HF060
Private Const MF_BYCOMMAND As Integer = &H0
Private Const MF_GRAYED As Integer = &H1
Private Const MF_ENABLED As Integer = &H0
Public Shared Sub Disable(ByVal form As System.Windows.Forms.Form)
' The return value specifies the previous state of the menu item (it is either
' MF_ENABLED or MF_GRAYED). 0xFFFFFFFF indicates that the menu item does not exist.
Select Case EnableMenuItem(GetSystemMenu(form.Handle.ToInt32, 0), SC_CLOSE, MF_BYCOMMAND Or MF_GRAYED)
Case MF_ENABLED
Case MF_GRAYED
Case &HFFFFFFFF
Throw New Exception("The Close menu item does not exist.")
Case Else
End Select
End Sub
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
Call Disable(Me)
End Sub
Private Sub btnMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMenu.Click
Me.Close()
formMenu.Show()
End Sub
Private Sub btnPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlay.Click
mpVideo.Ctlcontrols.play()
End Sub
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
mpVideo.Ctlcontrols.pause()
End Sub
Private Sub btnCPU_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCPU.Click
mpVideo.URL = "Resources\See How the CPU Works In One Lesson.avi"
End Sub
Private Sub btnMobo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMobo.Click
mpVideo.URL = "Resources\Understanding your motherboard.avi"
End Sub
Private Sub btnHDD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHDD.Click
mpVideo.URL = "Resources\What is a Hard Drive_ (HDD vs SSD_) - Computer Basics.avi"
End Sub
Private Sub btnRam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRam.Click
mpVideo.URL = "Resources\What is RAM_ - Computer Basics.avi"
End Sub
Private Sub btnPSU_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPSU.Click
mpVideo.URL = "Resources\Testing the PC's PSU.avi"
End Sub
Private Sub btnVGA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVGA.Click
mpVideo.URL = "Resources\What is a GPU_ - Computer Basics.avi"
End Sub
Private Sub btnCooling_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCooling.Click
mpVideo.URL = "Resources\A Beginner's Guide to Water Cooling Your Computer.avi"
End Sub
Private Sub btnExtensions_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExtensions.Click
mpVideo.URL = "Resources\Peripheral - Wiki Article.avi"
End Sub
Private Sub mpVideo_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mpVideo.Enter
mpVideo.stretchToFit = True
End Sub
Private Sub btnFF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFF.Click
mpVideo.Ctlcontrols.fastForward()
End Sub
Private Sub btnRewind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRewind.Click
mpVideo.Ctlcontrols.fastReverse()
End Sub
End Class