EDN Admin
Well-known member
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal Good afternoon!<br style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal
<br style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal Im trying to create a dialog box from a DLL. The window is created and everything works fine under Windows 7 (see Windows 7.jpg) <img alt="Windows 7.jpg" src="http://social.msdn.microsoft.com/Forums/getfile/155907
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal , but under Windows XP (see Windows XP.jpg)
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal <img alt="Windows XP.jpg" src="http://social.msdn.microsoft.com/Forums/getfile/155909
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal dialog is not active and all controls as it shifted down.
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal
<pre class="prettyprint" style=" // Dialog.cpp
#include "stdafx.h"
#include "resource.h"
#include <strsafe.h>
HINSTANCE hInst;
BOOL CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void SD_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
void SD_OnClose(HWND hwnd);
MY_DIALOGS_API int DialogShow()
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, MainDlgProc);
return 0;
}
BOOL CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_COMMAND:
SD_OnCommand(hwnd, (int)(LOWORD(wParam)), (HWND)(lParam), (UINT)HIWORD(wParam));
break;
case WM_CLOSE:
SD_OnClose(hwnd);
break;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
void SD_OnCommand(HWND hwnd, int id, HWND /*hwndCtl*/, UINT /*codeNotify*/)
{
switch(id)
{
case IDOK:
case IDCANCEL:
SendMessage(hwnd, WM_CLOSE, 0, 0);
break;
}
}
void SD_OnClose(HWND hwnd)
{
// DestroyWindow(hwnd);
EndDialog(hwnd, 0);
}
/////////////////////////////////////////////////////
// Dialog.h
#ifdef MY_DIALOGS_EXPORTS
#define MY_DIALOGS_API __declspec(dllexport)
#else
#define MY_DIALOGS_API __declspec(dllimport)
#endif
MY_DIALOGS_API int DialogShow();
extern HINSTANCE hInst;
/////////////////////////////////////////////////////
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
hInst = hModule;
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
/////////////////////////////////////////////////////
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#include "InstallerDialogs.h"
/////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// InstallerDialogs.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
/////////////////////////////////////////////////////
// targetver.h
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>
/////////////////////////////////////////////////////
// resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by InstallerDialogs.rc
//
#define IDD_DIALOG1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
/////////////////////////////////////////////////////
// Dialogs.rc
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Russian (Russia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h "
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""rn"
"
<br style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal Im trying to create a dialog box from a DLL. The window is created and everything works fine under Windows 7 (see Windows 7.jpg) <img alt="Windows 7.jpg" src="http://social.msdn.microsoft.com/Forums/getfile/155907
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal , but under Windows XP (see Windows XP.jpg)
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal <img alt="Windows XP.jpg" src="http://social.msdn.microsoft.com/Forums/getfile/155909
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal dialog is not active and all controls as it shifted down.
<span style="font-family:verdana,arial,helvetica,sans-serif; line-height:normal
<pre class="prettyprint" style=" // Dialog.cpp
#include "stdafx.h"
#include "resource.h"
#include <strsafe.h>
HINSTANCE hInst;
BOOL CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void SD_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
void SD_OnClose(HWND hwnd);
MY_DIALOGS_API int DialogShow()
{
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, MainDlgProc);
return 0;
}
BOOL CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_COMMAND:
SD_OnCommand(hwnd, (int)(LOWORD(wParam)), (HWND)(lParam), (UINT)HIWORD(wParam));
break;
case WM_CLOSE:
SD_OnClose(hwnd);
break;
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
void SD_OnCommand(HWND hwnd, int id, HWND /*hwndCtl*/, UINT /*codeNotify*/)
{
switch(id)
{
case IDOK:
case IDCANCEL:
SendMessage(hwnd, WM_CLOSE, 0, 0);
break;
}
}
void SD_OnClose(HWND hwnd)
{
// DestroyWindow(hwnd);
EndDialog(hwnd, 0);
}
/////////////////////////////////////////////////////
// Dialog.h
#ifdef MY_DIALOGS_EXPORTS
#define MY_DIALOGS_API __declspec(dllexport)
#else
#define MY_DIALOGS_API __declspec(dllimport)
#endif
MY_DIALOGS_API int DialogShow();
extern HINSTANCE hInst;
/////////////////////////////////////////////////////
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
hInst = hModule;
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
/////////////////////////////////////////////////////
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
#include "InstallerDialogs.h"
/////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// InstallerDialogs.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
/////////////////////////////////////////////////////
// targetver.h
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>
/////////////////////////////////////////////////////
// resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by InstallerDialogs.rc
//
#define IDD_DIALOG1 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
/////////////////////////////////////////////////////
// Dialogs.rc
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Russian (Russia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h "
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""rn"
"