Page 2 of 2

Re: DLL plug-in inheriting ugly no-themed flat, squared GUI

Posted: Mon Apr 20, 2015 3:17 pm
by Thunder93
I can reproduce simply by making DLL that has function to open Window with different controls to test. When making DLL, set in PB Compiler Options 'Enable modern theme support (for Windows XP and above)'

Then create main executable to call that function. This time making the executable with 'Enable modern theme support (for Windows XP and above)' feature in PB Compiler options unchecked.

Re: DLL plug-in inheriting ugly no-themed flat, squared GUI

Posted: Mon Apr 20, 2015 8:19 pm
by Thunder93
Example used;

MainExec.pb

Code: Select all

If OpenLibrary(0, "DLL.dll")
  
  *DLLWin = GetFunction(0, "Win")
  If *DLLWin
    CallFunctionFast(*DLLWin)
  EndIf
  
  CloseLibrary(0)
EndIf
; IDE Options = PureBasic 5.31 (Windows - x64)
; Executable = MainExec.exe
; EnablePurifier

DLL.pbi

Code: Select all

ProcedureDLL Win()
;   Protected dt.INITCOMMONCONTROLSEX  
;   dt.INITCOMMONCONTROLSEX\dwSize = SizeOf(INITCOMMONCONTROLSEX) 
;   dt\dwICC = #ICC_STANDARD_CLASSES  
;   IsComCon.b = InitCommonControlsEx_(@dt) 
  
  WinHandle = OpenWindow(0, 0, 0, 300, 420, "Window from DLL", #PB_Window_SystemMenu| #PB_Window_ScreenCentered |#PB_Window_SizeGadget)
  If WinHandle
   
    CalendarGadget(1, 10, 15, 280, 210)

    ButtonGadget(2,35, 338,80, 25,"Test 1")    
    ButtonGadget(3,35, 370,80, 25,"Test 2")

    StringGadget(4, 35, 260,200,25, "TEST 3")
    TextGadget(5, 35, 230,200,25,"IsComCon: "+Str(IsComCon))
       
    Repeat : Event = WaitWindowEvent() : Until Event = #PB_Event_CloseWindow
  EndIf
EndProcedure

; Win()

; IDE Options = PureBasic 5.31 (Windows - x64)
; ExecutableFormat = Shared Dll
; CursorPosition = 3
; Folding = -
; EnableXP
; Executable = DLL.dll
; EnablePurifier
; AddResource = DLL.rc

Re: DLL plug-in inheriting ugly no-themed flat, squared GUI

Posted: Sat May 02, 2015 4:55 pm
by PyroStrex
With the example you had given, I can simply inject 24:1:1033 resource to the main application to enable the xp style. But based on what you asked for, since the application are digitally signed and can't be injected with anything, your way of doing it might be the only way to make it works (SetWindowTheme) or use the app.manifest way (but this is also a no-go for you).