Phobic
Nov 10th, 1999, 02:35 AM
I'll ask one more time, I've been experimenting with the SetWindowLong API, and I've been able to make it work quite well with my own project's forms, however I've had no success in making it work on other windows...
Here's my code...Private Declare Function SetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Private Const SWP_SHOWWINDOW = &H40
Private Const GWL_STYLE = (-16)
Private Const WS_BORDER = &H800000
'--------------------------------------------
Dim XX As Long
XX = GetWindowLong(FindWindow(vbNullString, "Untitled - Notepad"), GWL_STYLE) 'Get Notepad's current window style...
XX = XX Or WS_BORDER 'Modify it to include the BORDER windowstyle (no size)...
BSuccess = SetWindowLongA(FindWindow(vbNullString, "Untitled - Notepad"), GWL_STYLE, XX) 'Set the new windowstyle... !THIS PART DOESN'T WORK!
Call SetWindowPos(FindWindow(vbNullString, "Untitled - Notepad"), 0, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_SHOWWINDOW Or SWP_FRAMECHANGED Or SWP_NOZORDER) 'Refresh the window to display the new style...
MsgBox BSuccess 'Display success of applying windowstyle !RETURNS 0, MEANING NOPE!As I said, it works with my project's forms beautifully, but not on other windows. Can someone gimme a little enlightenment?
[This message has been edited by Phobic (edited 11-10-1999).]
Here's my code...Private Declare Function SetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_FRAMECHANGED = &H20
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4
Private Const SWP_SHOWWINDOW = &H40
Private Const GWL_STYLE = (-16)
Private Const WS_BORDER = &H800000
'--------------------------------------------
Dim XX As Long
XX = GetWindowLong(FindWindow(vbNullString, "Untitled - Notepad"), GWL_STYLE) 'Get Notepad's current window style...
XX = XX Or WS_BORDER 'Modify it to include the BORDER windowstyle (no size)...
BSuccess = SetWindowLongA(FindWindow(vbNullString, "Untitled - Notepad"), GWL_STYLE, XX) 'Set the new windowstyle... !THIS PART DOESN'T WORK!
Call SetWindowPos(FindWindow(vbNullString, "Untitled - Notepad"), 0, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_SHOWWINDOW Or SWP_FRAMECHANGED Or SWP_NOZORDER) 'Refresh the window to display the new style...
MsgBox BSuccess 'Display success of applying windowstyle !RETURNS 0, MEANING NOPE!As I said, it works with my project's forms beautifully, but not on other windows. Can someone gimme a little enlightenment?
[This message has been edited by Phobic (edited 11-10-1999).]