Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem showing the application in EXE
Message
From
09/04/2004 11:54:18
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
09/04/2004 11:51:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00893559
Message ID:
00893586
Views:
28
>>>
>>>#define SW_SHOWMINIMIZED    2
>>>#define SW_SHOWMAXIMIZED    3
>>>#define SW_MAXIMIZE         3
>>>#define SW_SHOWNOACTIVATE   4
>>>#define SW_SHOW             5
>>>#define SW_MINIMIZE         6
>>>#define SW_SHOWMINNOACTIVE  7
>>>#define SW_SHOWNA           8
>>>#define SW_RESTORE          9
>>>#define SW_SHOWDEFAULT      10
>>>#define SW_FORCEMINIMIZE    11
>>>
>>>DECLARE short ShowWindow IN WIN32API ;
>>>  integer hWnd, ;
>>>  integer nCmdShow
>>>declare short SetForegroundWindow in win32API integer nHwnd
>>>DECLARE short GetWindowPlacement IN WIN32API ;
>>>  integer hWnd, ;
>>>  string @ lpwndpl
>>>
>>>lpwndpl = CHR(4*3+8*2+4*4)+replicate(CHR(0),4*3+8*2+4*4-1)
>>>
>>>		lnHWND = _screen.Hwnd
>>>		SetForegroundWindow( m.lnHWND )
>>>		IF ( GetWindowPlacement(m.lnHWND, @lpwndpl) # 0 ) AND ;
>>>			INLIST(ASC(SUBSTR(m.lpwndpl, 4+4+1, 1)), ;
>>>			SW_SHOWMINIMIZED, SW_MINIMIZE, SW_SHOWMINNOACTIVE, SW_FORCEMINIMIZE)
>>>			ShowWindow(lnHWND, SW_RESTORE)
>>>		endif
>>>
>>
>>This still provides me the same result. I see the task item in the Windows task bar, it's flashing but I have to click on it twice to see my app.
>
>I suspect there is smething in it creating a wait state.
>Cetin
A more brutal way :
DECLARE integer GetForegroundWindow IN win32API
Declare integer GetCurrentThreadId in win32API
declare integer GetWindowThreadProcessId in win32API ;
	integer hWnd, integer @lpdwProcessId
DECLARE short SetForegroundWindow IN win32API integer lnHWnd
Declare short AttachThreadInput in win32API ;
  integer idAttach, integer idAttachTo,  short fAttach


oTmr = CreateObject('myTimer', GetForegroundWindow())
? 'Started countdown'
Read events

Define Class myTimer as Timer
	nHWND = 0
	Interval = 10000
	Procedure Init
	Lparameters tnHWND
	this.nHWND = tnHWND
	endproc
	Procedure Timer
		This.Enabled = .f.
		this.GetFocusBack()
		Clear events
	endproc
    Procedure GetFocusBack
		lpdwProcessId = 0
		lnThreadID1 = GetCurrentThreadId()

		lnThreadID2 = GetWindowThreadProcessId(this.nHWND, @lpdwProcessId)

		AttachThreadInput(lnThreadID1, lnThreadID2, 1)
		SetForegroundWindow(this.nHWND)
		AttachThreadInput(lnThreadID1, lnThreadID2, 0)

    endproc
enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform