我不得不更新一些字符串,因爲多年來一些事情發生了變化,但現在它不會編譯。這最初是在VS2010中完成的。它在C.的Win32 API進行編碼現在我使用2012丟給這些錯誤:「HANDLE」與參數類型「HINSTANCE」不兼容
1 IntelliSense: argument of type "HANDLE" is incompatible with parameter of type "HINSTANCE"
2 IntelliSense: argument of type "LRESULT (__stdcall *)(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)" is incompatible with parameter of type "DLGPROC"
,這是編輯的程序:
// NSIS stack structure
typedef struct _stack_t
{
struct _stack_t *next;
char text[256];
} stack_t;
stack_t **g_stacktop;
// Function prototypes
char *getvar(int varnum);
void setvar(int varnum, char *var);
int runDialogBox();
HBITMAP LoadPicture(UINT nID);
BOOL DrawPicture(HDC hDC, LPRECT lpRect);
// Global variables
char szBuf[256]="";
char szError[4]="";
int nVarError;
int res = 0;
HINSTANCE g_hInstance;
HWND g_hwndParent;
int g_stringsize;
char *g_variables;
BOOL APIENTRY DllMain(HANDLE hModulePar,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
LRESULT CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
static HBRUSH hBrushStatic;
void __declspec(dllexport) Show(HWND hwndParent, int string_size, char *variables, stack_t **stacktop)
{
g_hwndParent=hwndParent;
g_stringsize=string_size;
g_variables=variables;
res = runDialogBox();
if (res == 0)
setvar(INST_1,"NO");
else
setvar(INST_1,"YES");
}
int runDialogBox()
{
int result = FALSE;
result = DialogBoxParam(hModule, MAKEINTRESOURCE(IDD_DIALOG), NULL, DialogProc, (LPARAM) (NULL));
return result;
}
它是一個NSIS插件,編碼爲Win32 C dll。我想我可以把它全部拿出來切換到MFC?簡而言之,它只是顯示一個複雜的對話框(比本機消息框能夠處理更復雜),然後在那裏處理它。 – 2014-10-20 13:49:07
如果您告訴我們哪條線路有錯誤,它可以節省大家很多時間。此外,如果您刪除了與問題無關的所有代碼行。 – 2014-10-20 14:14:45
@RaymondChen:最初代碼太少。 – 2014-10-20 14:34:14