5849|22

63

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

驱动如何让一个应用程序运行? [复制链接]

驱动如何让一个应用程序运行?
我看过一个PDA,按下一个按钮就会弹出一个关机的应用程序的界面。
概括的说应该是驱动如何发消息给上层,呵呵。
请问这是怎么实现的,
大家指点一下。

最新回复

make  详情 回复 发表于 2009-12-24 08:54
点赞 关注

回复
举报

84

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
For example, an application named Program.exe could be associated with COM port detection using the following code:

CeRunAppAtEvent("Program.exe", NOTIFICATION_EVENT_RS232_DETECTED);
Then, the serial driver could signal a newly detected COM port with the following code:

CeEventHasOccurred (NOTIFICATION_EVENT_RS232_DETECTED, L"A new COM
port has been detected!");
When the event is triggered, the application would be launched as though you entered the following command on the command line:

program.exe AppRunAtRs232Detect A new COM port has been detected!
In this example, CeRunAppAtEvent automatically adds the string AppRunAtRs232Detect to the command line.

To add your own notification event to your system, you must modify CeNotifyPublic_FilterEvent to recognize your event. Next, call CeEventHasOccurred from your software component or device driver, as appropriate.

The delay for blocking the CeEventHasOccured function while the OS initializes can be set with the ShortApiTimeout registry value. For more information, see General GWES Registry Settings.

出处:MSDN: ms-help://MS.WindowsCE.500/wceshellui5/html/wce50lrfceeventhasoccurred.htm

还没测试过,应该可用的.
 
 

回复

80

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
应用程序可以调用驱动来监听按钮的状态,按钮按下,应用程序打开相应的界面。
驱动应该可以做成类似于串口的流驱动。就跟应用程序通过调用串口驱动操作串口时,当端口接收到数据时完成相应的操作一样。
这个具体也没做过,等待高手发言,学习了。
 
 
 

回复

71

帖子

0

TA的资源

一粒金砂(初级)

4
 
引用 1 楼 flandy1982 的回复:
For example, an application named Program.exe could be associated with COM port detection using the following code:

CeRunAppAtEvent("Program.exe", NOTIFICATION_EVENT_RS232_DETECTED);
Then, the serial driver could signal a newly detected COM port with the following code:

CeEventHasOccurred (NOTIFICATION_EVENT_RS232_DETECTED, L"A new COM
port has been detected!");
When the event is triggered, the application would be launched as though you entered the following command on the command line:

program.exe AppRunAtRs232Detect A new COM port has been detected!
In this example, CeRunAppAtEvent automatically adds the string AppRunAtRs232Detect to the command line.

To add your own notification event to your system, you must modify CeNotifyPublic_FilterEvent to recognize your event. Next, call CeEventHasOccurred from your software component or device driver, as appropriate.

The delay for blocking the CeEventHasOccured function while the OS initializes can be set with the ShortApiTimeout registry value. For more information, see General GWES Registry Settings.

出处:MSDN: ms-help://MS.WindowsCE.500/wceshellui5/html/wce50lrfceeventhasoccurred.htm

还没测试过,应该可用的.


不懂哦。
 
 
 

回复

69

帖子

0

TA的资源

一粒金砂(初级)

5
 
这个很简单啊,在DEVICEIOCONTROL里控制啊。
 
 
 

回复

92

帖子

0

TA的资源

一粒金砂(初级)

6
 
call CreateProcess

Paul, Chao @ Techware
 
 
 

回复

65

帖子

0

TA的资源

一粒金砂(初级)

7
 
引用 5 楼 paul_chao 的回复:
call CreateProcess

Paul, Chao @ Techware



这个办法我试试,呵呵。
 
 
 

回复

82

帖子

0

TA的资源

一粒金砂(初级)

8
 
引用 6 楼 gooogleman 的回复:
引用 5 楼 paul_chao 的回复:
call CreateProcess

Paul, Chao @ Techware



这个办法我试试,呵呵。
应该就是这个了
在C:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\BLUETOOTH\SAMPLE\BTDIALP\
有例子。
PROCESS_INFORMATION pi;
                STARTUPINFO                si;

                memset (&pi, 0, sizeof(pi));
                memset (&si, 0, sizeof(si));
                si.cb = sizeof(si);

                DWORD bCP = CreateProcess (L"btdialer.exe", numbers[ndx].szPhone, NULL, NULL, FALSE, 0, NULL,
                                        NULL, &si, &pi);

                if (bCP) {
                        CloseHandle (pi.hThread);
                        CloseHandle (pi.hProcess);
                }
 
 
 

回复

86

帖子

0

TA的资源

一粒金砂(初级)

9
 
CreateProcess(_T("\\User\\Program\\Camera\\Camera.exe"),NULL, NULL, NULL,FALSE, 0, NULL, NULL, NULL, NULL);
我原来写过的一句
好不容易看到一个会答的,被别人抢先了
 
 
 

回复

83

帖子

0

TA的资源

一粒金砂(初级)

10
 
引用 2 楼 feihu521a 的回复:
应用程序可以调用驱动来监听按钮的状态,按钮按下,应用程序打开相应的界面。
驱动应该可以做成类似于串口的流驱动。就跟应用程序通过调用串口驱动操作串口时,当端口接收到数据时完成相应的操作一样。
这个具体也没做过,等待高手发言,学习了。


测试程序
1. 编写一个关机按钮程序, 例如 powerbtn.exe, 拷贝到wince的windows目录下
驱动修改
1. 在驱动初始化时调用CeRunAppAtEvent(_T("PowerBtn.exe"), NOTIFICATION_EVENT_LAST);
2. 在按钮被按下的响应函数里面调用 CeEventHasOccurred(NOTIFICATION_EVENT_LAST, _T("参数"));
当有按钮按下时, 相当于在commandline输入 "powerbtn.exe 参数"
我测试了下,是可用的.
 
 
 

回复

61

帖子

0

TA的资源

一粒金砂(初级)

11
 
引用 8 楼 beeboobeeboo 的回复:
CreateProcess(_T("\\User\\Program\\Camera\\Camera.exe"),NULL, NULL, NULL,FALSE, 0, NULL, NULL, NULL, NULL);
我原来写过的一句
好不容易看到一个会答的,被别人抢先了


都给分,哈哈哈
 
 
 

回复

76

帖子

0

TA的资源

一粒金砂(初级)

12
 
引用 9 楼 flandy1982 的回复:
引用 2 楼 feihu521a 的回复:
应用程序可以调用驱动来监听按钮的状态,按钮按下,应用程序打开相应的界面。
驱动应该可以做成类似于串口的流驱动。就跟应用程序通过调用串口驱动操作串口时,当端口接收到数据时完成相应的操作一样。
这个具体也没做过,等待高手发言,学习了。


测试程序
1. 编写一个关机按钮程序, 例如 powerbtn.exe, 拷贝到wince的windows目录下
驱动修改
1. 在驱动初始化时调用CeRunAppAtEvent(_T("PowerBtn.exe"), NOTIFICATION_EVENT_LAST);
2. 在按钮被按下的响应函数里面调用 CeEventHasOccurred(NOTIFICATION_EVENT_LAST, _T("参数"));
当有按钮按下时, 相当于在commandline输入 "powerbtn.exe 参数"
我测试了下,是可用的.



还有这样的方法?
 
 
 

回复

49

帖子

0

TA的资源

一粒金砂(初级)

13
 
驱动程序是硬件与应用程序之间的一个接口,驱动程序根据具体的硬件设备,写好read,write,ioctl,open,close等函数,作为应用程序调用的API。应用程序调用底层程序,实现上层用户的需求
 
 
 

回复

73

帖子

0

TA的资源

一粒金砂(初级)

14
 
我们是在驱动程序中检测到有按键,然后PostMessage(HWND_BROADCAST,WM_KEYDOWN,'B',0);
AP像检测键盘的按键那样可以接收到信息,然后就可以执行要执行的程序了。
 
 
 

回复

49

帖子

0

TA的资源

一粒金砂(初级)

15
 
我觉得还是不要让驱动直接调AP比较好,驱动只向上层发送消息,由上层AP根据消息去做事,这样OS的通用性也比较好,可以开发不同的AP,只要能接收到驱动发来的消息并处理就行。
 
 
 

回复

77

帖子

0

TA的资源

一粒金砂(中级)

16
 
引用 8 楼 beeboobeeboo 的回复:
CreateProcess(_T("\\User\\Program\\Camera\\Camera.exe"),NULL, NULL, NULL,FALSE, 0, NULL, NULL, NULL, NULL);
我原来写过的一句
好不容易看到一个会答的,被别人抢先了


3Q 搞定!                  
CreateProcess(_T("\\Windows\\camtest.exe"),NULL, NULL, NULL,FALSE, 0, NULL, NULL, NULL, NULL);
 
 
 

回复

61

帖子

0

TA的资源

一粒金砂(初级)

17
 
MARK!
 
 
 

回复

80

帖子

0

TA的资源

一粒金砂(初级)

18
 
mark。。。。这个。。。其实想到另外一个问题。呵呵。前段时间写了个博客。

如何在驱动层去播放一个wav的声音呢:

http://blog.eeworld.net/xumercury/archive/2009/09/18/4567370.aspx
 
 
 

回复

72

帖子

0

TA的资源

一粒金砂(初级)

19
 
CreateProcess(_T("\\Windows\\camtest.exe"),NULL, NULL, NULL,FALSE, 0, NULL, NULL, NULL, NULL);
 
 
 

回复

67

帖子

0

TA的资源

一粒金砂(初级)

20
 
引用 13 楼 veabol 的回复:
我们是在驱动程序中检测到有按键,然后PostMessage(HWND_BROADCAST,WM_KEYDOWN,'B',0);
AP像检测键盘的按键那样可以接收到信息,然后就可以执行要执行的程序了。


哦?这个在应用接受到再做事?但是我根本没有启动这个应用啊,所以扑捉不到啊。

我要在驱动直接运行这个应用,我看微软有很多都是这样做的。
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条
有奖直播:当AI遇见仿真,会有什么样的电子行业革新之路?
首场直播:Simcenter AI 赋能电子行业研发创新
直播时间:04月15日14:00-14:50

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网 4

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表