Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Resize Webbrowser Control To Size Of Web Page?

Is there any way the webbrowser control can be resized to the web page so there are no scroll bars?

What I am trying to do it resize the webbrowser control to the size of the web page and the webbrowser control is in a picturebox control. Then I am going to use some code I found that captures and saved the picturebox and the contents to an image file. This way I have the whole web page saved as an image.

Any suggestions?


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Can I Resize Webbrowser To Size Of Web Page?
I doubt this can be done but it never hurts to ask!

Is there any way the webbrowser control can be resized to the web page so there are no scroll bars?

What i am trying to do it resize the webbrowser control to the size of the web page and the webbrowser control is in a picturebox control. Then I am going to use some code I found that captures and saved the picturebox and the contents to an image file. This way I have the whole web page saved as an image.

Any suggestions?


WebBrowser Control, Page Size To Fit
I want to use a WebBrowser control to display a website in a program. The Website is a standard 800X600 which requires making both the form and control very large. I would like to size the control much smaller but want the full page to show in the control without the use of scrollbars.

I have seen some posts from years ago of someone looking to do this same thing but never found a resolution to this problem.

Any ideas?


Resize Web Page To Browser Size

i have a webbrowser1 control on my form. i use this to .navigate to an url.

my problem is that i want the resulting web page to fit to the size of the webbrowser1 control (i.e. shrink to fit)

from this, i may want the form resizable, and the browser dimensions to change with it, but the web page inside of this to remain the size of the browser...

i cannot find a control, method, property, etc, to do this - any help would be appreciated.



WebBrowser Control Disable Resize
I use a WebBrowser control in several of my apps and have a very anoying problem.

When a user goes to some sites using the WebBrowser control the site resizes the control and ruins the form the webbrowser is on. The webbrowser control max's to the form size...

I have been searching for weeks trying to find a way to prevent pages from resizing the webbrowser control and still can't find a way to do it short of telling the user to disable javascript before using the program.

Does anyone know of a way to either prevent resizing of the webbrowser control or a way to capture something and know when the webbrowser control is resized so I can set it back to it's old size?

Hmmmmmm. I really hope that all made some sense.


How To Stop WebBrowser Control To Resize Itself
Hi !

I have a lil program that has a webbrowser and sometimes I surf to webpages that have the script to resize my browser window to be full screen or reduced, so it makes my webbrowser the size of my form....arg!! how can i disable this autoresize so that when it tries to resize my webbrowser, it will either not do anything or go back to teh original size??

Here is an example of a site that resize the WebBrowser control:


How To Resize HTML Contents Using Webbrowser Control?

I have limited knowlege of web apps so forgive me.

I have a VB6 app that uses a webbrowser control to open a website. The web site has a subsequent popup window that contains a datagrid. I assume this is the html document in the web browser.

When using Internet explorer the user can resize the datagrid window. In doing so the datagrid within the window will resize accordingly to take up the entire area on the window.

I have two problems:

1) In my VB6 app I capture the datagrid window using the newWindow2 event(the new window is sent to a webbrowser control on a seperate form) I need to initialize this new form to the same size of the datagrid within the html document of the webbrowser control. How do I do this?

2) When I resize my new form I want the datagrid within the html document of the webbrowser control to resize accordingly. How do I do this?

Any help would be greatly appreciated.


How To Stop Auto Resize In Webbrowser Control
i have a lil program that has a webbrowser and soemtimes i surf to webpages that have the script to resize my browser window to be full screen, so it makes my webbrowser the size of my form....arg!! how can i disable this autoresize so that when it tries to resize my webbrowser, it will either not do anything or go back to teh original size??

How To Resize The Activex Control To The Parent Window Size
Hi All,

I am a begginer in VB. I have created an activex control (ocx). The size of the displayed area is fixed now. I want to change this to the parent window size. The parent window can be another vb application or other microsoft product like vc or browser itself. I have to resize the control to display it as 2/3 of the application (in the right side) that uses it. Only the width is 2/3 the height will be 100%. The remaining part the application can show up any thing.

Thanks in advance for your sugg. and ideas

Viewing A Web Page Without The MS Webbrowser Control

I have read a few things about parsing html and then being able to view the page in your own control (much like the MS Web Browser). Which control could I use to view the html page if I parse the source myself?

If anyone has a link(s) to how I could learn more about doing this, could you please post it?



Getting The Title Of The Page In A Webbrowser Control
What is the code to get the title of a web page in a webbrowser control?

Page Setup For The WebBrowser Control - Help!
I am building an application for work which generates a client's reports in HTML format.
I have figured out how to print the contents of a WebBrowser control, but it prints the default header and footer, including the address (in this case the name of the temporary file where the HTML code is stored). I found the command for Page Setup, but this just pops up the Page Setup window.

Is there a way to customize the Page Setup header/footer programmatically before printing from the WebBrowser control?

P.S. A prompt response would be appreciated, as this was supposed to go out last Friday!

How To Get All The Links Of A Web Page Without Using Webbrowser Control
I want to get all the links of a webpage without using webbrowser control. Is there any way doing that? Please help...

Page Orientation In Webbrowser Control
Hi everyone,

I'm printing from a webbrowser control and it works just fine, but what I'm looking to do is set the printer orientation automatically to landscape, is there any way to do this??

If anyone can help, I would appreciate greatly! This seems to be something that a fair amount of people want to do, but haven't gotten an answer to. I'm hoping the same won't happen to me.

WebBrowser Control And Page Access?
Using the WebBrowser control, is there a way I can only permit a webpage to show up if it's through the control in my project? Is there something I can setup with the WB control and then detect in my page?

WebBrowser Control - Page Not Found
Can you change that to something else, like a error message made by me? (without effecting IE little error message...)

Thanks in advance.

WebBrowser Control Loads A Page
I am playing around with the WebBrowser control (Microsoft Internet Controls - shdocvw.dll) and have one tiny question:

How do i know when a page/URL has loaded properly? If the page can not be found or the internet connection can be be established, how do i know if the .Navigate2 command has failed?

I searched the forums, but was unable to locate anything about this.

WebBrowser Control To Parse A Web Page
I know how to display an url using the webBrowser control but, how could i display only the content of a div avoiding or hiding ads and the rest of that page

Send JPG To ASP Page Thru The WebBrowser Control
This may be more suited for ASP Forum, I'm not sure though.  Here's what I'm trying to accomplish.  I have a Web Browser Control in a form that displays and accesses an asp page.  The asp page has an <input type ="file" and ENCTYPE="multipart/form-data" and uses an aspSmartUpload object to store an image in a database using ado.  What I would like to do is programmatically from vb, send the file without the user having to browse, select and submit.  I wouldn't mind even doing away with the aspSmartUpload Control to do this???  I would connect directly to the SQL DB but the vb program does not have access but the asp pages do.  Anyone know how to do this?  

Getting Source Of Page In WebBrowser Control

I want to display a website in my program, and also get the source to that page. However, I am only able to download that page once (as it's dynamic content, and will change if I display it, then use an Inet control to get the source). Once I'm done testing and debugging, I won't need to display the page any more, but for now, I definitely need to display it and grab the source, all in just one download of the page.

Any help is appreciated.


WebBrowser Control - Problems With Window Size
In a project to remotely control a digital video recorder (DVR), I'd like to use the webbrowser control to display the web page contained in the DVR. This page is used to navigate through different DVR menus and displays.

After calling WebBrowser1.Navigate "", the DVR page always covers the entire form, despite having specified the exact size of the webbrowser display. Is there a way to assure that the web page opens within the design-time boundaries of the control (with horizontal and vertical sliders, if required)?

I checked random pages off the internet and they all open within the design-time width and height. Obviously, there is something different about the DVR page Iím trying to display.

Printing An HTML Page From A Webbrowser Control
I'm creating reports for my program, and the way I do it now looks crappy. It works, but I could generate HTML reports and have more flexability. Then I could preview this in a webbrowser and print it off. But how would I do that? (Print...not generate the HTML)

WebBrowser Control - Get Page Source Problem

i use the following code to view the page's html source.
but it returns only the word [object] in a single line.

Private Sub cmdSoruce_Click()
Form2.txtsource = WebBrowser1.document.All
End Sub

How To Wait Until A Web Page Is Loaded With Webbrowser Control...
Ok... So I'm writing a program that will read data from a webpage's html source.

Using the webbrowser control, I have the program navigate to a page, and then download it's source to parse it.

I need to find a good way to tell when the web page is completely loaded.

Is it possible to make a subroutine that I can call it to basically stall the program until the web page is loaded?

Right now I'm using some crappy code:

While frmMain.web.ReadyState <> READYSTATE_COMPLETE

Someone please help me get this fixed!
Thanks :-)

Read Page Info From WebBrowser Control?
I am able to place values on forms that load into my webbrowser control, but
I'd like to be able to scan the page for data. I know to use the
HTMLDocument object.

Basically I'm hoping to find an example of a DocumentComplete routine that

- display a list of all elements (tags?) on the page
- number of forms on the page
- ID, name, type and value for each field on the form
- and how I should handle a page with multiple frames.

I've found numerous examples through Google, but they are all VERY simple as
they assume you know what form index and element names are on the page
already. I can't find any samples that can scan a random page and produce
some output.


Invalid Page Fault With WebBrowser Control

Developed & deployed a VB 6 application which includes a form
containing a webbrowser control which I use to display a
html page containing a Flash movie of a map. The
application uses XML to plot locations on the map.

One user of the application gets an "iexplore.exe caused
an invalid page fault in shdocvw.dll" error whenever they
click on one of these locations. There is code on the
BeforeNavigate2 event to pick up a location ID which is returned as part of the URL,
set a property on another form and then display that other form
with has information about the location the user clicked on

Another user got a Dr Watsons error. I recreated the dev.
environment on the machine where this error was happening
and tried stepping thro the code and, of course, the error
wouldn't happen (tho it still happened once I re-built the

The first user is using Win 98 and IE 5, the second user
was using Win NT SP6 and IE 6. I managed to come up with a
workaround for the NT user but it didn't help the Win98

I have absolutely no idea why this error is occuring and
even less of an idea on how to fix it.

Any help would be very very welcome.

Many Thanks in Advance

Executing A Script On A Web Page Using VB And The Webbrowser Control
I want to execute a script on a web page using the webbrowser control.

I know this can be done using Visual C++. MSDN KB article Q185127 explains that but I could not find the related article in VB.

Any information or pointers will be appreciated.

Loading Page Content Into Webbrowser Control From A Variable - Help!
I need to open up an HTML document in a webbrowser control. However the document is not a file on the user's computer or a location on the internet, the document is actually stored inside of a variable. It originally comes from a resource, but that is not important. What's important is that all of the HTML is in a variable instead of in a normal location.


Me.WebBrowser.Navigate strPage

doesn't work, since the webbrowser expects strPage to be an URL like "" instead of an entire page.


Me.WebBrowser.Document = strPage

Gives me an error:

"Object doesn't support this property or method."

So, what is my best bet here? I don't want to write the contents of the variable to a file and then open it, since I do not want the user to be able to see the HTML page's source.

Your knowledge is appreciated.


Getting Source Using WebBrowser Control (without Downloading Complete Page)
hi there... its my First post on this forum so a warm Hello to all

my problem:
i am trying to get a Web-Page's source using

dim WbSource As String

For i = 1 To WebBrowser1.Document.All.length
WbSource = websource & WebBrowser1.Document.All.Item(1).innerhtml
Next i

but i have to use WebBrowser1_DocumentComplete method. (i can get the source only on documents completion). But Image files (embeded on those pages) are slowing the procedure down...
is there any way to get the source without downloading those images?

Respects and thanks in advance

Fire Onclick Event On Asp Page In Webbrowser Control
Hi all:
I am not a hardcore VB programmer so hopefully there are some experts out there who can help.

I have a VB6 form with a webbrowser control on it. When the form opens, the control is loaded with an ASP login web page. The user then logs in to the website and a second page loads. The second page has 3 frames. One of the frames has a disconnect button in it. If the machine is idle for a period of time I want to fire the onClick event of the disconnect button on the web page.

Tracking the idle time is easy enough but is there a way to fire the onclick event of a button in a frame on a web page in a webbrowser control?

Thanks for your help

Paticular Section Of A Web Page To Be Displayed In Webbrowser Control
Is is possible to tell VB what section of a web page to show in the webbrowser control? For example, if you take the web page:

Is there a way to show just the username, password, and login button in an webbrowser control, and discard the rest (or hide)?

Guidance to an article or something would be helpfull...


How Can I Control A HTML Page While Is Open By My Webbrowser Controlser
i know in a nomal HTML page , we can use code as this:
but when the HTML page have "frame" the this VB code can't work
. whow can i write VB code to cotrol the botton is the frame HTML

Sink Events Of All Frames In A Web Page - VB6 WebBrowser Control
Hi All,

    I know how to sink MouseMove/ MouseDown events occur in a normal HTML webpage to a VB Function.

Dim WithEvents mydoc as HTMLDocument

private sub webbrowser_navigatecomplete()
 set mydoc=webbrowser.Document
end sub

private sub mydoc_onmousedown()
 Msgbox "Mouse Down"
end sub

But if the webpage contains Frames Individual elements are not recognized. srcElement of event object shows as IFrame and not as individual elemnts.

Please tell me a solution for: sinking the events of all elements in all Frames to MouseMove/MouseDown Element irrespective of number of Frames present in the Webpage.
Thank you,


Scrolling Down The WebBrowser Control To Bottom Of Page Via VB Code. (RESOLVED)
In something as simple as:
Option Explicit

Private Sub Command1_Click()
    On Error Resume Next
    Me.WebBrowser1.Document.Write Me.Text1.Text & "<br>"
End Sub

Private Sub Form_Load()
    Me.WebBrowser1.Navigate "about:blank"
    Me.Text1.Text = "Sample <b>Message</b>"
End Sub

How does one get the WebBrowser Control to scroll to the bottom of the page after each document.write?

Clint LaFever (aka: DaVBMan)

Edited by - DaVBMan on 7/10/2003 1:56:26 PM

Supressing IE Security Alert When Refreshing A Page Using WebBrowser Control
How do you supress or automatically control a security dialog box (specifically "This page cannot be refreshed without resending the information....." which happens whenever you try and refresh a page that was obtained with a HTTP Post method) I have tried the WebBrowser.Silent method which does NOT do anything. Please HELP!!!

In Access, Resize Size Application To Size Form

I'm using Access.

I want to specify the size of the application (Access) to be adapted with the size of a form (which dimensions can't be changed) and i want the form to be anchored on the top left of the application. I thought to put the code in the Form_load.

I found a lot of threads that deal with resizing but all of them seem to answer the problem 'size of the controls' with 'size of the form'.

If someone can help me !

Thanks by advance.

RESOLVED - Can't Get Page Setup Dialog To Show Page Size Correctly
Hey guys and gals, I am hoping someone will have an idea on this one . . .

I am trying to show the page setup dialog and prepopulate the values of the page setup dialog before it is shown. All of the form pre-population seems to work except paper size. I can retrieve paper size just fine after the user clicks ok on the form, I just can't seem to set it before the form is populated.

I created a tiny test app to illustrate my problem.

VB Code:
' on a formOption Explicit  Private Sub Command1_Click()    With Printer' Height & Width; Printer object ó the physical dimensions' of the paper set up for the printing device; not available' at design time. If set at run time, values in these properties' are used instead of the setting of the PaperSize property.'        .Width = 14'        .Height = 8.5        .PaperSize = vbPRPSLegal        .Orientation = vbPRORLandscape    End With    ShowPageSetupDlg MeEnd Sub '********************************************************************'                IN A MODULE! Option Explicit Const CCHDEVICENAME = 32Const CCHFORMNAME = 32Const GMEM_MOVEABLE = &H2Const GMEM_ZEROINIT = &H40Const DM_DUPLEX = &H1000&Const DM_ORIENTATION = &H1&Const PSD_MARGINS = &H2Const PSD_DISABLEPRINTER = &H20Const PSD_INTHOUSANDTHSOFINCHES As Long = &H4Const PSD_DISABLEPAPER As Long = &H200 Private Declare Function PageSetupDlg Lib "comdlg32.dll" _    Alias "PageSetupDlgA" (pPagesetupdlg As PageSetupDlg) As Long Private Declare Sub CopyMemory Lib "kernel32" _    Alias "RtlMoveMemory" _    (hpvDest As Any, _    hpvSource As Any, _    ByVal cbCopy As Long) Private Declare Function GlobalLock Lib "kernel32" _    (ByVal hMem As Long) As Long Private Declare Function GlobalUnlock Lib "kernel32" _    (ByVal hMem As Long) As Long Private Declare Function GlobalAlloc Lib "kernel32" _    (ByVal wFlags As Long, _    ByVal dwBytes As Long) As Long Private Declare Function GlobalFree Lib "kernel32" _    (ByVal hMem As Long) As Long Private Type POINTAPI    x As Long    Y As LongEnd TypePrivate Type RECT    Left As Long    Top As Long    Right As Long    Bottom As LongEnd TypePrivate Type PageSetupDlg    lStructSize As Long    hwndOwner As Long    hDevMode As Long    hDevNames As Long    flags As Long    ptPaperSize As POINTAPI    rtMinMargin As RECT    rtMargin As RECT    hInstance As Long    lCustData As Long    lpfnPageSetupHook As Long    lpfnPagePaintHook As Long    lpPageSetupTemplateName As String    hPageSetupTemplate As LongEnd TypePrivate Type DEVMODE_TYPE    dmDeviceName As String * CCHDEVICENAME    dmSpecVersion As Integer    dmDriverVersion As Integer    dmSize As Integer    dmDriverExtra As Integer    dmFields As Long    dmOrientation As Integer    dmPaperSize As Integer    dmPaperLength As Integer    dmPaperWidth As Integer    dmScale As Integer    dmCopies As Integer    dmDefaultSource As Integer    dmPrintQuality As Integer    dmColor As Integer    dmDuplex As Integer    dmYResolution As Integer    dmTToption As Integer    dmCollate As Integer    dmFormName As String * CCHFORMNAME    dmUnusedPadding As Integer    dmBitsPerPel As Integer    dmPelsWidth As Long    dmPelsHeight As Long    dmDisplayFlags As Long    dmDisplayFrequency As LongEnd Type Public Function ShowPageSetupDlg(frm As Form) As Boolean    Dim DevMode As DEVMODE_TYPE    Dim lpDevMode As Long    Dim m_PSD As PageSetupDlg    Dim bReturn As Integer        On Error Resume Next    'Set the current orientation and duplex setting    DevMode.dmDeviceName = Printer.DeviceName    DevMode.dmFields = DM_ORIENTATION Or DM_DUPLEX'    DevMode.dmPaperWidth = Printer.Width'    DevMode.dmPaperLength = Printer.Height    DevMode.dmOrientation = Printer.Orientation    DevMode.dmPaperSize = Printer.PaperSize    DevMode.dmDuplex = Printer.Duplex    DevMode.dmSize = Len(DevMode)    On Error GoTo 0        'Allocate memory for the initialization hDevMode structure    'and copy the settings gathered above into this memory    m_PSD.hDevMode = GlobalAlloc(GMEM_MOVEABLE Or GMEM_ZEROINIT, Len(DevMode))    lpDevMode = GlobalLock(m_PSD.hDevMode)    If lpDevMode > 0 Then        CopyMemory ByVal lpDevMode, DevMode, Len(DevMode)        bReturn = GlobalUnlock(m_PSD.hDevMode)    End If        With m_PSD        .rtMargin.Top = 0.5 * 1000        .rtMargin.Bottom = 0.5 * 1000        .rtMargin.Left = 0.5 * 1000        .rtMargin.Right = 0.5 * 1000        .ptPaperSize.x = 14 * 1000        .ptPaperSize.Y = 8.5 * 1000        .lStructSize = Len(m_PSD)       'Set the structure size        .hwndOwner = frm.hWnd           'Set the owner window        .hInstance = App.hInstance      'Set the application instance        .flags = PSD_MARGINS Or PSD_DISABLEPRINTER Or PSD_INTHOUSANDTHSOFINCHES    End With        'Show the pagesetup dialog    If PageSetupDlg(m_PSD) Then        ShowPageSetupDlg = True'        sngMarginTop = (m_PSD.rtMargin.Top) / 1000'        sngMarginBottom = (m_PSD.rtMargin.Bottom) / 1000'        sngMarginLeft = (m_PSD.rtMargin.Left) / 1000'        sngMarginRight = (m_PSD.rtMargin.Right) / 1000'        sngPageW = (m_PSD.ptPaperSize.x) / 1000'        sngPageH = (m_PSD.ptPaperSize.Y) / 1000                ' Get DEVMODE structure from PRINTDLG        lpDevMode = GlobalLock(m_PSD.hDevMode)        CopyMemory DevMode, ByVal lpDevMode, Len(DevMode)        Call GlobalUnlock(m_PSD.hDevMode)        ' Set default printer properties        On Error Resume Next        If Not (Printer Is Nothing) Then            Printer.Copies = DevMode.dmCopies            Printer.Orientation = DevMode.dmOrientation            Printer.PaperSize = DevMode.dmPaperSize'            lPaperSize = DevMode.dmPaperSize            Printer.PrintQuality = DevMode.dmPrintQuality        End If        On Error GoTo 0    End IfEnd Function

Thanks in advance for any insight!

Resize A JPG To The Size Of My Picture Box ?
Hi guys this maybe a simple question for you but i cant seem to get it to work.

How do i resize a jpg image to the size of my picture box ?

Tnx alot !

Webbrowser Resize
I have a web browser in my project. It is Webbrowser1 I can not figure out how to keep it sized. I want it to be fullscreen when the window is in normal state, or maximized state, basicly i want it to stay the same no matter how the size it. Any suggestions?

Resize Form To Datagrid Size
I have a form with only a datagrid on it. I want the form to resize (on form_load) to the datagrid's size (according to how many rows it retrieves). Can someone help me?

Resize Pic File To A Predetermined Size
hello all,

my user provides me (the application) with a picture file (jgp/bmp/Etc.).
size = 250x400pxl.

i then need to resize the picture file to a smaller size (!), i.e., make it into a 38x61pxl size. while keeping the right ratio & resolution...
as target size is not very big, i cant afford distortion of picture.

Thanks in advance for any ideas, suggestions, or help references.


[Help!] How To Resize Pic Size In PictureBox Object?
I am using Vb6.0 currently i am doing a floor map program, but my blue print is too big i wanted to resize the actual file when it is loaded into picturebox. How can i do that?

And how can i add a scroll bar function on the picture box? i can add a scroll bar with imagebox but it is too lag thats why i wanted to use picturebox, so that i can edit or draw anything onto the blue print.

anyone know about it? or have done related program before? thanks~~

Resize An Image And Save The New Size??
HI all,

I am capturing an video into a BMP by using some ocx control.
Now the size of the BMP is big i am resizing to small BMP.

But when i try to save this BMP it is saving into original size.

Now i have 2 questions.

1. How to resize ( this i did) a big image to small and save.

2. as i have a resized image , kindly tell me atleast how to print this image on paper.

Thanx in advance

Restricting Resize With Webbrowser
im using the webbrower control and some pages resize the window and it takes over the whole form and really screws things up

so how do i stop it from doing this?

Webbrowser Resize And Navigate
I have to make a webbrowser control to resize when I resize the form.
When I resize the webbrowser I need its content being refreshed.

I tried with this code, but it doesn't resize, maybe because it refreshes too many times at once:

Private Sub Form_Load()

WebBrowser1.Navigate ""

End Sub

Private Sub Form_Resize()

WebBrowser1.Width = Me.ScaleWidth
WebBrowser1.Height = Me.ScaleHeight

WebBrowser1.Navigate ""

End Sub

I also thought to catch the mouse click on the form border to know when it's released and to refresh the browser in that case, but I don't know how to do it.

Detection Of Webbrowser Resize
I have a web browser control on a Visual Basic

What is the easiest way of detecting when the window
has changed size (caused by a window.resizeTo in Javascript)
and hence obtaining the resized window size??

Help! How To Resize Picture's Content With The Form Size?
Does anyone can help me with this?
I was trying to write some text line to a form and display on screen. They are different in font sizes. However, when I resize the form, none of the printed text will not resize in proportion with the form size.

So this is not what I want. Then I put a picturebox into the form. And I wrote text into that picturebox1. The texts did appear in that Form1.picturebox1. Yet, when I resize it, the picturebox will not resize with the form.

Then I also try some like this:
Sub displayWord_onForm()
Form1.Picture1.FontSize = 26
Form1.Picture1.Print "Super!!"
' Clear the Clipboard if it's another type of data in the Clipboard.
Clipboard.SetData Form1.Picture1.Picture
' Copy Clipboard text to Text2.
frmdisplay.Picture1.Picture = Clipboard.GetData
End Sub

Guess what? nothing appears on the form frmdisplay.

Can anyone tell me how to deal with this?
I would really appreciate.


Help! Resize MDIChild Form To Correct Size
Could s/o show me how to set MDI child from at correct size? I have one MDI parent, other form I set MDIchild to TRUE but when I compile, the child form is bigger than size I set, but if I set to FALSE, it gives correct size...!!!

Please advise

Auto Resize Chart To Size Of Form
I'm making a chart in a form which is resizeable. Is it possible to let the chart auto. resize if i change the size of the form?

Prevent Form Resize Below Specific Size
How can I restrict a form from getting any smaller than a certain size? I've been using:

Option Explicit

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 CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Const GWL_WNDPROC = (-4)

Private Const WM_SIZING = &H214

Private Const WMSZ_LEFT = 1
Private Const WMSZ_RIGHT = 2
Private Const WMSZ_TOP = 3
Private Const WMSZ_TOPLEFT = 4
Private Const WMSZ_TOPRIGHT = 5
Private Const WMSZ_BOTTOM = 6
Private Const WMSZ_BOTTOMLEFT = 7
Private Const WMSZ_BOTTOMRIGHT = 8

Private MIN_WIDTH As Long 'The minimum width in pixels
Private MIN_HEIGHT As Long 'The minimum height in pixels
Private MAX_WIDTH As Long 'The maximum width in pixels
Private MAX_HEIGHT As Long 'The maximum height in pixels

Private Type RECT
Left As Long
Top As Long
Bottom As Long
End Type

Private mPrevProc As Long

Public Sub Hook(hWnd As Long)
mPrevProc = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf NewWndProc)
End Sub

Public Sub Unhook(hWnd As Long)
Call SetWindowLong(hWnd, GWL_WNDPROC, mPrevProc)
mPrevProc = 0&
End Sub

Public Function NewWndProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
On Error Resume Next

MAX_WIDTH = Screen.Width
MAX_HEIGHT = Screen.Height

Dim r As RECT

If uMsg = WM_SIZING Then
Call CopyMemory(r, ByVal lParam, Len(r))

'Keep the form only at least as wide as MIN_WIDTH
If (r.RIGHT - r.Left < MIN_WIDTH) Then
Select Case wParam
r.Left = r.RIGHT - MIN_WIDTH
r.RIGHT = r.Left + MIN_WIDTH
End Select
End If

'Keep the form only at least as tall as MIN_HEIGHT
If (r.Bottom - r.Top < MIN_HEIGHT) Then
Select Case wParam
r.Top = r.Bottom - MIN_HEIGHT
r.Bottom = r.Top + MIN_HEIGHT
End Select
End If

'Keep the form only as wide as MAX_WIDTH
If (r.RIGHT - r.Left > MAX_WIDTH) Then
Select Case wParam
r.Left = r.RIGHT - MAX_WIDTH
r.RIGHT = r.Left + MAX_WIDTH
End Select
End If

'Keep the form only as tall as MAX_HEIGHT
If (r.Bottom - r.Top > MAX_HEIGHT) Then
Select Case wParam
r.Top = r.Bottom - MAX_HEIGHT
r.Bottom = r.Top + MAX_HEIGHT
End Select
End If

Call CopyMemory(ByVal lParam, r, Len(r))

NewWndProc = 0&
Exit Function
End If

If mPrevProc > 0& Then
NewWndProc = CallWindowProc(mPrevProc, hWnd, uMsg, wParam, lParam)
NewWndProc = DefWindowProc(hWnd, uMsg, wParam, lParam)
End If

End Function

but for some reason, when I unload the form and reload it, the window stops responding to anything. I use the "Call Unhook(Me.hWnd)" function when I unload the form but the form still stops responding when I load it, unload it, and load it again.

Copyright © 2005-08, All rights reserved