-1
我在使用DllImport
函数时遇到问题!DllImport未找到C++
using namespace System;
using namespace System::Runtime::InteropServices;
[DllImport("user32.dll")]
运行时它不会显示属性。我正在使用C++的Windows窗体。我真的很喜欢WindowsForms。
namespace Projekt3{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Collections::Generic;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Runtime::InteropServices;
using namespace System::Threading::Tasks;
using namespace System::IO;
using namespace std;
public ref class next : public System::Windows::Forms::Form
{
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(String sClassName, String sAppName);
[DllImport("user32.dll")]
private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk);
[DllImport("user32.dll")]
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
public:
next(void)
{
InitializeComponent();
//
//TODO: Konstruktorcode hier hinzufügen.
//
}
public: enum fsmodifiers
{
NOMOD = 0x0000,
ALT = 0x0001,
CTRL = 0x0002,
SHIFT = 0x0004,
WIN = 0x0008,
};
尝试添加'DllImportAttribute'。同样在C++/CLI中,您可以直接调用Win32 API! –
没有为我工作。感谢您的快速回答。 – luckeRRR