Solved

Refresh screen

Posted on 2012-12-28
8
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 7

Expert Comment

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

Author Comment

by:MERCOMMS
ID: 38727192
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 47

Expert Comment

by:Martin Liss
ID: 38727543
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:MERCOMMS
ID: 38727887
Doevents after moving the window has no affect.
0
 
LVL 15

Expert Comment

by:eemit
ID: 38727974
Try to set Form AutoRedraw property to True.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 38728038
Does it only happen with the exe?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38728741
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
ID: 38731090
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

732 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