Click here to Skip to main content
15,917,586 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: problem:How draw text with NOT mode Pin
Alexey Kourakolov3-Jun-02 3:16
Alexey Kourakolov3-Jun-02 3:16 
GeneralProblems with my DLL Pin
3-Jun-02 2:03
suss3-Jun-02 2:03 
GeneralRe: Problems with my DLL Pin
Mike Nordell3-Jun-02 22:51
Mike Nordell3-Jun-02 22:51 
GeneralCreate a Linked List BaseClass Pin
Bug3-Jun-02 1:57
Bug3-Jun-02 1:57 
GeneralRe: Create a Linked List BaseClass Pin
Tomasz Sowinski3-Jun-02 1:54
Tomasz Sowinski3-Jun-02 1:54 
GeneralRe: Create a Linked List BaseClass Pin
3-Jun-02 5:01
suss3-Jun-02 5:01 
GeneralRe: Create a Linked List BaseClass Pin
Bug3-Jun-02 22:43
Bug3-Jun-02 22:43 
GeneralThread Pin
Mazdak3-Jun-02 1:28
Mazdak3-Jun-02 1:28 
I have a thread function and I define it as global function:

This function get the focused window and change the position of it.

BOOL bdown = false ;

UINT ThreadFunc(LPVOID pparam)
{

	WINDOWINFO info;
	HWND hwnd;
	DWORD dword;
        hwnd = (HWND)GetForegroundWindow();
	GetWindowThreadProcessId( hwnd , &dword);
	AttachThreadInput( dword , GetCurrentThreadId()  ,true);
	hwnd = GetFocus();
	if(hwnd != NULL)
		GetWindowInfo( hwnd ,&info );
	else
	{
	  hwnd = (HWND)GetForegroundWindow();
      GetWindowInfo( hwnd ,&info );
	}
	if(hwnd!=NULL)
	{

		int x = info.rcWindow.left;
		int y = info.rcWindow.top;
		int width = (info.rcWindow.right-info.rcWindow.left);
		int height = (info.rcWindow.bottom-info.rcWindow.top) ;

		if(bdown)
			y -= 90;
		else
			y += 90;

		SetWindowPos(hwnd , HWND_NOTOPMOST , x , y , width ,height , SWP_SHOWWINDOW);

		if(bdown)
			bdown = false;
		else
			bdown = true;

		Sleep(1000);
	}
	return 0;
}


I start thread in my OnInitDialog of my class like this:

AfxBeginThread(ThreadFunc, 0);


The problem is that if when I call the function without starting thread it works and change the position but when I start the thread nothing happend.also when I debug my application it change the postion for one time and it seems that it does not called another time.Any idea?

Mazy

"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica

GeneralRe: Thread Pin
Tomasz Sowinski3-Jun-02 1:32
Tomasz Sowinski3-Jun-02 1:32 
GeneralRe: Thread Pin
Mazdak3-Jun-02 2:42
Mazdak3-Jun-02 2:42 
QuestionHow to add min, max and close button to the menu bar? Pin
melwyn3-Jun-02 1:05
melwyn3-Jun-02 1:05 
AnswerRe: How to add min, max and close button to the menu bar? Pin
Sonu Kapoor3-Jun-02 1:29
Sonu Kapoor3-Jun-02 1:29 
Questionhow to write a small debugger in c++? Pin
hwnd3-Jun-02 1:01
hwnd3-Jun-02 1:01 
AnswerRe: how to write a small debugger in c++? Pin
Tomasz Sowinski3-Jun-02 1:15
Tomasz Sowinski3-Jun-02 1:15 
QuestionDevice driver ? Pin
Girish Shriniwas Pathak3-Jun-02 0:46
Girish Shriniwas Pathak3-Jun-02 0:46 
AnswerRe: Device driver ? Pin
Mike Nordell3-Jun-02 22:54
Mike Nordell3-Jun-02 22:54 
GeneralRe: Device driver ? Pin
5-Jun-02 23:12
suss5-Jun-02 23:12 
GeneralMSDN Integration with Visual C++.NET Pin
Orbital^3-Jun-02 0:45
Orbital^3-Jun-02 0:45 
GeneralRe: MSDN Integration with Visual C++.NET Pin
Nish Nishant3-Jun-02 0:58
sitebuilderNish Nishant3-Jun-02 0:58 
GeneralRe: MSDN Integration with Visual C++.NET Pin
Orbital^3-Jun-02 1:08
Orbital^3-Jun-02 1:08 
GeneralRe: MSDN Integration with Visual C++.NET Pin
Anders Molin3-Jun-02 2:35
professionalAnders Molin3-Jun-02 2:35 
GeneralRe: MSDN Integration with Visual C++.NET Pin
Orbital^3-Jun-02 3:03
Orbital^3-Jun-02 3:03 
GeneralRe: MSDN Integration with Visual C++.NET Pin
Anders Molin3-Jun-02 7:13
professionalAnders Molin3-Jun-02 7:13 
GeneralEnumObjects doesen't work when using recursive function. Pin
redeemer3-Jun-02 0:28
redeemer3-Jun-02 0:28 
GeneralRe: EnumObjects doesen't work when using recursive function. Pin
_Magnus_3-Jun-02 1:04
_Magnus_3-Jun-02 1:04 

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.