[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

Refresh screen

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
MERCOMMS
Asked:
MERCOMMS
1 Solution
 
Element1910Commented:
Is it creating a ghost copy every time you move it or only once?
0
 
MERCOMMSAuthor Commented:
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
 
Martin LissRetired ProgrammerCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
MERCOMMSAuthor Commented:
Doevents after moving the window has no affect.
0
 
eemitCommented:
Try to set Form AutoRedraw property to True.
0
 
Martin LissRetired ProgrammerCommented:
Does it only happen with the exe?
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Is your app by chance waiting for the command prompt window to close?

How are you opening that command prompt?
0
 
shorvathCommented:
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now