2016-12-20 4 views
1

古いWindowsフォームアプリケーションを維持する必要があります。私はちょうどソースコード、ドキュメントや何も持っていない。 私は64ビットWindows 8.1で動作し、.NET Framework 4.5を使用しているVisual Studio 2015を使用してアプリケーションを構築しています。 1つのことを除いてすべてうまくいきますが、FileViewerという名前のVbPowerPackコントロールは、フォルダの内容を表示するために使用され、初めて表示されるように設定されています(Windowsフォーム - VbPowerPack v1予期しない例外をスローするFileViewer

)。
System.OverflowException: Arithmetic operation resulted in an overflow. 
    at System.IntPtr.ToInt32() 
    at VbPowerPack.ShellFolder.GetTypeDescriptionForFile(String in_path) in C:\Documents and Settings\Ken\My Documents\Visual Studio Projects\VbPowerPack Source\VbPowerPack\ShellFolder.vb:line 264 
    at VbPowerPack.FileViewer.populateControl() in C:\Documents and Settings\Ken\My Documents\Visual Studio Projects\VbPowerPack Source\VbPowerPack\FileViewer.vb:line 992 
    at VbPowerPack.FileViewer.CreateHandle() in C:\Documents and Settings\Ken\My Documents\Visual Studio Projects\VbPowerPack Source\VbPowerPack\FileViewer.vb:line 866 
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) 
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) 
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) 
    at System.Windows.Forms.Control.CreateControl() 
    at System.Windows.Forms.Control.SetVisibleCore(Boolean value) 
    at System.Windows.Forms.TabPage.set_Visible(Boolean value) 
    at System.Windows.Forms.TabControl.UpdateTabSelection(Boolean updateFocus) 
    at System.Windows.Forms.TabControl.OnSelectedIndexChanged(EventArgs e) 
    at System.Windows.Forms.TabControl.WmSelChange() 
    at System.Windows.Forms.TabControl.WndProc(Message& m) 
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 

(例外として私がケンに言及していないことに注意してください。彼のコンピュータにDLLがコンパイルされている必要があります。同じ例外があります。 DLLは、クリックして「続きあれば、その後

Exception screenshot

)インターネット上で見つかりました「未処理の例外ウィンドウ」で「inue」をクリックして別のタブをクリックしてからもう一度この操作を試みると、例外がスローされることなくコントロールが表示されますが、フォルダの内容はありません。

このソリューション内に新しく作成された空のWindowsフォームプロジェクトに、同じコントロールに新しいフォームを追加しようとしましたが、同じ動作をしました。しかし、新しいWindowsフォームプロジェクトで新しい空のソリューションを作成し、FileViewerコントロールのみを使用するとうまく動作します。また、(アプリケーションを実行していない)デザインビューでフォームを開くと、問題のある解決策でも動作します。フォルダの内容が表示されます。 私はデバッグを試みましたが、 "VisibleChanged"のようなイベントをトリガーする前に例外がスローされました。私はこれに影響を与える可能性のある他のコードもコメントしてみましたが、運はありません。ここでは、コントロールの初期化方法を示します。

public partial class DocumentsForm 
{ 
    private VbPowerPack.FileViewer fileViewer; 
    ... 

    private void InitializeComponent() 
    { 
     this.fileViewer = new VbPowerPack.FileViewer(); 
     ... 
     this.fileViewer.AllowDrop = true; 
     this.fileViewer.ContextMenu = this.contextMenuFiles; 
     this.fileViewer.Dock = System.Windows.Forms.DockStyle.Fill; 
     this.fileViewer.HideSelection = false; 
     this.fileViewer.Location = new System.Drawing.Point(0, 34); 
     this.fileViewer.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); 
     this.fileViewer.Name = "fileViewer"; 
     this.fileViewer.Path = "c:\\"; 
     this.fileViewer.Size = new System.Drawing.Size(842, 482); 
     this.fileViewer.Sorting = System.Windows.Forms.SortOrder.Ascending; 
     this.fileViewer.TabIndex = 0; 
     this.fileViewer.UseCompatibleStateImageBehavior = false; 
     this.fileViewer.ItemClicked += new VbPowerPack.FileViewer.ItemClickedEventHandler(this.fileViewer_ItemClicked); 
     this.fileViewer.ItemDoubleClicked += new VbPowerPack.FileViewer.ItemDoubleClickedEventHandler(this.fileViewer_ItemDoubleClicked); 
     this.fileViewer.LocationChanged += new System.EventHandler(this.fileViewer_LocationChanged); 
     this.fileViewer.VisibleChanged += new System.EventHandler(this.fileViewer_VisibleChanged); 
     this.fileViewer.DragDrop += new System.Windows.Forms.DragEventHandler(this.fileViewer_DragDrop); 
     this.fileViewer.DragEnter += new System.Windows.Forms.DragEventHandler(this.fileViewer_DragEnter); 
     ... 
     this.Controls.Add(this.fileViewer); 
     ... 
    } 
} 

ここ数日間は苦労しています。どんな助けや提案も大歓迎です。

+1

これらのイベントでは何をしていますか?具体的には、LocationChangedとVisibleChangedです。 – LarsTech

+0

これらのイベントで実行されたコードはありませんでした。そこにダミーコードを追加して、そこでデバッガを停止しようとしました。コードを持つイベントは、ItemClicked、ItemDoubleClicked、DragDrop、およびDragEnterであり、コントロールが表示されたときにトリガーされるイベントはありません。 –

+0

あなたは確かにすべてのイベントのすべてのコードをコメントアウトできます。 – GuidoG

答えて

0

見つけました!問題は、VbPowerPack v1コントロールを32ビットアプリケーションで使用する必要があることです。私のコンピュータは64ビットで、Visual Studioはデフォルトでプラットフォームターゲットを「Any CPU」に設定しています。これは私の場合は64ビットを意味します。新しく追加されたプロジェクトでどのように動作したかについての説明は、これらのWinフォームプロジェクトがプラットフォームターゲットを「任意のCPU」に設定して作成され、デフォルトで「32ビット優先」にチェック(チェック)されていたことです。

なぜ以前にx86として実行しようとしなかったのですか?まあ... 32ビットで動かすと、他のいくつかの問題が取り除かれましたが、解決後にFileViewerコントロールが機能します。助けようとしてくれてありがとう@LarsTechと@GuidoG。

関連する問題