PDA

View Full Version : وقتي كدي اجرا نميشود!!!



saed2006
سه شنبه 02 شهریور 1389, 13:02 عصر
وقتي اين كد اجرا ميشه :


{
this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams);
device.RenderState.CullMode = Cull.None;
device.RenderState.FillMode = FillMode.WireFrame;
device.Transform.Projection = Matrix.PerspectiveFovLH((float)Math.PI / 4, this.Width / this.Height, 1f, 50f);
device.Transform.View = Matrix.LookAtLH(new Vector3(0, 0, -30), new Vector3(0, 0, 0), new Vector3(0, 1, 0));
device.RenderState.Lighting = false;
for (int i = 0; i < s.Count; i++)
{
vb = new VertexBuffer(typeof(CustomVertex.PositionColored), s[i].Count, device, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Default);
vertices = new CustomVertex.PositionColored[s[i].Count];
for (int j = 0; j < s[i].Count; j++)
{
vertices[j].Position = new Vector3(5f, 0f, 0f);
vertices[j].Color = Color.White.ToArgb();
}
vb.SetData(vertices, 0, LockFlags.None);
}
device.Clear(ClearFlags.Target, Color.DarkSlateBlue, 1.0f, 0);
device.BeginScene();
device.VertexFormat = CustomVertex.PositionColored.Format;
device.SetStreamSource(0, vb, 0);
device.Indices = ib;
device.DrawIndexedPrimitives(PrimitiveType.Triangl eList, 0, 0, 5, 0, 2);
device.EndScene();
device.Present();
this.Invalidate();
angle += 0.05f;




خط اول اين خطا رو ميده:



DLL 'C:\WINDOWS\assembly\GAC\Microsoft.DirectX.Direct3 D\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.D irect3D.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

behzadk
سه شنبه 02 شهریور 1389, 13:52 عصر
directx redist را نصب کرید یا نه؟
و یکی هم اینو امتحان کن


SetStyle(ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true);

اما به نظر من directx redist رو باید از اول نصب کنی

saed2006
سه شنبه 02 شهریور 1389, 13:56 عصر
نصب نكردم
چي هست