关于Win32的winMain函数的hPrevInstance参数

来源:互联网 发布:网络解码矩阵 编辑:程序博客网 时间:2024/05/16 11:10

任何一个基于GDI的Windows程序以WinMain函数作为入口被系统调用。在Win16中,hPrevInstance指向前一个实例的句柄,但在Win32中,每一个进程都有一个独立的4G地址空间,从0到2G属于进程私有,对其他进程来说是不可见的。所以,在Win32中,hPrevInstance总是为NULL。

int WINAPI WinMain(

  HINSTANCE hInstance, // handle to current instance

  HINSTANCE hPrevInstance, // handle to previous instance

  LPSTR lpCmdLine, // pointer to command line

  int nCmdShow // show state of window

  );

  
  因而,在Win32下不能通过判断hPrevInstance是否为NULL来判断一个程序的另一个实例是否存在,要用其他的方法来判断。


原创粉丝点击