在win32程序中不需要hPrevInstance的原因:
在早期的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来判断一个程序的另一个实例是否存在,要用其他的方法来判断。