03 WIndows编程——手绘函数调用过程

源码

 1 #include<Windows.h>
 2 #include<stdio.h>
 3 
 4 int MessageBoxPrint(char *szFormat, ...);
 5 
 6 int WinMain(HINSTANCE hInst, HINSTANCE tmp, LPSTR strCmd, int nShow)
 7 {
 8     char str[1024];
 9     MessageBoxPrint("%p", hInst);
10     return 0;
11 }
12 
13 int MessageBoxPrint(char *szFormat, ...)
14 {
15     char buf[1024];
16     va_list va;
17     va_start(va, szFormat);
18     vsnprintf(buf, sizeof(buf), szFormat, va);
19     va_end(va);
20     return MessageBox(NULL,buf,"printf",MB_OK);
21 }
View Code

一个程序运行起来以后成为一个进程,一个进程里面可以有很多线程。每个线程都有自己的调用栈。线程与栈一一对应。

原文地址:https://www.cnblogs.com/kelamoyujuzhen/p/9298405.html