[API]
LocalAlloc
RtlMoveMemory
DialogBoxIndirectParamA
DialogBoxIndirectParamW
LocalFree

[CODE]
Public Function LoadResEx_DialogEx(ByVal hWndOwner As Long, ByVal DialogData As string, Optional DefaultButtonID As Long = 0&, Optional ByVal CanEscapeControlID As Long = LoadResEx_Dialog_Disabled, Optional ByVal CallBackProc As Long) As Long
  Dim xLong1 As Long
  Dim xType1 As LoadResEx_Dialog_DialogInfo
  Dim hModule As Long

  xType1.xCallBackProc = CallBackProc
  xType1.xEscBehaviour = CanEscapeControlID
  xType1.xButtonCtlID = DefaultButtonID
  xLong1 = LocalAlloc(0&, LoadResEx_Dialog_DialogInfoSize)
  If Not xLong1 = 0& Then
    #If InIDE And Not CustomClassesInDialogs And LoadResEx_SetThemeFile Then
      hModule = LoadResEx_ThemeFile_hModule
      If hModule = 0& Then hModule = App.hInstance
      #ElseIf InIDE And Not CustomClassesInDialogs And LoadResEx_SetLanguageFile Then
      hModule = LoadResEx_LanguageFile_hModule
      If hModule = 0& Then hModule = App.hInstance
      #Else
      hModule = App.hInstance
      #End If

    Call RtlMoveMemory(ByVal xLong1, xType1, LoadResEx_Dialog_DialogInfoSize)
    If IsUnicode Then
      LoadResEx_DialogEx = DialogBoxIndirectParamW(hModule, DialogData, hWndOwner, AddressOf LoadResEx_Dialog_InternalProc, xLong1)
      Else
      LoadResEx_DialogEx = DialogBoxIndirectParamA(hModule, DialogData, hWndOwner, AddressOf LoadResEx_Dialog_InternalProc, xLong1)
      End If
    Call LocalFree(xLong1)
    End If
  End Function