[SOURCE]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace QMTerrainEditor
{
public partial class TerrainEditor : Form
{
public enum QMERRORCODE
{
QM_OK = 1,
QM_FAIL = 100,
QM_CREATEDEVICE = 200,
QM_INVALIDPARAM = 300,
QM_OPENFAILED = 400,
QM_TERRAINSIZEINVALID = 500,
QM_CREATEVBUFFERFAILED = 600,
QM_CREATEIBUFFERFAILED = 700,
QM_BUFFERSIZE = 800,
QM_BUFFERLOCK = 900,
QM_DRAWINDEXPRIM = 1000,
QM_PSSHADERCOMPILE = 1100,
QM_PSSHADERCREATE = 1200,
QM_VSSHADERCOMPILE = 1300,
QM_VSSHADERCREATE = 1400,
QM_CREATETEXTURE = 1500,
};
#region D3D9 DLL Imports
[DllImport("QMD3D.dll", ExactSpelling = true, CallingConvention=CallingConvention.StdCall)]
public static extern QMERRORCODE D3D9Init(IntPtr hWnd);
[DllImport("QMD3D.dll", ExactSpelling = true, CallingConvention=CallingConvention.StdCall)]
public static extern void D3D9Shutdown();
[DllImport("QMD3D.dll", ExactSpelling = true, CallingConvention=CallingConvention.StdCall)]
public static extern QMERRORCODE D3D9RenderScene();
[DllImport("QMD3D.dll", ExactSpelling = true, CallingConvention=CallingConvention.StdCall)]
public static extern QMERRORCODE D3D9UpdateScene();
#endregion
public TerrainEditor()
{
InitializeComponent();
if(D3D9Init(DrawPanel.Handle) != QMERRORCODE.QM_OK)
MessageBox.Show("Error", "Error in Initialising D3D9", MessageBoxButtons.OK);
}
// Shutdown the DirectX panel when the form is closed
private void TerrainEditor_FormClosed(object sender, FormClosedEventArgs e)
{
D3D9Shutdown();
}
}
}
[/SOURCE]
[.net] Problem Debugging
Hello all, i had a coot around but couldn't find an answer to my problems so was hoping someone here could help me :)
Basically i my app doesn't reach breakpoints in my code for some reason, the application is build in debug mode, at the moment there is a c++ DLL and a c# Application, i'm not testing the c++ code just the c#, its very very simple so far, this is what i've got
[/source]
as you can see, nothing special going on here, but if i try to put a debug point in TerrainEditor() or TerrainEditor_FormClosed() my program runs but it doesn't hit the breakpoint.
I was initially having a problem along the lines of "Bad system" when loading the dll i managed to fix these however by changing the compilation system from Any to x86, however before changing this i could debug fine. :S
Another problem is that i dont like to copy the DLL every time i do a rebuild is there anyway to set an option within the c# application to search a specific folder for the c++ DLL?
I just confirmed that when the project is set to x64 it breaks but says there is no source code available, do you want to see the dissasembly. But when i try with the project set to x86 it doesn't break :S
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement