|
I think will work just try...!
DWORD dwMyProcessId,dwCurProcessId;
dwMyProcessId = ::GetWindowThreadProcessId( hWnd, 0 );
dwCurProcessId = ::GetWindowThreadProcessId( ::GetForegroundWindow(), 0 );
if ( dwMyProcessId != dwCurProcessId )
{
AttachThreadInput( dwCurProcessId,dwMyProcessId,TRUE );
}
::SetForegroundWindow( hWnd );
Regard's
Dhana
|
|
|
|
|
Is this of any help?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks everyone - yet again!
Thanks esp to David for the link - tried the code and that sorted it
I did try the SetWindowPos(...), but this didnt seem to work. I did change the parameter HWND_TOP, to HWND_TOPMOST, and this sort of worked. The window stopped being minimized on the tool bar, but didnt get the focus. It also remained un-minimized(?), when other apps were clicked on.
Davids solution did exactly what I wanted. The reason behind doing this is that I have an old dos app running that uses up a lot of resources, when it has the focus. The win32 app outputs audio out of the soundcard,and if it doesnt have the focus, it causes delay and\or stuttering to occur. Once it has the focus, all is well with the world! By doing as David suggested, it causes the audio issue to go away!
Thanks again
Mike
|
|
|
|
|
Hi all, i have pop up messages same as in msn messenger "the user XXXX has logged in".
problem is that these dialogs (which inherites from CDialog) takes all the focus as soon as they popup. if i have in the main application a menu opened or i type something in an edit control, they immediately lose the focus
how can i fix that?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
YaronNir wrote: problem is that these dialogs (which inherites from CDialog) takes all the focus as soon as they popup. if i have in the main application a menu opened or i type something in an edit control, they immediately lose the focus
how can i fix that?
return FALSE instead of TRUE from OnInitDialog function of the Dialog Box!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
excellent! worked like a charm!
thanks a lot
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Iwant to change any size of a window by the mouse. How can i set it???
|
|
|
|
|
see SetWindowPos() and MoveWindow()
|
|
|
|
|
you can use MoveWindow in WM_SIZE
|
|
|
|
|
Adding the correct window style (like WS_THICKFRAME ) to the window will generally allow it to be sized via the mouse. Once it is sized by the user, you will have to reposition and resize any controls within that window yourself by handling the WS_SIZE message.
Things like SetWindowPos(...) and MoveWindow(...) allow you to change the size of a window/control in code, not by mouse.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Can we read the pixel values of a text file and make a bitmap from that data.
Is there any way for this?
Thank you.
KIRAN PINJARLA
|
|
|
|
|
use CreateDIBitmap or CreateBitmap
Regard's
Dhana
|
|
|
|
|
A text file has no pixel values, only text.
Do you mean that you want to take the contents, such as "Hello, World" and generate a bitmap image of that text using a particular font and size?
Steve S
Developer for hire
|
|
|
|
|
Can you be more specific a text file is text I think you need to read text file and create a bitmap for it
|
|
|
|
|
hello
i am working with automation in vc++6.0 .Can anyone tell me about how can i transfer bitmap images in the MS word using automation from my VC++6.0 application.If someone have sample application send me .I have already done this thing with the MS Excel .Now need in MSWord .Plz help me on this topic.
sukhpreet
|
|
|
|
|
If you have already done this with Excel, how?
I ask because you might well be able to use the same technique with Word.
Steve S
Developer for hire
|
|
|
|
|
I think my MFC app causes memory leak by "new", how to detect troubles of memory leak of the app?
I only want to detect for my app, not for whole system.
any suggestion for a tool or something else?
|
|
|
|
|
|
Make sure you have the following at the top of every source file:
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
If so, leaks should be reported when your application exits.
|
|
|
|
|
includeh10 wrote: think my MFC app causes memory leak by "new", how to detect troubles of memory leak of the app?
for that i prefer AUTO_PTR.... any way you can try CMemoryState Class
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Robert Edward Caldecott wrote: ...leaks should be reported when your application exits.
But only if it was compiled in Debug mode and F5 was used to start it.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
If i create a thread with AfxBeginThread, how can i later on on some point check if the tread is still running. For example Tread class of Java has a "isAlive()" method for that. But it seems that the CWinThread class that AfxBeginThread returns has no such thing.
|
|
|
|
|
Get the handle to the thread and Call GetExitCodeThread then see if it returns STILL_ACTIVE.
|
|
|
|
|
In Some Old Code some validation is done in WM_KILLFOCUS.
Now We know that this is not a good way, But we don't wan't to change the code.
If Some User's closes the dialog using "Top Right Cross Button" the dialog and its Data
becomse invalid and after that the KillFocus comes.
In This case we dont want the killfocus event to happen.
Please suggest.
Stuck in a Problem
|
|
|
|