调用 windows mobile系统的API

肉肉妈 2010-08-20 09:55:12
想做一个调用 windows mobile系统下各个应用程序的软件,做为桌面软件!各位高手有没有相关的代码提供一些,谢谢!!
...全文
204 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
肉肉妈 2010-08-24
  • 打赏
  • 举报
回复
这些简单的已经调出来了,现在想调主界面,就像菜单栏一样。不调出这个界面很多东西都做不了,请问你知道怎么调吗?我试过这个\Windows\ctlpnl.exe cplmain.cpl,11,0,但不对!
RLib 2010-08-24
  • 打赏
  • 举报
回复
CreateProcess是用来启动进程的。

计算器,短信,邮件这些程序一般位于\Windows\下,提取路径并传给CreateProcess就可以
chenhong0716 2010-08-23
  • 打赏
  • 举报
回复
请楼上的学习了MSDN的知识后再来建议一下吧,
还好,我先翻译出来给你看看吧!
也许,MICROSOFT的这个解释是错误的吧!!!!!!

The command line to be executed. The maximum length of this string is 32,768 characters, including the Unicode terminating null character. If lpApplicationName is NULL, the module name portion of lpCommandLine is limited to MAX_PATH characters.

The Unicode version of this function, CreateProcessW, can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation.

The lpCommandLine parameter can be NULL. In that case, the function uses the string pointed to by lpApplicationName as the command line.

If both lpApplicationName and lpCommandLine are non-NULL, the null-terminated string pointed to by lpApplicationName specifies the module to execute, and the null-terminated string pointed to by lpCommandLine specifies the command line. The new process can use GetCommandLine to retrieve the entire command line. Console processes written in C can use the argc and argv arguments to parse the command line. Because argv[0] is the module name, C programmers generally repeat the module name as the first token in the command line.

If lpApplicationName is NULL, the first white space–delimited token of the command line specifies the module name. If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin (see the explanation for the lpApplicationName parameter). If the file name does not contain an extension, .exe is appended. Therefore, if the file name extension is .com, this parameter must include the .com extension. If the file name ends in a period (.) with no extension, or if the file name contains a path, .exe is not appended. If the file name does not contain a directory path, the system searches for the executable file in the following sequence:

The directory from which the application loaded.
The current directory for the parent process.
The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable. Note that this function does not search the per-application path specified by the App Paths registry key. To include this per-application path in the search sequence, use the ShellExecute function.

The system adds a terminating null character to the command-line string to separate the file name from the arguments. This divides the original string into two strings for internal processing.

命令行执行。这个字符串的最大长度是32,768个字符,包括终止空字符的Unicode。如果lpApplicationName为NULL,在lpCommandLine模块名称部分仅限于MAX_PATH个字符。

该函数的Unicode版本,CreateProcessW,可以修改这个字符串的内容。因此,这个参数不能是只读存储器(如一个const变量或字符串指针)。如果这个参数是一个常量字符串,该函数可能会导致访问冲突。

lpCommandLine参数可以是NULL。在这种情况下,该函数使用所指向的字符串作为命令行lpApplicationName。(要调用的EXE程序)

如果lpApplicationName和lpCommandLine都非空,空结束的字符串所指向lpApplicationName指定模块执行和空结束的字符串所指向lpCommandLine指定命令行。新进程可以使用GetCommandLine检索整个命令行。 C语言编写的控制台程序可以使用argc和argv参数解析命令行。由于的argv [0]是模块名,C程序员通常重复在命令行的第一个标记模块的名字。

如果lpApplicationName为NULL,第一个空格分隔的命令行标记指定模块名。如果您使用的是一个长的文件名称包含空格,使用引号的字符串,以指示该文件名结束和开始的论点(见为lpApplicationName参数的解释)。如果文件名不包含扩展名。exe是追加。因此,如果文件扩展名。com,该参数必须包含。com扩展名。如果文件名称结尾的句点(。没有扩展名,或者如果文件名包含路径)。exe是不追加。如果文件名不包含目录路径,这在下面的序列的可执行文件的系统搜索:

