2016-12-20 1 views
1

기존 Windows Forms 응용 프로그램을 유지 관리해야합니다. 방금 소스 코드가 있거나 설명서가 없거나 아무것도 없습니다. 64 비트 Windows 8.1에서 실행되고 .NET Framework 4.5를 사용하는 Visual Studio 2015를 사용하여 응용 프로그램을 작성하고 있습니다. 한 가지를 제외하고는 모두 잘 작동합니다. VbPowerPack (버전 1.0.1644.16184, 버전이 오래됨) FileViewer라는 이름의 컨트롤은 폴더의 내용을 표시하는 데 사용되며 처음으로 창이 표시되도록 설정된 경우 예외가 계속 throw됩니다.Windows Forms - 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) 

(예외적으로 언급 한 Ken이 아니며 DLL이 컴퓨터에 컴파일되어 있어야하며 Ken 부분이없는 동일한 예외가 발생합니다. 동일한 인스턴스를 사용하면주의해야합니다. DLL은 클릭 "계속하면, 그 이후

Exception screenshot

) 인터넷에서 발견 inu "를"처리되지 않은 예외 창 "에 추가하고 다른 탭을 클릭 한 다음 다시 시도해보십시오. 예외가 다시 발생하지 않고 컨트롤을 보여 주지만 폴더 내용은 없습니다.

이 컨트롤 안에 새로 만든 빈 Windows Forms 프로젝트에서 동일한 컨트롤에 새 폼을 추가하려고 시도했지만 동일하게 동작했습니다. 그러나 새로운 Windows Forms 프로젝트로 새로운 빈 솔루션을 만들고 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는 기본적으로 플랫폼 대상을 "모든 CPU"로 설정합니다. 이는 필자의 경우 64 비트를 의미합니다. 새로 추가 된 프로젝트에서이 프로젝트가 어떻게 작동하는지에 대한 설명은 플랫폼 대상을 "모든 CPU"로 설정했지만 "32 비트 선호"를 기본적으로 선택 (체크) 한 상태로 Win Forms 프로젝트를 작성한 것입니다.

왜 이전에 x86으로 실행하지 않았습니까? 음 ... 32 비트에서 실행하면 다른 문제가 발생하지만 해결 한 후에는 FileViewer 컨트롤이 작동합니다. 도움을 주신 것에 대해 @LarsTech와 @GuidoG에게 감사드립니다.