Solved

Refresh screen

Posted on 2012-12-28
8
274 Views
Last Modified: 2012-12-31
I have an app that opens a command prompt window then moves that command prompt window.  Everything works fine but after the command prompt window is moved there is a "ghost" of the window where it originally was.  If you grab the command prompt window and move it around it will erase the ghost of itself if that makes sense.  

What I need is something that will refresh the screen to get rid of the "ghost" image of the command prompt window (vb6).
0
Comment
Question by:MERCOMMS
8 Comments
 
LVL 7

Expert Comment

by:Element1910
Comment Utility
Is it creating a ghost copy every time you move it or only once?
0
 

Author Comment

by:MERCOMMS
Comment Utility
I only move it via code one time and it doesn't create the ghost then but instead leaves a ghost of where it was originally.  Then if I grab the window I can use it kind of like an eraser to erase the ghost.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
Does the same thing happen if the code is run in the IDE? If NOT then try putting a DoEvents line after the code that moves the window.
0
 

Author Comment

by:MERCOMMS
Comment Utility
Doevents after moving the window has no affect.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 15

Expert Comment

by:eemit
Comment Utility
Try to set Form AutoRedraw property to True.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
Does it only happen with the exe?
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
Is your app by chance waiting for the command prompt window to close?

How are you opening that command prompt?
0
 
LVL 9

Accepted Solution

by:
shorvath earned 200 total points
Comment Utility
I assume that when you say you are 'Moving the Window' you are using the API

Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As _
Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As _
Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long 

Open in new window

The last option, bRepaint determines if the screen is repainted or not.

If you don't want the ghost image, set this value to TRUE  ( 1 )

retval = MoveWindow(Form1.hWnd, 200, 150, 175, 300, 1)

Open in new window

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now