api在c语言中的使用,怎样在C语言中调用API函数?

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

/*@@ Wedit generated application. Written Tue Apr 27 20:12:00 2004

@@header: d:\lcc\projects\hello\hellores.h

@@resources: d:\lcc\projects\hello\hello.rc

Do not edit outside the indicated areas */

/**/

/**/

#include 

#include 

#include 

#include 

#include "hellores.h"

/* --- The following code comes from C:\lcc\lib\wizard\dlgbased.tpl. */

/**/

/*

Template for a dialog based application. The main procedure for this

template is the DialogFunc below. Modify it to suit your needs.

*/

/* prototype for the dialog box function. */

static BOOL CALLBACK DialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);

/*

Win main just registers a class of the same type that the dialog class, and

then calls DialogBox. Then it exits. The return value is the return value of

the dialog procedure.

*/

int APIENTRY WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, int nCmdShow)

{

WNDCLASS wc;

INITCOMMONCONTROLSEX cc;

memset(&wc,0,sizeof(wc));

wc.lpfnWndProc = DefDlgProc;

wc.cbWndExtra = DLGWINDOWEXTRA;

wc.hInstance = hinst;

wc.hCursor = LoadCursor(NULL, IDC_ARROW);

wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);

wc.lpszClassName = "hello";

RegisterClass(&wc);

memset(&cc,0,sizeof(cc));

cc.dwSize = sizeof(cc);

cc.dwICC = 0xffffffff;

InitCommonControlsEx(&cc);

return DialogBox(hinst, MAKEINTRESOURCE(IDD_MAINDIALOG), NULL, (DLGPROC) DialogFunc);

}

/*

You should add your initialization code here. This function will be called

when the dialog box receives the WM_INITDIALOG message.

*/

static int InitializeApp(HWND hDlg,WPARAM wParam, LPARAM lParam)

{

return 1;

}

/*

This is the main function for the dialog. It handles all messages. Do what your

application needs to do here.

*/

static BOOL CALLBACK DialogFunc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)

{

switch (msg) {

/* This message means the dialog is started but not yet visible.

Do All initializations here

*/

case WM_INITDIALOG:

InitializeApp(hwndDlg,wParam,lParam);

return TRUE;

/* By default, IDOK means close this dialog returning 1, IDCANCEL means

close this dialog returning zero

*/

case WM_COMMAND:

switch (LOWORD(wParam)) {

case IDOK:

EndDialog(hwndDlg,1);

return 1;

case IDCANCEL:

EndDialog(hwndDlg,0);

return 1;

}

break;

/* By default, WM_CLOSE is equivalent to CANCEL */

case WM_CLOSE:

EndDialog(hwndDlg,0);

return TRUE;

}

return FALSE;

}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值