I added the KeyPress subroutine to my program so I could detect a keypress and do some special features.
The problem I am having in when I move the program over to the target system. The program run correctly, but when I do a keypress, nothing happens. It is suppose to open another window on top of the current window, but no window opens.
Move it by copying the exe file, or move it by making a deployment package and installing it on the target system?
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
This is the code that is in the form that I am calling from. The form displays a picture that takes the full screen. I then want to popup another form on top buy using a keypress. This works correctly on my development system, but when I move the .exe over to the taget system and run it, the keypress part doesn't work.
For one thing, Toggle is always going to be false. So if you press "d" nothing happens. If you press "s", the overlay will show. Next time nothing happens regardless of the key you press. Change
Dim Toggle As Boolean
to
Static Toggle As Boolean.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana
I fixed that part by moving "Toggle" to the top of the form and making it global. The problem is that the routine works on the development system. Even if I compile it to a .exe, it still works. The problem is when I move the .exe over to the target system, the program runs OK, but when I press "s" the form does not appear at all. It's like Form_KeyPress doesn't work anymore.
Discovered that Keypress works even on the target system IF it is run from the Main Form. BUT if I try to run KeyPress from any other form, it does not work.
The Keypress event only fires for the form that's active. Either add the same code to the other form(s) , read the keyboard state in a timer, or set a hotkey.
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
Can you show me a example of how to do the timer or hotkey approach. What I am trying to do is.....display a 1280X1024 image. Then press a key to toggle the menu form to show. Then hit the same key or another key and have it toggle off. The image display form is called from the main form. So the image form is form #2 and the menu form is form #3. Image form sets on top of the main form.
I put the Form_KeyPress code in the Image form. Also put the Me.KeyPreview = true in Image form Form_Load. Ran program. Selected the Image form from Main form. Image form came up. Pressed space bar. menu form did not come up.
this all works correctly on the development system.
I have image viewer only program that does not call any other form. It only has the frmMain. The KeyPress routine works great for it. KeyPress on it does a shuttle/jog routine. This is running on the target system.
Looks like for some reason KeyPress does not work on sub forms, just the main form.
Keith... Demo works OK, have not tried it on taget system yet. I then modified so keyPress on Form1 calls Form2 and KeyPress on Form2 hides Form2. That worked OK. Then I added Text boxes to Form2, had Form1 send data to the Textboxes when Form2 loads. This works, but when I try to press a key on Form2, Form2 does not hide.
What I am doing on the target system is a program that the main menu calls a form that has a full scale real time image. Thus no room for buttons and such. I want Keypress on the Image form to call the ImageMenu Form, do what I need on it, then Keypress on the ImageMenu form will then hide ImageMenu. This works on the development system and I even compiled it to a EXE and the EXE runs correctly on the development system. But when I move the EXE over to the target system, Image Form comes up correctly, but when I press a key on the Image Form, ImageMenu form does not come up. Remeber that the Target system ONLY has runtime files and does not have VB6 on it.
If I can not get this to work, then I am going to create a very smal floating window that will have two buttons on it, "Menu" and "Exit". Menu will then call the ImageMenu form and the "Exit" button on the Imagemenu will hid the ImageForm and the "Exit" button on the Image form will terminate the Image form.
Last edited by JohnDonaldson; Jun 23rd, 2006 at 10:46 AM.
Well, I hope you get it working. I've had similar problem with Keypress. You say that the one form is a full screen image. Is it just a form or is there a picturebox ? If there's a pictureBox, try grabbing it's keypress. IE Picture1_Keypress.
Good luck, let me know what happens.
Keith_VB6
If you have any further questions, just ask.
If this solves things, then please mark the thread resolved.
[Thread Tools] --> [Mark Thread Resolved]
KEITH......yes I can get keyPress to work on the Development system, but not on the Target system. The target system does not have VB on it, just runtimes.
I have put Kepress on the Image Window and the ImageMenu Window, It all works on the Developement system but not on the Target system. So I have decided to try a different affroach. Create a floating window with two buttons and use them to call the ImageMenu and exit the Image Window.
KEITH......yes I can get keyPress to work on the Development system, but not on the Target system. The target system does not have VB on it, just runtimes.
Did you copy the runtime files, or did you install them with an install package? VB apps don't always work correctly if you just copy the files.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read. Please Help Us To Save Ana