How Can I Give InputBoxes Focus???
Hi,After making an exe file, ImputBoxes in my app do not have focus. They are shown and the curser is flashing in the text InputBox and I have to click on it to give it focus.After lost focus on a combo, if a condition is not true I have the code, "Call Command1_Click" Private Sub Command1_Click()NEW_Value = InputBox("Please enter the New Value.")This works ok in IDE, the inputBox has focus but not from the exe.How can I give the inputBox focus when called?Any help appreciated.Regards,Alan
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Give Focus To Activex Component On Form Focus?
Using the Reflections ActiveX component (Reflections is a popular Terminal Editor for connecting with old Alpha/VMS servers), I have a Form with this internal terminal editor ActiveX that obviously needs to have focus to type in.
I've tried setting Form_GotFocus and Form_Click to give focus to the activex component but to no avail. The only thing that works is if I set Form_Repaint to give focus, then it works fine. But repaint causes the window to constantly try to bring itself in front of other Microsoft apps like Word and Outlook and other VB apps when I drag them in front of it. And it keeps flashing in the task bar when I move something non-MS in front of it.
Is there a better way to keep focus on the activex terminal session when the form gets focus without using repaint?
Give Another App. Focus
Hey all,
Another silly but frustrating thing I can't seem to find a sulotion for. 8)
My VB app performs a few necessary system changes before a second app is initialised. That all works perfectly and the second app is called successfully via the folowing code:
Private Sub InvokeApp()
Shell "IOCV1.2.exe"
Unload Me
End Sub
My problem is the the second app initialises minimised to the task bar when called like this.
Is there any way to pass focus to another app from vb, not just another form?
Thanks
Fiba
Give Powerpoint The Focus
I have made a simple VB6 app that has command buttons to control a projector via mscomm.
I would like to know how to return the focus back to powerpoint's active presentation automatically, as if you have press the PowerPoint show button on the taskbar.
Suppose all in need to know is "how to contol the taskbar" to automatically press the correct taskbar button to return the focus back to PPt.
Any ideas?
Resolved - Give Focus To A Tab
I have an SS tab strip on a form. How do I give focus to the 3rd tab when an event occurs, ie a command button is pressed?
Also can I disable a single tab as the enabled property applies to all the tabs?
Give Back Focus
I have a form running as always on top (set that way using api). I show and hide this form using the standard, me.show or me.hide. Whenever I show the form it takes the focus from whatever app is being used. I have tried everything from standard vb calls to api calls trying to give the focus back to the last used app. I even resorted to using SendKeys with Alt Tab key combo, but that turned out to be unreliable (as it should be).
Is there any good way to get focus back to the last used application?
Thanks.
Give A Label The Focus
I need to make some labels work like a combination of option buttons and check boxes (don't ask).
I've got it working, except for the fact that the labels can't receive focus.
I really don't need them to have the focus, BUT, I would like to focus to leave the previous control when I click on the label.
Ideas on the best way to do this? Should I put the labels in a picturebox or something, and give the picturebox the focus if the user clicks a label?
Thanks,
Elizabeth
Give Focus To MDIChild From Different App.
Hi everyone,
What I'm trying to do isss. Give an MDIChild window keyboard focus by hwnd.
This MDIChild isn't part of my application.
Therefore SetFocus api won't work.
ie:Code:Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As LongCode:The SetFocus function sets the keyboard focus to the specified window. The window must be associated with the calling thread’s message queue.Any idea's ? Tried using SendMessage to send a WM_SETFOCUS.. That was a no no..
Same for api SetActiveWindow. Window must be associated with the calling thread's message queue.
Tried sending a WM_CHILDACTIVATE no go...
Can I use WM_ACTIVATEAPP ? Don't have vb here to try, but can't stop thinking.
So I'll try it when I get home. The exact situation is hard to explain sorry.
Any input is greatly appreciated....
Thanks
$hep
Give App Maximized Focus
I am using the following code (that was posted yesterday) to open a specific access report. The part I'm hung up on is getting the report in Access to have the maximized focus. Can the Shell Function be used for this? I tried using it to launch Access and have it maximized, but not to open a specific report.
Any help is greatly appreciated.
public Sub RunReport(strDatabase as string, strReport as string)
Dim dbAccess as Object
on error GoTo ErrorHandler
set dbAccess = new Access.Application
dbAccess.OpenCurrentDatabase strDatabase
dbAccess.DoCmd.OpenReport strReport, acPreview
dbAccess.DoCmd.Maximize
set dbAccess = nothing
Exit Sub
ErrorHandler:
If Err.Number = 2501 then resume next
End Sub
Can't Give Focus To The Form
Hi, someone gave me the very helpful code below for assigning arrow keys to functions in a program. It works great in isolation, but when I loaded it into my program with buttons on the form the buttons always take focus instead of the form itself. Therefore pressing the arrow buttons simply scrolls through the button focuses instead of triggering the Msgboxes that are indicated in the code. I tried adding KeyAscii = 0 before the select case but no avail. Form's KeyPreview property is set to TRUE. This is such a simple matter in PERL (just a single "bind" command), but it seems to be a nightmare in VB. Thanks for your help.
private Sub Form_KeyUp(KeyCode as Integer, Shift as Integer)
Select Case KeyCode
Case vbKeyLeft
Msgbox "You pressed left"
Case vbKeyRight
Msgbox "You pressed right"
Case vbKeyUp
Msgbox "You pressed up"
Case vbKeyDown
Msgbox "You pressed down"
Case else
Msgbox "You pressed another key"
End Select
End Sub
Give A New Word.Application The Focus
How do I give my new Word.Application the focus. This code only runs word in the background:
Dim wrd As Word.Application
Set wrd = New Word.Application
wrd.Documents.Open filename
Can't Give Textbox On Another Form Focus
I get an "Invalid procedure call or argument" error on line
frmForm1.Text1.SetFocus
Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
msh.Rows = 0
lst1.Clear
lst2.Clear
If gCalledForm = "frmForm1" Then
frmForm1.Text1.SetFocus
ElseIf gCalledForm = "frmForm2" Then
frmForm2.Text2.SetFocus
End If
gCalledForm = vbNullString
Unload Me
End Sub
How can I give the Textbox focus on these forms when closing another form?
Thanks
How To Load A New Form - But Not Give It Focus?
Anyone know?
If I wanted to show form2, like a regular form but not give it focus.. how can I do that?
form2.show, form1.setfocus
is not an option because i have like 10 windows and i dont want form1 getting focus when form3 has current focus (for example)
How To Show A New Form, But Not Give It Focus?
Dim frm as Form
frm.Show
that shows the form, but gives it focus
Dim frm as Form
Load frm
that does not show the form, (thus does not give it focus)
How can you show a form and not give it focus?
How Do I Give MSFlexGrid Focus Programmatically?
I have a form with a tab control, a separate MSFlexGrid control sits on each tab.
I have coded the FlexGrids to understand the Right Mouse button, so that the user can navigate by both buttons and use the Right Mouse to "pop up" other forms based on the values in the grid. Left Mouse is basically used for data entry...
My problem is this: Upon loading the form or tabbing between the different MSFlexGrids; only the left mouse button will give the MSFlexGrid its initial focus. Right click will not respond at all until a Left-click has occurred. So, the user has to Left-Click then Right-Click the first time that they need to use the Right Mouse button.
I'd like the grid to respond to the right click immediately upon opening the form or selecting the tab. Right now I've faked it out by Hooking the Mouse event and sending a left click to the grid...but that gets me into a whole host of other problems...usually when that happens, I know I'm doing it the hard way. What is the easy way to do what I need to do?
Thanks,
MagicT
Give Focus To Winamp Window
I would like to know how to give focus(Higlight) Nulsoft's Winamp window with its ever changing caption...
Any Help?
Andy
Give My Application The Focus At Startup
I'm having a problem giving my application the focus at startup. One of my aims is to not allow the user to see any part of windows in the background. As such my application runs first in the registry. However, following this explorer.exe runs and causes my app to lose the focus. Another part of my app is that the touch screen is disabled, meaning the user is stuck. I have tried me.focus after a nominal 10 seconds to no avail. What can I do?
Help!
Thanks,
Tim
Find And Give Focus To Another Applications Window
I have an application that has 2 full screen report windows open.
lets say "Report A" and "Report B" are the window titles.
I need to have a simple program that swaps between the two windows every 10 seconds.
Any help is appriciated
Thank you
garrett
I Need To Highlight Some Text, But Give Focus To Another Form.
Hi, I need to highlight some text in a textbox but have focus on a different form. If I just select the text in the textbox and then say Form2.SetFocus, the selection is no longer visible. Does anybody now how to get around that?
Thank you in advance
Give Added Lines To A Multline Textbox Focus?
hey guys I use this code to add new lines to my text10 textbox.
Text10.Text = Text10.Text & vbNewLine & "Scanning in progress...Please Wait.."
But what happens is after so many lines are added, I have to scroll down to see them, is there a way so when a new line is added the user can see it, like the textbox will auto scroll to it or something?
Thank you.
Inputboxes
I know how to create an input box, i've never dealt with these before though, How can i send the text from the inputbox/boxes, to a listbox after pressing ok.
Inputboxes On A Dialogsheet?
Is there a way to put inputboxes on a dialogsheet? Or, is there a way to display two inputboxes together? Here is why I am asking:
I have my workbook set up to save the file with a unique filename based on information that the user has entered in two different cells. I have also set up an Auto_Close sub that checks to see if they have entered any information on the Input Sheet (one of my worksheets), and, if they have, then it attempts to save it under that unique filename, then reset everything on the Input Sheet to its default, and saves it as my original filename (that way, even if somebody finds a way to accidentally save over my original file, when they close Excel, it will be reset to the way it should be).
In my Auto_Close sub, it first checks to see if they have changed anything on the Input Sheet. If they have, then it checks to see if the two cells that contain the information used for the unique filename have been filled in. If those two cells have not been filled in, then it brings up an inputbox to allow the user to enter that information. I am looking for a way to bring up both of those inputboxes together. At the moment, I have it set up to display a message box that tells the user they didn't enter the appropriate information, then it brings up an inputbox for them to enter data for the first empty cell, and then it brings up an input box for them to enter data for the second empty cell.
However, I realized that I may be able to bring up all three of those things together, instead of bringing up three separate boxes. I tried to alter the code that I have set up for my print function (creates a dialog sheet, and adds checkboxes for each visible worksheet in my workbook, then lets the user check off the worksheets they want to print, then deletes the dialog sheet). However, when I altered it to work with this new situation, I found out that VBE apparently does not recognize "InputBox" or "InputBoxes" the way it recognizes "CheckBoxes". Here is an excerpt of the script I am currently using when the user tries to close the workbook:
Code:
If ThisWorkbook.FullName = strLocName Then
If strMyRange <> "" Then
If strMyRange2 <> "" And _
strMyRange3 <> "" Then
SaveContractAs
MakeSheetsVisible
Worksheets("InputSheet").Range(myRange).ClearContents
ResetAllBoxes
ActiveWorkbook.SaveAs FileName:=strLocName, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ElseIf strMyRange2 = "" And _
strMyRange3 = "" Then
Response = MsgBox("You have not entered a service property address." & Chr(13) _
& "In order to save this contract, you need to enter the Street Number and the Street Name." _
& Chr(13) & "If you click 'Yes', you will be prompted to enter the street number, and then the street name." _
& Chr(13) & "If you click 'No', this contract will not be saved.", vbYesNo, "No Save Name")
If Response = vbYes Then
StreetNo = Application.InputBox(prompt:="Please Enter a Service Property Street Number:", _
Title:="Service Property Address Missing", Type:=1)
myRange2.FormulaR1C1 = StreetNo
StreetName = Application.InputBox(prompt:="Please Enter a Service Property Street Name:", _
Title:="Service Property Address Missing", Type:=2)
myRange3.FormulaR1C1 = StreetName
SaveContractAs
ElseIf Response = vbNo Then
MakeSheetsVisible
ActiveWorkbook.SaveAs FileName:=strLocName, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End If
ElseIf strMyRange2 = "" And _
strMyRange3 <> "" Then
Response = MsgBox("You have not entered a service property address." & Chr(13) _
& "In order to save this contract, you need to enter the Street Number." & Chr(13) _
& "If you click 'Yes', you will be prompted to enter the street number." & Chr(13) _
& "If you click 'No', this contract will not be saved.", vbYesNo, "No Save Name")
If Response = vbYes Then
StreetNo = Application.InputBox(prompt:="Please Enter a Service Property Street Number:", _
Title:="Service Property Address Missing", Type:=1)
myRange2.FormulaR1C1 = StreetNo
SaveContractAs
ElseIf Response = vbNo Then
MakeSheetsVisible
ActiveWorkbook.SaveAs FileName:=strLocName, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End If
ElseIf strMyRange2 <> "" And _
strMyRange3 = "" Then
Response = MsgBox("You have not entered a service property address." & Chr(13) _
& "In order to save this contract, you need to enter the Street Name." & Chr(13) _
& "If you click 'Yes', you will be prompted to enter the street name." & Chr(13) _
& "If you click 'No', this contract will not be saved.", vbYesNo, "No Save Name")
If Response = vbYes Then
StreetName = InputBox("Please Enter a Service Property Street Name:", _
"Service Property Address Missing")
myRange3.FormulaR1C1 = StreetName
SaveContractAs
ElseIf Response = vbNo Then
MakeSheetsVisible
ActiveWorkbook.SaveAs FileName:=strLocName, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End If
End If
ElseIf strMyRange = "" Then
MakeSheetsVisible
ActiveWorkbook.SaveAs FileName:=strLocName, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End If
strLocName is a string variable defined as the path and filename of my workbook (that particular variable is used when the workbook is saved on my computer. I have another variable set up the same way that is defined as the path and filename when it is stored on the network drive at our office).
strMyRange, strMyRange2, and strMyRange3 are string variables that are defined as the three different ranges of cells that I am checking. strMyRange incorporates all of the cells that the user is able to alter within the workbook. strMyRange2 is defined as the first cell that contains information needed for the unique filename. strMyRange3 is defined as the second cell that contains information needed for the unique filename. I stored these as strings because I could not figure out any other way to determine whether or not there was anything in those cells.
myRange is a range variable that contains the same cells as strMyRange, but it's stored as a range, so that I can clear everything out of those cells.
myRange2 and myRange3 are also range variables that contain the same cells as strMyRange2 and strMyRange3, but they are stored as range variables so that I can use the input box (along with FormulaR1C1) to insert the answer from the input box into those cells.
Anyway, this is the script that I was trying to write to accomplish essentially the same goal, but I found that VBE doesn't seem to allow you to add InputBoxes. I am not very far on this script, but I thought I would post it so that you can see that I am trying.
Code:
Sub Testing()
Dim TopPos As Integer
Dim SaveDlg As DialogSheet
Dim CurrentSheet As Worksheet
Application.ScreenUpdating = False
' Check for protected workbook
If ActiveWorkbook.ProtectStructure Then
MsgBox "Workbook is protected.", vbCritical
Exit Sub
End If
' Add a temporary dialog sheet
Set CurrentSheet = ActiveSheet
Set SaveDlg = ActiveWorkbook.DialogSheets.Add
SheetCount = 0
' Add the checkboxes
TopPos = 40
SaveDlg.InputBox.Add 78, TopPos, 150, 16.5
SaveDlg.InputBoxes(1).Text = _
"Please Enter the service property street number"
TopPos = TopPos + 13
SaveDlg.InputBox.Add 78, TopPos, 150, 16.5
SaveDlg.InputBoxes(2).Text = _
"Please Enter the service property street name"
' Move the OK and Cancel buttons
SaveDlg.Buttons.Left = 440
' Set dialog height, width, and caption
With SaveDlg.DialogFrame
.Height = Application.Max _
(68, SaveDlg.DialogFrame.Top + TopPos - 34)
.Width = 430
.Caption = "Service Property Address"
End With
' Change tab order of OK and Cancel buttons
' so the 1st option button will have the focus
SaveDlg.Buttons("Button 2").BringToFront
SaveDlg.Buttons("Button 3").BringToFront
' Delete temporary dialog sheet (without a warning)
Application.DisplayAlerts = False
SaveDlg.Delete
End Sub
I apologize for the length of my script. I have tried to cut it down as much as I can, but I am still a beginner, and haven't quite figured out all of my options yet.
Inputboxes And Reporting
i have this inputbox where the user enters a number and the number is then reported out to a cell in excel. I have coded this bit up and looks Ok and works fine.
However the problem is that when the user enter a number to 2 decimal places eg 25.73 it reports 26 in the cell.
Why does it do this. Anyway of reporting number to two d.p.
Thanks
Inputboxes And Cancel
Here's my code:
Dim TempStore As Integer
.
.
.
TempStoreb = InputBox("Enter book number", "Add Book", "000000", 1000, 1000)
When I click cancel instead of entering a value, it gives a Type Mismatch error!
What does "Cancel" return, and how can I avoid this problem?!
Question About Inputboxes.
Hi,
I'm very new to Visual Basic. I'm making a program that displays the name in this input box < InputBox("What is your Name?" ) > into a property < lblName.Caption >
How exactly do i do this? I"ve been fooling around, and still can't figure it out :. Any tips?
Thanks
Inputboxes And Strings
Using a input box I recieve a number from the user. The user input is an integer data type. It works find until the cancel button is clicked. The reason is that if gives a nothing string. Do I need to use a variant data type instead of an integer type. Zero is a choice as well.
Passwords && Inputboxes
is it possible to display asterisks in an inputbox instead of characters, ie to hide a password?
thanks
Passwords In Inputboxes
Im making a program, and i need the user to insert a password into an inputbox.
How can I make it so that the password comes up as *'s on the screen, but vb still recognises it a the correct password?
If u can help me, please do!
Message- And Inputboxes
Hi all!
I have an application which is running in the background of another program, and checks the validity of values entered in the (foreground) program. If an invalid value is entered a messagebox or an inputbox is displayed.
Recently I converted the code of the background app from VB 4.0 (16 bit), to VB 6.0 .
My problem is that after this conversion, all the input- and message-boxes are displayed behind the foreground app!!
Is there any way I can force them to appear in the foreground of the screen?
Any API-calls maybe?
Please help!!
Regards Pulp
Reading InputBoxes From Websites
How can I read/write Text from/to InputBoxes of Websites
without MS InternetControls ?
I mean with an opened Website in an Ineternetexplorer.
Displaying Lists In Inputboxes
I am currently writing a script for QuickTest Professional, which utilizes VB script. I am trying to utilize the Inputbox function to display a list of items from within an array, can this be done?
Example: I want the user to be able to select from a numbered list stored in an array (userarray [ "1. one", "2. two"] etc. I will utilize the number input for a variety of other operations.
Should Be A Simple One For You Guys - InputBoxes...
I wish a user to enter a numerical value into an inputbox. Here is my code...
Dim intwager as integer
intwager = InputBox("How much would you like to bet?")
Do While ((intwager <= 0) Or (intwager > Val(lblCredit.Caption)))
If intwager <= 0 Then
intwager = InputBox("Invalid amount. How much would you like to bet?")
Else
intwager = InputBox("You do not have enough credit to bet this amount. How much would you like to bet?")
End If
Loop
txtWager.Text = intwager
Now, as I've declared intwager as an integer then if the user types in a non-numerical value as the bet, the program will return an error. I do want the user to be prompted that this is incorrect, but wish to add code to show another input box prompting the user to re-enter an amount, rather than a runtime error.
Can anyone suggest how I should alter my code above?
WinSock And InputBoxes/msgbox
Situation:
An InputBox or a Msgbox is displayed to the User...
The program recieves data to its winsock...
And I get a Run-Time error '401' Cant Show non-model form when model form is displayed
End Situation
Whats being recieved by the winsock is telling the program to show a new form (form2.show) and I think this is giving the error.
Any suggestions on what is causing this or better yet what the solution is?
Thanks for your help
-adamas
InputBoxes Nș Of Characters Limited?
Hello my dear friends
Thas right, that's my question. Is the nș of characters limited on a InputBox?
In my application I want to put (or should I say Input?) a large sentence but it not allows me to do so.
Can somebody help me?
Can I change this?
Thanks
Inputboxes / Change Text Files Via Gui
Hello, im working on a gui based configuration chager for a little game.
What i need help with is following:
You start the program, click on Setup configs (working fine)
then a new form (configs) starts up(working fine)
then it has a lot of "boxes" where you can insert something into. like
"Max number of players allowed, please enter a value between 1-32 for this to work." and you got your box where you enter >8<
"Starting money, please enter a ammount between 0 - 16000" box >1000<
what im wondering is, how would i make it open lets say c: estconfigsstarting.conf, and find like "max number of players allowed, and then change the number (could be the whole line, but the it would require the entered value + the line (max players = 8 so it doesnt just delete max players = 16 and place a "8" am i making sence?). then it should save the changes all at the same time when you click "Change now!" is this even possible? if you guys need more info, please let me know. Any help appreciate. thank you
// this is for vb6.0
Finding Average Of Data Entered In InputBoxes **RESOLVED**
- I have 5 InputBoxes come up on the Form_Load..
- I enter a number(exam score) into each InputBox..
- After clicking 'OK' on the 5th InputBox I want a MsgBox to say "The Average Exam Score is: XX"
Now, the question is... how would I take each response from each InputBox, add them all up, and divide them by 5 (find the average)????
Code:
Dim QuesNum%, Question$, Response$
'Dim Average As String
'Dim I As Integer
Private Sub Form_Load()
For QuesNum% = 1 To 5
Select Case QuesNum%
Case Is = 1
Question$ = "Enter exam score #1:"
Case Is = 2
Question$ = "Enter exam score #2:"
Case Is = 3
Question$ = "Enter exam score #3:"
Case Is = 4
Question$ = "Enter exam score #4:"
Case Is = 5
Question$ = "Enter exam score #5:"
End Select
Response$ = InputBox(Question$, "Exam Scores")
Next
'MsgBox
End Sub
Edited by - justin28098 on 2/14/2004 10:44:41 AM
Maintain Line Of Focus After Focus Is Lost On A Listbox ?
I have two listboxes on my firm.
In the first, one selects which Report DLL to use, and then when that is selected, my app creates a new instance of that DLL and loads up all available reports into the second listbox.
So you click on the first listbox, and the blue line select thang goes across that line to show you have selected something.
Just like any other listbox does.
But then you select an item for the second listbox, and the blue line disappears from the first listbox.
So when you're looking at the screen, if you don't remember which DLL you selected, you wouldn't actually know which DLL the second box is referring to.
Ideally the first listbox should retain that blue line while at the same time the second listbox should aswell.
Any thoughts ?
Form Got Focus Or Lost Focus Don't Work
Hi, I have a form that I can't get the Lost Focus or Got Focus events to fire, would anybody know why?
Here is what I am trying to accomplish. I have an .exe vb6 application(MainApp) that opens another .exe vb6(ChildApp) application using the shell command. The main application has a list view with a bunch of records. The ChildApp is used to Insert, Delete or UPdate records from the MainApp. So when an Insert, Update or Delete take place on the Child App, I'd like to refresh the listview on the MainApp because the records have changed. How can I accomplish this? Is there a way to call the form in the Main Application from the Child Application even they are 2 different .exe files? I really need help on this please.
Excel TextBox Font Changes When In Focus And Out Of Focus??
Hi All,
I am using a TextBox within an Excel Sheet and did set the font property to "Terminal" with size 22. When in focus, it seems to be OK but when I click somewhere else in the spreadsheet (TextBox losing focus) the font change. Why is that? I want the font to be the same in-focus or out-of-focus. Any help would be greatly appreciated. I have been playing with this for a while but could not figure it out. By the way, I am using Office 2003.
Thank you.
Charles
SendKey To A Window NOT In Focus - But Keep Focus?
Fyi, I'm fairly new to VB.
Anyway, to the point.
I have two applications, both running in full screen.
What I want to accomplish is that while one of the applications are running in focus (full screened), I want my VB program to run in the background and send a key on a regular basis to the other application (the one that is NOT in focus) without having to tab out of the focused application.
I managed to achieve some of this partly with the help of FindWindow and ShowWindow:
Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_NORMAL = 1
Private Const SW_MAXIMIZE = 3
Private Const SW_SHOW = 5
Private Const SW_MINIMIZE = 6
Private Const SW_RESTORE = 9
Dim hinst As Long
Dim hinst2 As Long
hinst = FindWindow(vbNullString, "PrgNotInFocus") ' The program that should not be in focus, but have keys sent to
hinst2 = FindWindow(vbNullString, "PrgInFocus") ' Should be in focus at all times
If Not IsNull(hinst) Then
ShowWindow hinst, SW_NORMAL
SendKeys (1)
ShowWindow hinst, SW_MAXIMIZE
End If
This allows me to bring forth the window that I don't want in focus and "makes it press 1".
But that's hardly the effect I'm looking for, since it:
-Tabs out of my current application and focuses the wrong one
-Requires the window I want to SendKeys to to be focused
Suggestions?
Get Focus Lose Focus (ASAP)
Hello I have a program that Gets the focus of a text box on intervals and need to "reset" the focus to the application that had the focus before i took it.
For an example:
I am useing internet explorer and the application gets the focus of the text box in my application then i want to "reset" the focus back to internet explorer !
ANY HELP WANTED AND NEEDED
Sorry Vikarmji - Still The Focus Goes There.Focus In Flexgrid - Pls Help Me
HI,
My Flexgird contains 32 rows and 5 columns. Focus should not go to specific rows.Iam using the following code
Private Sub Msflexgrid_SelChange()
With MSflexgrid
If .Row = 1 Or .Row = 11 Or .Row = 21 Or .Row = 26 Or .Row = 2 Or .Row = 12 Or .Row = 22 Or .Row = 27 Then
.FocusRect = flexFocusNone
Else
.FocusRect = flexFocusLight
End If
End With
End Sub
But it is not working properly.
Thanks in Advance
Dorathy
Edited by - dorathy_sylvia on 3/1/2005 8:37:41 PM
Can Someone Give Me An Example
hey all
I have a plan to create a simple game. The game that I want to build
just display text,text...and text. So this game use database I think.
Can someone give me an example the game like that? I've searched in
this forum but the game is not like this. I see in this forum Many discussion is about animation game.
What kind of game that I'm tryng to create? Because I don't know.
At least just wondering,
What game are u playing now?
or what is the best game now? (You think)
thanks a lot
How To Give A Name
Hello,
How can I give (with VB6.0) the name "TEST" on an Excel sheet - cel B2
ActiveWorkbook.Range("B2").AddName = "TEST" doesn't work.
Thanks.
Can Someone Plz Give Me An Example..
plz can somebody give me an example of how the:
KeyDown
KeyUp
KeyPress
procedures work, because im not quite sure how to use them properly
thanks for any help
I Am AbOUt To GivE UP!!!
I have been trying to do this code for over ..a month i would say..i dont even know what is wrong with the code i am trying to do i sent it to my freinds and they said it was fine...to top it off my dad formatted my hard drive without me knowing..I no longer have the code that i nwas working on for 3 weeks or more (which doesnt work anyway)....please sum1 help me if u cant ill just give up and pray my grade stays at a C rather than drop to a D..(i was hoping for a B because i have a high C..but..oh nevermind lets not get personal problems involved with this) please help!
heres what i am trying to do....
Store the name and Daily school schedule of Students at Roosevelt High Schoolin a random file.Each Record contains the student's name and period number and title of each course the student takes (the teacher told me to assume all students take the same number of courses). Allow the user to A.) change items in the file B.)delete items C.)add new students or D.)obtian a listing of the file.
according to the teacher this is an easy project ..and i agree it is...But what he doesnt undersatnd is i had hepitites A and was out when he explained how to make your own data type.I still manged to figure it out tho!!!!!
PLEASE HELP SOMEBODY
|