Startup 里面的软件 调出电话界面有问题?

金笛子 2010-01-06 04:39:40
windows mobile 6上面
我这样调出电话界面 居然有问题 只要是把自己的软件放到startup里面 然后重新启动手机 就会自动启动我的这个软件 这个去点该软件上面的一个按钮 然后打开电话 界面 居然调不出电话界面来 真奇怪? 但是 如果我把这个软件放到别的目录下 然后不通过开机启动 而是通过我们自己用手去点击 然后打开 这个软件 然后就可以调出电话界面 高人指点
按钮函数如下:
PROCESS_INFORMATION pProcInfo = {0};
::CreateProcess(TEXT(" \\Windows\\cprog.exe"), NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pProcInfo);
::CloseHandle(pProcInfo.hThread);
::CloseHandle(pProcInfo.hProcess);

大家也是这样掉电话界面的吗?
...全文
133 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
金笛子 2010-02-21
  • 打赏
  • 举报
回复
这里可以通过修改注册表 来实现开机启动 同时要保证电话程序所需要的组件加载成功后 才开始启动软件

ok 结贴。
beautymind2008 2010-01-07
  • 打赏
  • 举报
回复
恩 试试
PHONEMAKECALLINFO
PhoneMakeCall
北方大冬瓜 2010-01-07
  • 打赏
  • 举报
回复
输入号码界面显示到前台后,再调用 PhoneMakeCall 拨号就可以进度拨号界面
金笛子 2010-01-07
  • 打赏
  • 举报
回复
可能我还没有说清楚吧:比如 我做了一个软件基于MFC对话框的 文件名名test.exe 而这个软件上面有个按钮 按钮函数实现为:
PROCESS_INFORMATION pProcInfo = {0};
::CreateProcess(TEXT(" \\Windows\\cprog.exe"), NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pProcInfo);
::CloseHandle(pProcInfo.hThread);
::CloseHandle(pProcInfo.hProcess);

然后我把这个test.EXE 放到mobile 6.0 系统目录 \\Windows\\Startup\\下面
这个时候 你重新启动系统 就会自动运行我的test.exe 进程 这个时候去点按钮 却不能打开拨号界面

如果在这个情况下 我们通过任务管理器强制退出test.exe进程 然后我们跑到系统目录 \\Windows\\Startup\\下面
去用触笔点屏幕打开test.exe 这个时候去点按钮 就可以调出拨号界面来 但是这个不是我们想要的
金笛子 2010-01-07
  • 打赏
  • 举报
回复
没有办法 现在只能是这样了
const TCHAR szCMD[] = _T(" -n -url tel: ");
PROCESS_INFORMATION pProcInfo = {0};
if (::CreateProcess(TEXT("\\Windows\\cprog.exe"), szCMD, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pProcInfo))
{
::CloseHandle(pProcInfo.hThread);
::CloseHandle(pProcInfo.hProcess);
}
else
{
AfxMessageBox(L"没有找到电话程序cprog.exe");
}

PHONEMAKECALLINFO phonemakecall;
memset(&phonemakecall, 0, sizeof(phonemakecall));
phonemakecall.cbSize = sizeof(PHONEMAKECALLINFO);
phonemakecall.dwFlags = PMCF_DEFAULT;
PhoneMakeCall(&phonemakecall);

先调出可以编辑输入电话界面 然后再PhoneMakeCall 这样来弄
不过也是不能直接调出拨号界面
tan124 2010-01-07
  • 打赏
  • 举报
回复
PhoneMakeCall
金笛子 2010-01-07
  • 打赏
  • 举报
回复
To:jiangyongtao
楼主这样试试:把这个软件放到别的目录下 然后通过开机启动,再点击按钮。
怀疑可能是电话的进程还没有启动的原因导致。

如果把软件放到别的目录的话 比如Program File 下面 那我怎么样才可以开机启动这个test.exe呢?

我现在只知道放到Startup里面 开机 就可以启动哦

请指点 谢谢各位大侠了

