win7程序如何运行在XP系统

2025-03-18 15:10:52
推荐回答(3个)
回答1:

有一程序在xp下能正常运行,在win 7下运行后就跳出 程序已停止工作。

用vs2008调试发现是
map2DView = new Map2DView(this);

句代码出现 了异常异常信息如下:

{System.Reflection.TargetInvocationException: 无法获取“AxXnLegendView”控件的窗口句柄。不支持无窗口的 ActiveX 控件。 ---> System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
在 System.Windows.Forms.UnsafeNativeMethods.IOleObject.DoVerb(Int32 iVerb, IntPtr lpmsg, IOleClientSite pActiveSite, Int32 lindex, IntPtr hwndParent, COMRECT lprcPosRect)
在 System.Windows.Forms.AxHost.DoVerb(Int32 verb)
在 System.Windows.Forms.AxHost.InPlaceActivate()
--- 内部异常堆栈跟踪的结尾 ---
在 System.Windows.Forms.AxHost.InPlaceActivate()
在 System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
在 System.Windows.Forms.AxHost.CreateHandle()
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
在 System.Windows.Forms.AxHost.EndInit()
在 CGUDF.GIS.ProUDP.View2D.Map2DView.InitializeComponent()
在 CGUDF.GIS.ProUDP.View2D.Map2DView..ctor(Form mainForm)
在 GISMap.MainForm.InitMapRelative() 位置 E:\Demo\DataCenter\GISMap\MainForm.cs:行号 99}

AxXnLegendView 类的结构如下:
public class AxXnLegendView : AxHost
{

private IXnLegendView ocx;
public AxXnLegendView();
protected override void AttachInterfaces();
public virtual int bindLegendFrame(XnLegendFrame frame);
public virtual void exposeLegendFrame(out XnLegendFrame pLegendFrame);
public virtual void innerInit();
public virtual void refreshLegendView();
}
希望能解决您的问题。

回答2:

先有的xp,后有的win7,绝大部分情况下能在win7运行的都能在xp下运行,少部分程序可能在开发的时候没考虑xp,例如很多大型游戏在最低配置就是win7.

回答3:

  1. 用虚拟机