test.cpp
来自「短信开发控件」· C++ 代码 · 共 57 行
CPP
57 行
// test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
int main(int argc, char* argv[])
{
//调入DLL
HINSTANCE hLib = LoadLibrary("kkstar_sms.dll");
char* Result=NULL;
//定义 GetGatewayList()
typedef char* (__stdcall *DLLFunction_1)();
//取得 GetGatewayList() 入口地址
DLLFunction_1 GetGatewayList = (DLLFunction_1)GetProcAddress(hLib,"GetGatewayList");
//调用 GetGayewayList()
Result = GetGatewayList();
//显示网关列表
printf("网关列表:\n");
printf("------------------------------------------------\n");
printf("%s",Result);
printf("------------------------------------------------\n");
//定义 SendSms()
typedef char* (__stdcall *DLLFunction_2)(
char* lpGateway,
char* lpUserName,
char* lpPassword,
char* lpPhone,
char* lpContent,
char* lpNickName,
char* lpExtent );
//取得 SendSms() 入口地址
DLLFunction_2 SendSms = (DLLFunction_2)GetProcAddress(hLib,"SendSms");
//调用 SendSms()
Result = SendSms(
"sina.com", //或者其他网关代号
"我的登录账号",
"我的登录密码",
"13987xxxxxx",
"你好吗?记得过来玩呀!",
"我的昵称",
"" );
//显示发送结果
printf("发送结果:%s\n",Result);
printf("------------------------------------------------\n");
//释放DLL
Result=NULL;
FreeLibrary(hLib);
printf("Press Ctrl+C to return ...\n");
char* str;
scanf("%s",str);
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?