How do you send characters to another application's Text Box when that text box is controlled by code that formats the data. I have a legacy application (without source code of course) that I would like to control. I can write just fine into Text Boxes that just accept characters -- but this instance is a Text Box where the legacy code is looking in the Keyboard Buffer for characters and then formatting what is displayed. In other words, its stuffing in the dollar sign ("$") automatically. This works fine for ordinary Text boxes but not for the ones that format the text box contents: SendMessageText(WINDOWHANDLE, WM_SETTEXT, Len(TEXTMESSAGE), TEXTMESSAGE) It seems as if I need to write to the Keyboard buffer so the Legacy Application can process it --- but when I tried that I learned that you have to switch the focus to the Legacy Application because only focused applications can access the Keyboard buffer. Anybody have a code fragment that can do this? Thanks Carl Carl@CarteBlanc.com
CarlMoser
Posts
-
Hooking - How to send characters to another application ... -
MONO (.net on Linux) and 3rd party component vendorsI've been R&D-ing Linux for some projects where I work and from what I have seen, I'm looking for a reason to deploy and utilize Linux -- Linux has gotten that good in the last couple years. I really think that the new Beryl "eye candy" 3D desktop is not only visually attractive but its also makes sense functionally. The rotating cube where each face of the cube is a workspace makes sense from a human perspective/human engineering perspective. Then with Mono and Wine, it looks like Linux is right on the verge of being a real contender for Windows. Before I got reaquainted with Linux, I thought Microsofts .NET RAD tool made Windows insurmountable. .NET on Linux is indeed a stroke of genius. I can't wait to see how this is going to play out. It should definitely be very exciting the next couple of years. Certainly Linux has some hardware compatibility issues - notably with ATI video cards. But, I like the new 3D Beryl spining cube desktop so much that I have purchased Linux-compatible Nvidia video cards for my home PC. I think this stuff is that good. Might be an interesting business opportunity for someone to come out with a Linux personal computer fully loaded with these new features - especially have Beryl and Wine already setup and configured -- with full easy to understand documentation for Wine applications. Carl
-
Drag and Drop file to Desktop, Email, etc.'Here is the Drag and Drop Code from above - VB.NET 2005. ' 'Problem 1: 'When I drag and drop a file name from ListBox1 to PictureBox1, it works. 'When I drag and drop a filename from ListBox1 to Outlook Email for use 'as an attachment, I get the filename text inserted. ' 'Problem 2: 'When I try and drag and drop from the PictureBox1 to Outlook or 'the Paint program, I get nothing. ' 'Any Ideas on how to fix this??????? '-------------------------------------------------------------------- Public Class Form1 'The Problem lies in the SelectedItem property. Actually if you do the mouse 'down the item is not already selected. You have to use the SelectedIndex 'and get then the the according item. Please find the code below which is 'working. Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown If e.Button = MouseButtons.Left Then If ListBox1.SelectedIndex > -1 Then ListBox1.DoDragDrop(ListBox1.Items.Item(ListBox1.SelectedIndex).ToString, DragDropEffects.Copy) End If End If End Sub Private Sub PictureBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown Dim o As New DataObject o.SetData(DataFormats.Bitmap, PictureBox1.Image) PictureBox1.DoDragDrop(o.GetData(DataFormats.Bitmap, True), DragDropEffects.Copy) End Sub Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged Debug.WriteLine("SelectedIndexChanged - " & ListBox1.SelectedItem.ToString) End Sub Private Sub PictureBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragEnter If e.Data.GetDataPresent(GetType(System.String)) = True Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.Link End If End Sub Private Sub PictureBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragDrop If Not PictureBox1.Image Is Nothing Then PictureBox1.Image.Dispose() PictureBox1.Image = Nothing End If PictureBox1.Image = Image.FromFile(CStr(e.Data.GetData(GetType(System.String)))) End Sub Private Sub btnExit_Click(ByVal
-
Drag and Drop file to Desktop, Email, etc.I'm using VB.NET 2005. I have a list of filenames in a ListBox. What I would like to do is to click on a filename (an item in my ListBox) and drop the file, not the filename. An example would be to select a filename in the ListBox, and drag and drop that file to Outlook email I want to send. When I try what I know, all I can get dropped is the filename as text. Windows Explorer lets us drag and drop a file into Outlook as an attachment. Any insights would be highly appreciated. Thanks Carl@CarteBlanc.com
-
I'm a RelicI remember fondly the "good old days" like you. I was a 6502 microprocessor assembly language programmer - had to "hand assemble" many of the programs I wrote. Even today I still remember most of the opcodes: A5 = LDA immediate, 85 = STA immediate, EA=NOP, etc. I remember those days fondly and just the other day I found a copy of VisiCalc that would run on todays PC and toyed with it. Would I want to give up my Visual Studio.NET RAD and go back to hand assembly? Give up my Excel 2003 for VisiCalc? To return to the "good old days"? Hmmm .... for the fun and atmosphere back in those glory days, heck yes. It was a great time with many world changing events going on. CW
-
What programming language?CWIn the "old days" it was true that Visual Basic was much slower than C, C++. But now is not the "old days" if you use Visual Studio .NET 2005. Now there is not much difference in speed between VB and C++. Oh I'll admit that if you are writing an embedded application on a slow processor that C++ might be a better choice - then again, I could make a compelling argument that Assembly Language is faster than C++:-) I've been programming in the days of Assembly Language, was a C programmer on UNIX, and done a lot of C++ programming using Borland C++ Builder. Did a lot of Pascal using Delphi. Now late in my career I'm a VB.NET programmer and am convienced that Visual Studio is the most advanced compiler or RAD (Rapid Application Development) that has thus far been developed. In the "old days" you could not write console (command line) applications in VB nor write DLL's - now you can. In fact, Microsoft's Visual Studio compiles both C++ and Visual Basic into a CLR (Common Language Runtime) intermediary language, for both VB and C++, and that tells me that VB.NET is so close to C++ speed that it is negligable for nearly all needs. Where I work now, its an all VB shop. I could have used my C++ skills to write code in C++ but that would introduce a level of unfamilarity to others - so I adapted to VB.NET. What I advocate is that the *reason* to use a language is generally not because of things like speed - but other more compelling things like adapting to the culture and environment where you work. Another reason for VB.NET is that I sense that there are more programming opportunites in VB than in C++. Then again, if you know VB.NET well, you should be able to pick up C++ much faster. CW