该目录由该应用程序加载。
对于父进程的当前目录。
32位Windows系统目录。使用GetSystemDirectory函数来获取此目录的路径。
16位Windows系统目录。有没有功能,可以获取此目录的路径,但它是搜索。这个目录的名称是系统。
在Windows目录中。使用GetWindowsDirectory函数获得这个目录的路径。
这是在PATH环境变量中列出的目录。请注意,此功能不会搜索的每应用程序路径的应用程序路径注册表项中指定。要在搜索中包括这个顺序每个应用程序的路径,使用的ShellExecute函数。

该系统增加了一个终止空字符的命令行字符串分开参数的文件名。这分为两个内部处理字符串的原始字符串。
大饼哥- 2010-08-21
  • 打赏
  • 举报
回复
private void button1_Click(object sender, EventArgs e)
{
CreateProcess(program, "", IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);


}
[System.Runtime.InteropServices.DllImport("Coredll", EntryPoint = "CreateProcess")]
public static extern int CreateProcess(string pszImageName, string pszCmdLine, IntPtr psaProcess, IntPtr psaThread, bool fInheritHandles, int fdwCreate, IntPtr pvEnvironment, IntPtr pszCurDir, IntPtr psiStartInfo, IntPtr pProcInfo)
{}


个人实在没有看明白这个是什么意思,CreateProcess是系统的API,为什么要重载个空的。。。。
那这样不就什么是都不干了???


可能本人不懂C#,弱弱问问。。。。。
thestronger 2010-08-20
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 qiaoba1987 的回复:]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
usin……
[/Quote]
你手机上有E盘么??
肉肉妈 2010-08-20
  • 打赏
  • 举报
回复
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using Microsoft.WindowsMobile;


namespace QuickMeun
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();

}

private void Form2_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
CreateProcess(program, "", IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);


}
[System.Runtime.InteropServices.DllImport("Coredll", EntryPoint = "CreateProcess")]
public static extern int CreateProcess(string pszImageName, string pszCmdLine, IntPtr psaProcess, IntPtr psaThread, bool fInheritHandles, int fdwCreate, IntPtr pvEnvironment, IntPtr pszCurDir, IntPtr psiStartInfo, IntPtr pProcInfo)
{}
}
}



大侠,这样写对吗?但是出错了,
Error 1 'QuickMeun.Form2.CreateProcess(string, string, System.IntPtr, System.IntPtr, bool, int, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)' cannot be extern and declare a body E:\QuickMeun\QuickMeun\Form2.cs 42 32 QuickMeun
您看,怎么办啊?
chenhong0716 2010-08-20
  • 打赏
  • 举报
回复
调用
CreateProcess(program, "", IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
肉肉妈 2010-08-20
  • 打赏
  • 举报
回复
不好意思,我实在看不懂,能完整点吗?只要调计算器就行,其他的我自己找!
chenhong0716 2010-08-20
  • 打赏
  • 举报
回复
这是你想要的
[System.Runtime.InteropServices.DllImport("Coredll", EntryPoint="CreateProcess")]
public static extern int CreateProcess(string pszImageName, string pszCmdLine, IntPtr psaProcess, IntPtr psaThread, bool fInheritHandles, int fdwCreate, IntPtr pvEnvironment, IntPtr pszCurDir, IntPtr psiStartInfo, IntPtr pProcInfo);
肉肉妈 2010-08-20
  • 打赏
  • 举报
回复
是的!调用系统自带的一些功能,如计算器,短信,邮件什么的!这些在windows下很简单,但在mobile下不好用,也许是我不懂的原因。如果知道,请帮帮忙!
wade008 2010-08-20
  • 打赏
  • 举报
回复
就是建立快捷方式?

7,655

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