
CTL3DV2.DLL causes STACK Fault
Quote:
> Hi All!
> I got a stumper for you. I am trying to use CTL3DV2.DLL in a VB
> app. I initialize the DLL with no problem and I get my nifty
> 3d Message boxes! My app then shells out to another app which
> uses CTL3DV2.DLL. Like clockwork, I get a Stack Fault in
> USER.EXE which then GPFs (under 16-bit Windows 3.11). I am
> blaming CTL3DV2.DLL because I switched to CTL3D.DLL everything
> worked! This situation doesn't even crop up under NT! Does
> anyone have any ideas, as I am really stumped!
> Any help is appreciated!
> Joe Hayes
Try this code:
'************************************************************************************
' The following Declare statements are used to display Common Dialog in 3d.
' Please move these statements to the Declaration section of a .BAS module.
Declare Function GetWindowWord Lib "User" (ByVal hWnd As Integer, ByVal nIndex As Integer)
As Integer
Declare Function Ctl3DAutoSubclass Lib"Ctl3Dv2.DLL" (ByVal hInst As Integer) As Integer
Declare Function Ctl3DRegister Lib"Ctl3Dv2.DLL"(ByVal hInst As Integer) As Integer
Declare Function Ctl3DUnregister Lib "Ctl3Dv2.DLL" (ByVal hInst As Integer) As Integer
'************************************************************************************
' used with GetWindowWord
Const GWW_HINSTANCE = (-6)
'This variable will be used to store the instance of the application
Dim hInst as Integer
'This variable will be used as the return value for the Ctl3d functions
Dim iRc as Integer
' This variable will contain the sum of the options
Dim iOptions as Integer
iOptions = MB_DEFBUTTON1+ MB_APPLMODAL+ MB_ICONSTOP+ MB_OK
' Get the instance of your App
hInst = GetWindowWord(Me.hWnd, GWW_HINSTANCE)
' These statements turn on the 3D effects if there was a valid instance
If hInst <> 0 Then
iRc = Ctl3DRegister(hInst)
iRc = Ctl3DAutoSubclass(hInst)
EndIf
MSGBOX "test", iOptions, "test"
' This statement turns off the 3D effects
If hInst <> 0 Then
iRc = Ctl3DUnregister(hInst)
EndIf