Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I must be crazy....

Status
Not open for further replies.

dbrooks74

Programmer
Nov 13, 2001
105
US
I'm trying to use the tasks option in visual basic. Another words I'm adding a reference to microsoft office 97, and then using the following statements that checks to see if a certain program is running, then changes that program if it is running to be the active window by chaning the window state.

The problem is...."This only works when a word project is open" Am I on crack or what? Is there some way to do this without word running? Thanks very much. -db

If Tasks.Exists("TAMC") = True Then
If Tasks("TAMC").WindowState = wdWindowStateMaximize Then
Tasks("TAMC").WindowState = wdWindowStateNormal
Tasks("TAMC").WindowState = wdWindowStateMaximize
Else
Tasks("TAMC").WindowState = wdWindowStateMaximize
End If
Else
MsgBox "Cannot find TAMC"
Exit Sub
End If
 
some of those api calls work with handles, and some work with task id's. this complicates matters greatly. you'll have to check out setwindowpos and bringwindowtotop along with openprocess to work with window handles. if you try to send messages via the windows api message system, you'll run into problems since they need handles, but vb uses task ids when launching from the shell command. also, there are some constants which you'll need to get, such as sw_show and others, to work with these functions. good luck, and may the force be with you ( you'll need it...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top