기존 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은 클릭 "계속하면, 그 이후
) 인터넷에서 발견 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);
...
}
}
며칠 동안 고생하고 있습니다. 어떤 도움이나 제안도 환영합니다.
그 중 일부 이벤트에서 무엇을하고 있습니까? 특히, LocationChanged 및 VisibleChanged. – LarsTech
이러한 이벤트에서 코드가 실행되지 않았으므로 거기에 디버거를 중지하려고하는 더미 코드를 추가했습니다. 코드가있는 이벤트는 ItemClicked, ItemDoubleClicked, DragDrop 및 DragEnter이며 컨트롤이 표시 될 때 아무 것도 트리거되지 않습니다. –
모든 이벤트의 모든 코드를 주석으로 처리하여 확인할 수 있습니다. – GuidoG