RasDeleteEntry
来源:互联网 发布:微信网络诈骗投诉电话 编辑:程序博客网 时间:2024/06/15 06:40
DWORD RasDeleteEntry( _In_ LPCTSTR lpszPhonebook, _In_ LPCTSTR lpszEntry);
说明
该函数用于在电话簿中删除条目。
参数
lpszPhonebook[in]
指向一个包含完整路径的电话簿文件(PBK)。如果参数为空,则该函数使用默认的电话簿文件。默认的电话簿文件由用户在拨号网络对话框的[user preferences]属性窗口中选择。
lpszEntry[in]
指向一个要删除的电话簿条目。
返回值
该函数成功时返回ERROR_SUCCESS,并且通过参数lphRasConn 返回连接句柄。失败时返回下列错误码之一,或者来自Routing and Remote Access Error Codes 和 winerror.h中定义的值。
注意事项
以下代码演示如何删除一个电话簿条目。
#include <stdio.h>#include <windows.h>#include "ras.h"#include "strsafe.h"#define PHONE_NUMBER_LENGTH 7#define DEVICE_NAME_LENGTH 5#define DEVICE_TYPE_LENGTH 5DWORD __cdecl wmain(){ DWORD dwRet = ERROR_SUCCESS; LPTSTR lpszEntry = L"RASEntryName"; LPTSTR lpszphonenumber = L"5555555"; LPTSTR lpszdevicename = L"Modem"; LPTSTR lpszdevicetype = RASDT_Modem; // Allocate heap memory for the RASENTRY structure LPRASENTRY lpentry = (LPRASENTRY)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RASENTRY)); if (lpentry == NULL){ printf("HeapAlloc failed"); return 0; } // The RASENTRY->dwSize member has to be initialized or the RRAS APIs will fail below. lpentry->dwSize = sizeof(RASENTRY); lpentry->dwFramingProtocol = RASFP_Ppp; lpentry->dwfOptions = 0; lpentry->dwType = RASET_Phone; dwRet |= StringCchCopyN(lpentry->szLocalPhoneNumber, RAS_MaxPhoneNumber, lpszphonenumber, PHONE_NUMBER_LENGTH); dwRet |= StringCchCopyN(lpentry->szDeviceName, RAS_MaxDeviceName, lpszdevicename, DEVICE_NAME_LENGTH); dwRet |= StringCchCopyN(lpentry->szDeviceType, RAS_MaxDeviceType, lpszdevicetype, DEVICE_TYPE_LENGTH); if (dwRet != ERROR_SUCCESS){ wprintf(L"RASENTRY structure initilization failed"); HeapFree(GetProcessHeap(), 0, lpentry); return 0; } // Validate the new entry's name dwRet = RasValidateEntryName(NULL, lpszEntry); if (dwRet != ERROR_SUCCESS){ wprintf(L"RasValidateEntryName failed: Error = %d\n", dwRet); HeapFree(GetProcessHeap(), 0, lpentry); return 0; } // Create and set the new entry's properties dwRet = RasSetEntryProperties(NULL, lpszEntry, lpentry, lpentry->dwSize, NULL, 0); if (dwRet != ERROR_SUCCESS){ wprintf(L"RasSetEntryProperties failed: Error = %d\n", dwRet); HeapFree(GetProcessHeap(), 0, lpentry); return 0; } // Clean up: delete the new entry dwRet = RasDeleteEntry(NULL, lpszEntry); if (dwRet != ERROR_SUCCESS){ wprintf(L"RasDeleteEntry failed: Error = %d\n", dwRet); } HeapFree(GetProcessHeap(), 0, lpentry); return 0;}
系统支持
0 0
- RasDeleteEntry
- mongodb数据库备份、还原、导出表、导入表
- OC中的Foundation框架结构图
- leetcode 3 Longest Substring Without Repeating Characters
- HDU-5806-NanoApeLovesSequenceⅡ(尺取法)
- HIHO #1185 : 连通性·三
- RasDeleteEntry
- 语料库
- spring框架学习(三)junit单元测试
- pthread_create()创建线程最大个数
- 来自iSpy整理的最全海康大华IPC的RTSP连接地址
- Android很好用的确认对话框(DialogFragment)
- wordpress建站如何使用七牛cdn
- CSU 1785 NBUT 1647 又一道简单题
- POJ 3255 Roadblocks(次短路)