Worrow Posted March 9, 2004 Posted March 9, 2004 It(BringWindowToTop) works fine in Win2K. But it doesn't work on Win98. Is there any alternative other than this api function? Please help. :confused: Quote
Worrow Posted March 9, 2004 Author Posted March 9, 2004 BTW, I am talking about bringing an external program to the focus, not my own program. Quote
Worrow Posted March 10, 2004 Author Posted March 10, 2004 Still not working. It seems like I can't call any api function in Win98. Here is the code: Private Declare Function SetForegroundWindow Lib "user32.dll" (ByVal hwnd As System.IntPtr) As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cal As New Process cal.StartInfo.FileName = "C:\Program Files\calc.exe" cal.Start() SetForegroundWindow(cal.MainWindowHandle) Application.Exit() end Sub Anyway, thanks for your suggestion. Quote
HJB417 Posted March 10, 2004 Posted March 10, 2004 SetForegroundWindow returns a bool what was the return value when u called it? Quote
Worrow Posted March 11, 2004 Author Posted March 11, 2004 SetForegroundWindow returns a bool what was the return value when u called it? It returns nothing(neither true nor false). Here is the error message: System.PlatformNotSupportedException: Feature requires Windows NT. at System.Diagnostics.ProcessManager.GetProcessIdFromHandle(IntPtr processHandle) Quote
*Gurus* divil Posted March 11, 2004 *Gurus* Posted March 11, 2004 That means you cannot use the Process class in the way you are from Windows 98. It doesn't have anything to do with the API you're using. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Worrow Posted March 11, 2004 Author Posted March 11, 2004 That means you cannot use the Process class in the way you are from Windows 98. It doesn't have anything to do with the API you're using. But "calc.exe" did start. Do you mean process handle can't be used in Win98? Quote
*Gurus* divil Posted March 11, 2004 *Gurus* Posted March 11, 2004 It sounds like it can't handle getting the main window handle. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.