世外涛缘 2010-01-07
  • 打赏
  • 举报
回复
楼主这样试试:把这个软件放到别的目录下 然后通过开机启动,再点击按钮。
怀疑可能是电话的进程还没有启动的原因导致。
yanbo_hu 2010-01-07
  • 打赏
  • 举报
回复
有参数可以控制播出的方式。
下面是一个打电话的例子,你自己再改一改吧

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace dropcallDemo
{
/// <summary>
/// Identifies the phone number type specified.
/// </summary>
public enum AddressType
{
/// <summary>Unknown phone number type.</summary>
Unknown,
/// <summary>International phone number.</summary>
International,
/// <summary>National phone number.</summary>
National,
/// <summary>Network-specific phone number.</summary>
NetworkSpecific,
/// <summary>Subscriber phone number.</summary>
Subscriber,
/// <summary>Alphanumeric phone number.</summary>
Alphanumeric,
/// <summary>Abbreviated phone number.</summary>
Abbreviated
}

/// <summary>
/// Information about the phone number.
/// </summary>
public struct PhoneAddress
{
/// <summary>The address type.</summary>
public AddressType AddressType;
/// <summary>The phone number in string format.</summary>
public String Address;
}

/// <summary>
/// Phone control.
/// </summary>
public class Phone
{
private static long PMCF_DEFAULT = 0x00000001;
private static long PMCF_PROMPTBEFORECALLING = 0x00000002;

private struct PhoneMakeCallInfo
{
public IntPtr cbSize;
public IntPtr dwFlags;
public IntPtr pszDestAddress;
public IntPtr pszAppName;
public IntPtr pszCalledParty;
public IntPtr pszComment;
}

[DllImport("phone.dll")]
private static extern IntPtr PhoneMakeCall(ref PhoneMakeCallInfo ppmci);

/// <summary>
/// Dials the specified phone number.
/// </summary>
/// <param name="PhoneNumber">Phone number to dial.</param>
public static void MakeCall(string PhoneNumber)
{
MakeCall(PhoneNumber, false);
}

/// <summary>
/// Dials the specified phone number.
/// </summary>
/// <param name="PhoneNumber">Phone number to dial.</param>
/// <param name="PromptBeforeCall">Prompts the user before the call is placed.</param>
unsafe public static void MakeCall(string PhoneNumber, bool PromptBeforeCall)
{
IntPtr res;

PhoneNumber += '\0';
char[] cPhoneNumber = PhoneNumber.ToCharArray();

fixed (char* pAddr = cPhoneNumber)
{
PhoneMakeCallInfo info = new PhoneMakeCallInfo();
info.cbSize = (IntPtr)Marshal.SizeOf(info);
info.pszDestAddress = (IntPtr)pAddr;

if (PromptBeforeCall)
{
info.dwFlags = (IntPtr)PMCF_PROMPTBEFORECALLING;
}
else
{
info.dwFlags = (IntPtr)PMCF_DEFAULT;
}

res = PhoneMakeCall(ref info);
}
}
}

/// <summary>
/// Reads information from the Subscriber Identity Module (SIM)
/// </summary>
public class Sim
{
private static long SERVICE_PROVIDER = 0x00006F46;

[StructLayout(LayoutKind.Sequential)]
private struct SimRecord
{
public IntPtr cbSize;
public IntPtr dwParams;
public IntPtr dwRecordType;
public IntPtr dwItemCount;
public IntPtr dwSize;
}

[DllImport("sms.dll")]
private static extern IntPtr SmsGetPhoneNumber(IntPtr psmsaAddress);

[DllImport("cellcore.dll")]
private static extern IntPtr SimInitialize(IntPtr dwFlags, IntPtr lpfnCallBack, IntPtr dwParam, out IntPtr lphSim);

[DllImport("cellcore.dll")]
private static extern IntPtr SimGetRecordInfo(IntPtr hSim, IntPtr dwAddress, ref SimRecord lpSimRecordInfo);

[DllImport("cellcore.dll")]
private static extern IntPtr SimReadRecord(IntPtr hSim, IntPtr dwAddress, IntPtr dwRecordType, IntPtr dwIndex, byte[] lpData, IntPtr dwBufferSize, ref IntPtr lpdwBytesRead);

[DllImport("cellcore.dll")]
private static extern IntPtr SimDeinitialize(IntPtr hSim);

/// <summary>
/// Gets the phone number from the SIM.
/// </summary>
/// <returns>PhoneAddress structure with phone number.</returns>
unsafe public static PhoneAddress GetPhoneNumber()
{
PhoneAddress phoneaddr = new PhoneAddress();

Byte[] buffer = new Byte[516];
fixed (byte* pAddr = buffer)
{
IntPtr res = SmsGetPhoneNumber((IntPtr)pAddr);
if (res != IntPtr.Zero)
throw new Exception("Could not get phone number from SIM");

byte* pCurrent = pAddr;
phoneaddr.AddressType = (AddressType)Marshal.ReadInt32((IntPtr)pCurrent);
pCurrent += Marshal.SizeOf(phoneaddr.AddressType);
phoneaddr.Address = Marshal.PtrToStringUni((IntPtr)pCurrent);
}

return phoneaddr;
}

/// <summary>
/// Gets the current wireless carriers network name from the SIM.
/// </summary>
/// <returns>The carrier description.</returns>
public static string GetServiceProvider()
{
IntPtr hSim, res;

res = SimInitialize(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, out hSim);
if (res != IntPtr.Zero)
throw new Exception("Could not initialize SIM");

SimRecord rec = new SimRecord();
rec.cbSize = (IntPtr)Marshal.SizeOf(rec);

res = SimGetRecordInfo(hSim, (IntPtr)SERVICE_PROVIDER, ref rec);
if (res != IntPtr.Zero)
throw new Exception("Could not read the service provider information from the SIM");

byte[] bData = new byte[(int)rec.dwSize + 1];
IntPtr dwBytesRead = IntPtr.Zero;

res = SimReadRecord(hSim, (IntPtr)SERVICE_PROVIDER, rec.dwRecordType, IntPtr.Zero, bData, (IntPtr)bData.Length, ref dwBytesRead);
if (res != IntPtr.Zero)
throw new Exception("Could not read the service provider from the SIM");

byte[] bScrubbed = new byte[(int)dwBytesRead];
int nPos = 0;

// Scrub the non-ascii characters
for (int i = 0; i < (int)dwBytesRead; i++)
{
if (((int)bData[i] > 19) && ((int)bData[i] < 125))
{
bScrubbed[nPos] = bData[i];
nPos++;
}
}

SimDeinitialize(hSim);

return Encoding.ASCII.GetString(bScrubbed, 0, bScrubbed.Length);
}
}
}

金笛子 2010-01-06
  • 打赏
  • 举报
回复
谢谢 大冬瓜 不过 还请你帮忙看看 问题还是有!

1.hWnd = ::FindWindow(TEXT("Dialog"),L"电话 "); 根本没有发现

2.用::SetWindowPos(主窗口句柄,HWND_NOTOPMOST,0, 0, 0, 0, SWP_SHOWWINDOW);
就可以看到拨号界面 但是有一点就是 首先会先显示主窗口后面的窗口 然后再显示拨号窗口 这个问题 怎么避免了

3.
const TCHAR szCMD[] = _T(" -n -url tel:10086");
CreateProcess(_T("\\Windows\\cprog.exe"), szCMD, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL);

采用这个方法可以调出一个可以输入号码的界面 但是不是我们想要的拨号界面 只有点拨号才可以调出拨号界面

然后回去 第2次再来的话 直接就可以调出拨号界面了

但是我想直接调出 怎么处理呢?


北方大冬瓜 2010-01-06
  • 打赏
  • 举报
回复
你用 Spy 看看电话程序启动没,用 FindWindow 给调到前台试试

7,655

社区成员

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

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