Click here to Skip to main content
16,008,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCall establishment from PC to phone using TAPI3.0 Pin
24-Jun-02 4:37
suss24-Jun-02 4:37 
GeneralRe: Call establishment from PC to phone using TAPI3.0 Pin
Michael P Butler24-Jun-02 4:49
Michael P Butler24-Jun-02 4:49 
GeneralBring An Application To The Foreground Through Another Application Pin
Dean Michaud24-Jun-02 4:30
Dean Michaud24-Jun-02 4:30 
GeneralRe: Bring An Application To The Foreground Through Another Application Pin
Michael Liu24-Jun-02 4:44
Michael Liu24-Jun-02 4:44 
GeneralRe: Bring An Application To The Foreground Through Another Application Pin
Dean Michaud24-Jun-02 4:58
Dean Michaud24-Jun-02 4:58 
GeneralRe: Bring An Application To The Foreground Through Another Application Pin
David Viggiano24-Jun-02 6:03
David Viggiano24-Jun-02 6:03 
GeneralRe: Bring An Application To The Foreground Through Another Application Pin
Dean Michaud25-Jun-02 6:09
Dean Michaud25-Jun-02 6:09 
GeneralRe: Bring An Application To The Foreground Through Another Application Pin
Dean Michaud24-Jun-02 7:57
Dean Michaud24-Jun-02 7:57 
Ok, after mucking around with this a little more, seems this is *one* way of getting the job done.

I am calling this code once a button is pressed to bring up an application to the foreground.

1) CWnd::FindWindow() finds the window based on the file name.
2) CWnd::SetWindowPos() shows the found window as on top, without resizing it or moving it.
3) CWnd::ShowWindow() is making sure the application is not minimized/maximized.

BOOL rc;

CWnd* my_wnd = FindWindow(NULL, "Application-Name");

if (my_wnd != NULL)
{
    rc = my_wnd->SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_SHOWWINDOW);

    rc = my_wnd->ShowWindow(SW_SHOWNORMAL);
}

What I'd like to know is another way of getting the CWnd pointer to the window - I don't like writing code that depends on another applications having the same title (it very-well could change without me knowing, either by the dept. that wrote the code changing it and forgetting to notify me, or someone's changing the title of it for some purpose of their own).

So, now my search moves onto looking for another way of finding a specific window that is running since FindWindow() relies on the window title not changing.

: Dean 'Karnatos' Michaud
GeneralRe: Bring An Application To The Foreground Through Another Application Pin
Scott H. Settlemier27-Jun-02 9:55
Scott H. Settlemier27-Jun-02 9:55 
GeneralHooking BN_CLICKED Pin
zerver24-Jun-02 4:19
zerver24-Jun-02 4:19 
GeneralRe: Hooking BN_CLICKED Pin
David Viggiano24-Jun-02 6:10
David Viggiano24-Jun-02 6:10 
GeneralRe: Hooking BN_CLICKED Pin
zerver27-Jun-02 1:19
zerver27-Jun-02 1:19 
GeneralGhost windows in XP. Pin
Michael Liu24-Jun-02 4:16
Michael Liu24-Jun-02 4:16 
GeneralRe: Ghost windows in XP. Pin
Jason Henderson24-Jun-02 6:08
Jason Henderson24-Jun-02 6:08 
GeneralRe: Ghost windows in XP. Pin
Michael Liu24-Jun-02 8:01
Michael Liu24-Jun-02 8:01 
GeneralRe: Ghost windows in XP. Pin
Michael Liu25-Jun-02 7:24
Michael Liu25-Jun-02 7:24 
GeneralRe: Ghost windows in XP. Pin
Michael Liu25-Jun-02 7:24
Michael Liu25-Jun-02 7:24 
GeneralRe: Ghost windows in XP. Pin
Michael Liu25-Jun-02 7:24
Michael Liu25-Jun-02 7:24 
GeneralRe: Ghost windows in XP. Pin
Michael Liu25-Jun-02 7:25
Michael Liu25-Jun-02 7:25 
GeneralRe: Ghost windows in XP. Pin
Michael Liu25-Jun-02 7:25
Michael Liu25-Jun-02 7:25 
GeneralQuick regular expression question pls Pin
jkgh24-Jun-02 4:02
jkgh24-Jun-02 4:02 
GeneralProblems with the length of the text of a CListCtrl item Pin
Grit24-Jun-02 3:42
Grit24-Jun-02 3:42 
GeneralHtml control Pin
rrrado24-Jun-02 3:01
rrrado24-Jun-02 3:01 
GeneralRead-only CRichEditView Pin
24-Jun-02 2:03
suss24-Jun-02 2:03 
GeneralCopying data from one database to another Pin
24-Jun-02 2:00
suss24-Jun-02 2:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.