OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-03-2006, 11:14
akayani
Guest
 
Posts: n/a
Default Frameless forms

Any advice on creating forms that display without frame X button etc.

If you can imagine to create long skinny toolbar like forms.

Yani
Reply With Quote
  #2  
Old 10-03-2006, 14:42
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

As far as I know there is no way to do this in VBA. If you wanted to you could probably do it in VB.NET, but you would have to use XML to get the "transparency" effect. Most programs that ahve the look and feel you are talking about, do it this way.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #3  
Old 13-03-2006, 12:27
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default Here's a way to do it...

I use this in VB, but found it works in VBA fine. Each Time you call the sub it will toggle it back and forth between style. You could easily modify this to work with all your forms, by possibly passing the form caption to the sub. Don't know VBA that much, so there may be an easier way to get the forms hWnd.

Code:
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) 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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Type RECT
    left As Long
    Top As Long
    right As Long
    bottom As Long
End Type
    'the extra consts are in case anyone wants
    '     to add onto this, and because i am too
    '     lazy to edit them out:)
    Private Const GWL_EXSTYLE = (-20)
    Private Const GWL_STYLE = (-16)
    Private Const SWP_NOMOVE = &H2
    Private Const WS_BORDER = &H800000
    Private Const WS_CAPTION = &HC00000
    Private Const WS_CHILD = &H40000000
    Private Const WS_CLIPCHILDREN = &H2000000
    Private Const WS_CLIPSIBLINGS = &H4000000
    Private Const WS_DISABLED = &H8000000
    Private Const WS_DLGFRAME = &H400000
    Private Const WS_EX_ACCEPTFILES = &H10&
    Private Const WS_EX_DLGMODALFRAME = &H1&
    Private Const WS_EX_NOPARENTNOTIFY = &H4&
    Private Const WS_EX_TOPMOST = &H8&
    Private Const WS_EX_TRANSPARENT = &H20&
    Private Const WS_EX_WINDOWEDGE = &H100
    Private Const WS_GROUP = &H20000
    Private Const WS_HSCROLL = &H100000
    Private Const WS_MAXIMIZE = &H1000000
    Private Const WS_MAXIMIZEBOX = &H10000
    Private Const WS_MINIMIZE = &H20000000
    Private Const WS_MINIMIZEBOX = &H20000
    Private Const WS_OVERLAPPED = &H0&
    Private Const WS_POPUP = &H80000000
    Private Const WS_SYSMENU = &H80000
    Private Const WS_TABSTOP = &H10000
    Private Const WS_THICKFRAME = &H40000
    Private Const WS_TILED = WS_OVERLAPPED
    Private Const WS_VISIBLE = &H10000000
    Private Const WS_VSCROLL = &H200000
    Private Const WS_CHILDWINDOW = (WS_CHILD)
    Private Const WS_ICONIC = WS_MINIMIZE
    Private Const WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX)
    Private Const WS_POPUPWINDOW = (WS_POPUP Or WS_BORDER Or WS_SYSMENU)
    Private Const WS_SIZEBOX = WS_THICKFRAME
    Private Const WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
    Private Const DS_ABSALIGN = &H1&
    Private Const DS_LOCALEDIT = &H20
    Private Const DS_MODALFRAME = &H80
    Private Const DS_NOIDLEMSG = &H100
    Private Const DS_SETFONT = &H40
    Private Const DS_SETFOREGROUND = &H200
    Private Const DS_SYSMODAL = &H2&

Public Sub ChangeBorderStyle()

    Dim WindowHandle As Long
    Dim R As RECT
    Const BLess14 = WS_CAPTION
    Const BLess3 = &HC80080
    Const BLess3_EX = &H101
    Const BLessE = WS_THICKFRAME Or WS_CAPTION

'Replace My Form Caption with Your Forms Caption
    
    WindowHandle = FindWindow(vbNullString, "My Form Caption")

    If WindowHandle > 0 Then

        SetWindowLong WindowHandle, GWL_STYLE, GetWindowLong(WindowHandle, GWL_STYLE) Xor BLess14
        GetWindowRect WindowHandle, R
        SetWindowPos WindowHandle, 0, R.left, R.Top, R.right - R.left + 1, R.bottom - R.Top, SWP_NOMOVE
        SetWindowPos WindowHandle, 0, R.left, R.Top, R.right - R.left, R.bottom - R.Top, SWP_NOMOVE

    End If

End Sub
SteveDude

Last edited by SteveDude; 13-03-2006 at 12:33.
Reply With Quote
  #4  
Old 13-03-2006, 18:47
akayani
Guest
 
Posts: n/a
Default

WOW...

Thanks I'll have a "play" with that.

Yani
Reply With Quote
  #5  
Old 14-03-2006, 06:41
Macronix
Guest
 
Posts: n/a
Lightbulb

But is small nuance: at change of property Form.Caption, style of a window is dumped.
And for greater probability of definition of the necessary window it is better to do so:
Code:
WindowHandle = FindWindow("ThunderDFrame", Me.Caption)
Reply With Quote
  #6  
Old 14-03-2006, 08:25
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

When you get done with your macro, would you mind posting the GMS. I would love to see this in action and see if it is something I could use.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #7  
Old 14-03-2006, 08:27
SteveDude SteveDude is offline
Senior Member
 
Join Date: Dec 2005
Location: Salina, Kansas USA
Posts: 149
Default That works...

The basic idea is to have it in a module and call it from a form. You could change the sub to ChangeBorderStyle(Me.Caption) and use it for all forms in a project.

Once you have the Windows Handle you can do all kinds of things with it, via the Windows API including changing transparency, adding buttons to the Titlebar and even creating dockers. VB 6 froms have an hWnd property so it is much easier.

SteveDude
Reply With Quote
  #8  
Old 14-03-2006, 08:44
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Quote:
and even creating dockers
Now your speaking my language... I would love to be able to create dockers for draw, do you know something I don't (that answer is highly likely a YES) LOL.

If you do know how, I would really like to learn.

BTW, a message for Alex. Is it possible to add a Spell Check function to the forums posting area? I find myself in a hurry sometimes and don't always catch spelling errors.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #9  
Old 14-03-2006, 14:11
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default

Quote:
Originally Posted by ddonnahoe
BTW, a message for Alex. Is it possible to add a Spell Check function to the forums posting area? I find myself in a hurry sometimes and don't always catch spelling errors.
Nah, who cares about spelling error as long as VBA code posted here actually works
Reply With Quote
  #10  
Old 14-03-2006, 16:04
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,782
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Dockers

I agree with Sean, We would love to see a working example of a docker Steve, or what is possible with the code. THANKS,

Shelby
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding controls to forms at runtime ddonnahoe CorelDRAW/Corel DESIGNER VBA 15 20-12-2005 13:59
Dockable Forms? Jon Lorber CorelDRAW/Corel DESIGNER VBA 3 16-02-2005 14:51


All times are GMT -5. The time now is 01:24.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com