天嵌 ARM开发社区

 找回密码
 注册
查看: 2131|回复: 3

开发wince应用程序时没有头文件如何使用.NET下的dll文件

[复制链接]
liliuteng 发表于 2012-2-23 09:50:48 | 显示全部楼层 |阅读模式
如题,开发wince6.0的应用程序时不知道如何调用.net的dll文件,(dll文件里面主要实现了很多类和类的成员函数,所以需要导出里面的类和类的成员函数)  试了一些方法,如Loadlibrary可以返回非零句柄,但不知道如何导出类,没有头文件编译也是个问题。 求大侠指点。。。
TQ_guoxixiao 发表于 2012-2-23 10:22:27 | 显示全部楼层
这是一个显示隐藏任务栏的例子,希望对你有帮助

[DllImport("coredll.dll")]
private static extern int FindWindow(string lpClassName, string lpWindowName);
[DllImport("coredll.dll")]
internal extern static int EnableWindow(int hwnd, int fEnable);
[DllImport("coredll.dll")]
public static extern int ShowWindow(int hwnd, int nCmdShow);
int hTaskBarWnd;
        
hTaskBarWnd = FindWindow("HHTaskBar", null);
           
ShowWindow(hTaskBarWnd, 0);//隐藏
            
ShowWindow(hTaskBarWnd, 1);//显示
 楼主| liliuteng 发表于 2012-2-23 10:50:55 | 显示全部楼层
谢谢你的回复,但[DllImport("coredll.dll")]在vs2005里总是报错,错误如下
d:\my documents\visual studio 2005\projects\rfid1\rfid1\rfid1Dlg.h(33) : error C2337: 'DllImport' : attribute not found
请问你这个是用在C#里的么,这段代码放在哪个文件里面呢?
TQ_guoxixiao 发表于 2012-2-27 14:38:24 | 显示全部楼层
下面是一个例子,去掉无关的信息。
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;
using System.Diagnostics;

namespace TQBeep
{
    public partial class Beep : Form
    {
        [DllImport("coredll.dll")]
        private static extern int FindWindow(string lpClassName, string lpWindowName);//×′ì¬à¸2ù×÷
        [DllImport("coredll.dll")]
        internal extern static int EnableWindow(int hwnd, int fEnable);
        [DllImport("coredll.dll")]
        public static extern int ShowWindow(int hwnd, int nCmdShow);
        int hTaskBarWnd;

         public Beep()
         {
             hTaskBarWnd = FindWindow("HHTaskBar", null);
             ShowWindow(hTaskBarWnd, 0);//隐藏状态栏
         }
    }
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-6-10 10:59 , Processed in 1.015625 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表