Results 1 to 13 of 13

Thread: [RESOLVED] AppActivate in C#

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,077

    Resolved [RESOLVED] AppActivate in C#

    What's the equivalent of it in C#? I tried searching but to no avail...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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

    Re: AppActivate in C#

    You could add the using Microsoft.VisualBasic; in the declarations section of your class. Then you will see the tooltip declaration just like before.
    VB Code:
    1. using Microsoft.VisualBasic;
    2.  
    3. '...
    4. '...
    5. AppActivate("VBForums - AppActivate in C# - Microsoft Internet Explorer");
    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

  3. #3
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,897

    Re: AppActivate in C#

    There is no equivalent, as there isn't to any VB.NET Runtime functions. If there was a System-based equivalent then we'd all be using it in VB.NET too. I'd guess that AppActivate wraps the SetForeGroundWindow API (amongst others), because that's the only way to do it that I'm aware of in C#, short of what Rob suggested.

    BTW Rob, you'd better hope that wossname doesn't see that post.

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

    Re: AppActivate in C#

    Oh, he wont. Remember that he got himself Banned.

    Plus, I did post that "you could" do it that way.
    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

  5. #5

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,077

    Re: AppActivate in C#

    Hmmmnnn... That's what I am afraid of, to resort to Microsoft.VisualBasic in C#... Will look into those API thingy first... Thanks guys!
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  6. #6
    Lively Member
    Join Date
    Jan 2006
    Posts
    121

    Re: AppActivate in C#

    I assume your trying to send text to a window.....
    This maybe what your looking for. Just change the class window to whatever your sending text to

    http://www.vbforums.com/showthread.php?t=380589

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: AppActivate in C#

    Quote Originally Posted by RobDog888
    You could add the using Microsoft.VisualBasic; in the declarations section of your class. Then you will see the tooltip declaration just like before.
    VB Code:
    1. using Microsoft.VisualBasic;
    2.  
    3. '...
    4. '...
    5. AppActivate("VBForums - AppActivate in C# - Microsoft Internet Explorer");
    You should be ashamed of yourself for even thinking that in the c# forum. If I had a sceptre, I'd banish you from this forum for a complete 19 minutes.

  8. #8

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,077

    Re: AppActivate in C#

    SetForeGroundWindow works if the app is not minimized, any tips on how to get it done when the app is minimized?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  9. #9
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,897

    Re: AppActivate in C#

    I would guess that you would have to use SetWindowPlacement to restore the window first, then call SetForegroundWindow to activate it. I've never used SetWindowPlacement though so I'm not 100% sure. Note that AppActivate will not restore a minimised window either.

  10. #10

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,077

    Re: AppActivate in C#

    Thanks 'spammer' , will dig into it...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  11. #11
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    Re: AppActivate in C#

    You ever use Lutz Roeder's Reflector? I'm not sure if it's legal, so I won't post the code for AppActivate, but if you download the freeware, you can check out the code that makes up that method It's not trivial.

    Mike

  12. #12
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: AppActivate in C#

    I have that issue before dee-u. Try to visit this link it works in my machine.
    http://vbforums.com/showthread.php?t...light=activate

  13. #13

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,077

    Re: AppActivate in C#

    Quote Originally Posted by mar_zim
    I have that issue before dee-u. Try to visit this link it works in my machine.
    http://vbforums.com/showthread.php?t...light=activate
    Thanks mar_zim...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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