From: DevNews on 16 Jun 2010 11:02 I am trying to create a function to clear the immediate window from my running code. I figured I would simply get the hWnd of the window and send the appropriate keystrokes. Well it seems it aint that simple. I am able to get the handle to the window and send the appropriate messages (keystrokes) to the window. The problem is that this window does not allow edits while the IDE is in run mode. My thinking on how this is done is that the window's message handler just ignores keystroke messages, which would alter the contents of the window, while the IDE is in run. My first thought as to how to get around this was to sub-class the immediate window and simply discard all messages during the time I am clearing the window. Sounds like a simple enough solution, but I can't think of any way to clear the window that does not result in a message being sent. Anyone got any ideas? Thanks, Steve
From: Jon Lewis on 16 Jun 2010 11:27 I've always used: Dim strClear As String strClear = String(256, vbCrLf) Debug.Print strClear HTH "DevNews" <sredmyer(a)sndirect.com> wrote in message news:hvap2d$fjh$1(a)news.eternal-september.org... >I am trying to create a function to clear the immediate window from my >running code. I figured I would simply get the hWnd of the window and send >the appropriate keystrokes. Well it seems it aint that simple. > > I am able to get the handle to the window and send the appropriate > messages (keystrokes) to the window. The problem is that this window does > not allow edits while the IDE is in run mode. My thinking on how this is > done is that the window's message handler just ignores keystroke messages, > which would alter the contents of the window, while the IDE is in run. > > My first thought as to how to get around this was to sub-class the > immediate window and simply discard all messages during the time I am > clearing the window. Sounds like a simple enough solution, but I can't > think of any way to clear the window that does not result in a message > being sent. > > Anyone got any ideas? > > Thanks, > Steve
From: Steve on 17 Jun 2010 07:47 "Jon Lewis" <jon.lewis(a)cutthespambtinternet.com> wrote in message news:PrydnexHI6jzcIXRnZ2dnUVZ8uidnZ2d(a)bt.com... > I've always used: > > Dim strClear As String > strClear = String(256, vbCrLf) > Debug.Print strClear > > > HTH There are a couple problems with that solution (in my eyes). One is that it does not really clear the debug window but simply moves the insertion point beyond the limit, thereby causing all existing text to be scrolled out of view. This leaves the insertion point (where the next bit of text from a Debug.Print statement will go) all the way to the bottom of the immediate window. The other problem is that (aside from the insertion point being at the bottom of the window) there are visual indications that the debug window might not be empty. Namely the vertical scroll bar; both it's size and position would indicate that there may be text which is scrolled out of view. I have tried, with limited success, to fix the problem of the location of the insertion point by sending ctrl+home keystrokes to the debug window to return the cursor to the top of the window. This works in some situations (keystrokes actually make it to the debug window and cursor moves to the top) but not all (keystrokes go to the IDE moving the cursor in the active code pane to the top). It seems the debug window has different behavior when the IDE is MDI mode vs SDI. The behavior also seems to be different when the debug window is docked vs undocked. I am still working to understand these differences. So while the solution of simply printing many blank lines does work (sort of) it is (in my mind) less than ideal. I will continue to try and resolve the issue of the cursor location but I am hoping that someone can help me find a way to simply clear the the debug window. Thanks, Steve
From: Dee Earley on 17 Jun 2010 08:05 On 16/06/2010 16:02, DevNews wrote: > I am trying to create a function to clear the immediate window from my > running code. I figured I would simply get the hWnd of the window and > send the appropriate keystrokes. Well it seems it aint that simple. Out of interest, why? -- Dee Earley (dee.earley(a)icode.co.uk) i-Catcher Development Team iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)
From: Steve on 17 Jun 2010 08:26 "Dee Earley" <dee.earley(a)icode.co.uk> wrote in message news:e2hoXWhDLHA.5324(a)TK2MSFTNGP06.phx.gbl... > On 16/06/2010 16:02, DevNews wrote: >> I am trying to create a function to clear the immediate window from my >> running code. I figured I would simply get the hWnd of the window and >> send the appropriate keystrokes. Well it seems it aint that simple. > > Out of interest, why? > > -- > Dee Earley (dee.earley(a)icode.co.uk) > i-Catcher Development Team > > iCode Systems > > (Replies direct to my email address will be ignored. > Please reply to the group.) Well a co-worker asked if I knew of any way to do it and I took it as a challenge to find/create a way. His situation is that he is logging (to the debug window) the values of several variables during the running of a particular function. This function is called repeatedly by his running code and he would like for each time his code enters the function for it to start with a clean slate in the debug window so he can more easily inspect the results. While I do not know his specific needs (other than that described) I have also had occasions in the past to make use of such a feature. For my own needs, the effort required to figure a way to do it was always greater than the time I had to solve whatever problem I was working on so I never looked into it very seriously. But now it is just a challenge :) Steve
|
Next
|
Last
Pages: 1 2 Prev: Format$ function Next: Stuck in serial communication with Fire Alarm System |