Results 1 to 4 of 4

Thread: Execute ANY filetype/program and set start up propeties [Resolved]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Resolved Execute ANY filetype/program and set start up propeties [Resolved]

    Hey, i want to know how to start a program (or a file) and set the program's windows startup parameters. For example, i want to start a program and set it to a certain place on my screen when it loads, this has to eb any program. I also want to be able to keep it either normal or minimized. I don't want the program to be able to make it self full screen (that's not maximized). Unless i let it while it starts up. What i'm trying to do it prevent a game from going full screen, so that i can do other things while i'm playing it. But i'm making a program that does a wide range of games, not just for this 1 in paticular.

    I have tried to get the window handler by:
    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
    2. ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    3.  
    4.  
    5. Private Sub mExecuteProgram_Click()
    6.  
    7. If ProgramLst.ListIndex = -1 Then Exit Sub
    8.  
    9. Const SW_SHOW = 5
    10.  
    11. hWndLst(ProgramLst.ListIndex) = ShellExecute(Me.hwnd, "open", ProgramLst.Text, vbNullString, vbNullString, SW_SHOW)
    12.  
    13.  
    14. End Sub
    ProgramLst is a list box with saved program paths.
    I've read that this is how to get the window handler from a program you'e executed... But it keeps returning 2.

    Also i need to know how to manipulate the window once i get the handler sorted out.

    Thank you.
    Last edited by Hack; Apr 26th, 2006 at 06:58 AM. Reason: Added green "resolved" checkmark

  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: Execute ANY filetype/program and set start up propeties

    Or at least a web page or previous post... I've looked and i can't find...

  3. #3
    Super Moderator RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,713

    Re: Execute ANY filetype/program and set start up propeties

    You will need a few more APIs.

    The FindWindow and SetWindowPos or SetWindowPlacement.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2005
    Posts
    540

    Re: Execute ANY filetype/program and set start up propeties [Resolved]

    Thanks for that!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width