I have 3 Question regarding my simple code below!


#include "afx.h"
#include "afxwin.h"
#include "resource.h"

int
CALLBACK
PasswordDlgProc(
HWND hDlg,
UINT Message,
WPARAM wParam,
LPARAM lParam)
{
.........

}

void main()
{
HINSTANCE hMainInstance = AfxGetInstanceHandle();
DialogBoxParam(hMainInstance, (LPTSTR) MAKEINTRESOURCE(IDD_PASSWORD_DIALOG),
NULL,
(DLGPROC)PasswordDlgProc,
0);
}




Q1. Why i need to change the program setting to "Using MFC as a shared Lib" in order to successfully
do the program linking?

Q2. Why is there an assertion error at AfxGetInstanceHandle?

Q3. What should i do now in order to display my Password dialog Box???? How to get the application Instance??