-
?API NT Compatability?
I have two API functions for a systray operation. I was wondering if they
would be compatabile with NT.
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
Long) As Long
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
-
Re: ?API NT Compatability?
"Dennis" <dennisjt@home.com> wrote:
>
>I have two API functions for a systray operation. I was wondering if they
>would be compatabile with NT.
>
>Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
>Long) As Long
>
>Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
>(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>
Dennis
I use the last one with Windows 2000 and why shouldn't it work?
Morton
-
Re: ?API NT Compatability?
"Dennis" <dennisjt@home.com> wrote:
>
>I have two API functions for a systray operation. I was wondering if they
>would be compatabile with NT.
>
>Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
>Long) As Long
>
>Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
>(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>
Dennis
I use the last one with Windows 2000 and why shouldn't it work?
Morton
-
Re: ?API NT Compatability?
I was just wondering if there was a way to test if certain APi's are TNt compatable.
Do you know if the first one is compatable?
"Morton" <mortenb@powec.no> wrote:
>
>"Dennis" <dennisjt@home.com> wrote:
>>
>>I have two API functions for a systray operation. I was wondering if they
>>would be compatabile with NT.
>>
>>Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
>>Long) As Long
>>
>>Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
>>(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>>
>
>Dennis
>I use the last one with Windows 2000 and why shouldn't it work?
>
>Morton
>
-
Re: ?API NT Compatability?
I was just wondering if there was a way to test if certain APi's are TNt compatable.
Do you know if the first one is compatable?
"Morton" <mortenb@powec.no> wrote:
>
>"Dennis" <dennisjt@home.com> wrote:
>>
>>I have two API functions for a systray operation. I was wondering if they
>>would be compatabile with NT.
>>
>>Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
>>Long) As Long
>>
>>Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
>>(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>>
>
>Dennis
>I use the last one with Windows 2000 and why shouldn't it work?
>
>Morton
>
-
Re: ?API NT Compatability?
From the MSDN ...
Platform SDK: Windows User Interface
SetForegroundWindow
The SetForegroundWindow function puts the thread that created the specified
window into the foreground and activates the window. Keyboard input is
directed to the window, and various visual cues are changed for the user.
The system assigns a slightly higher priority to the thread that created the
foreground window than it does to other threads.
BOOL SetForegroundWindow(
HWND hWnd // handle to window
);
Parameters
hWnd
[in] Handle to the window that should be activated and brought to the
foreground.
Return Values
If the window was brought to the foreground, the return value is nonzero.
If the window was not brought to the foreground, the return value is zero.
Remarks
The foreground window is the window at the top of the Z order. It is the
window that the user is working with. In a preemptive multitasking
environment, you should generally let the user control which window is the
foreground window.
Windows 98, Windows 2000: The system restricts which processes can set the
foreground window. A process can set the foreground window only if one of
the following conditions is true:
a.. The process is the foreground process.
b.. The process was started by the foreground process.
c.. The process received the last input event.
d.. There is no foreground process.
e.. The foreground process is being debugged.
f.. The foreground is not locked (see LockSetForegroundWindow).
g.. The foreground lock time-out has expired (see
SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo).
h.. Windows 2000: No menus are active.
With this change, an application cannot force a window to the foreground
while the user is working with another window. Instead, SetForegroundWindow
will activate the window (see SetActiveWindow) and call the FlashWindowEx
function to notify the user. However, on Windows 98, if a nonforeground
thread calls SetForegroundWindow and passes the handle of a window that was
not created by the calling thread, the window is not flashed on the taskbar.
To have SetForegroundWindow behave the same as it did on Windows 95 and
Windows NT 4.0, change the foreground lock timeout value when the
application is installed. This can be done from the setup or installation
application with the following function call:
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)0,
SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
This method allows SetForegroundWindow on Windows 98 and Windows 2000 to
behave the same as Windows 95 and Windows NT 4.0, respectively, for all
applications. The setup application should warn the user that this is being
done so that the user isn't surprised by the changed behavior. On Windows
2000, the SystemParametersInfo call fails unless the calling thread can
change the foreground window, so this must be called from a setup or patch
application. For more information, see Foreground and Background Windows.
A process that can set the foreground window can enable another process to
set the foreground window by calling the AllowSetForegroundWindow function.
The process specified by dwProcessId loses the ability to set the foreground
window the next time the user generates input, unless the input is directed
at that process, or the next time a process calls AllowSetForegroundWindow,
unless that process is specified.
The foreground process can disable calls to SetForegroundWindow by calling
the LockSetForegroundWindow function.
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Windows Overview, Window Functions, AllowSetForegroundWindow, FlashWindowEx,
GetForegroundWindow, LockSetForegroundWindow, SetActiveWindow
Built on Thursday, October 12, 2000
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Windows Overview, Window Functions, AllowSetForegroundWindow, FlashWindowEx,
GetForegroundWindow, LockSetForegroundWindow, SetActiveWindow
--
Randy Birch
MVP Visual Basic
Take the vb.net poll at:
http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/
Please respond only to the newsgroups so all can benefit.
"Dennis" <dennisjt@home.com> wrote in message
news:3a880a7f$1@news.devx.com...
:
: I was just wondering if there was a way to test if certain APi's are TNt
compatable.
: Do you know if the first one is compatable?
:
: "Morton" <mortenb@powec.no> wrote:
: >
: >"Dennis" <dennisjt@home.com> wrote:
: >>
: >>I have two API functions for a systray operation. I was wondering if
they
: >>would be compatabile with NT.
: >>
: >>Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
: >>Long) As Long
: >>
: >>Private Declare Function Shell_NotifyIcon Lib "shell32" Alias
"Shell_NotifyIconA"
: >>(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
: >>
: >
: >Dennis
: >I use the last one with Windows 2000 and why shouldn't it work?
: >
: >Morton
: >
:
-
Re: ?API NT Compatability?
From the MSDN ...
Platform SDK: Windows User Interface
SetForegroundWindow
The SetForegroundWindow function puts the thread that created the specified
window into the foreground and activates the window. Keyboard input is
directed to the window, and various visual cues are changed for the user.
The system assigns a slightly higher priority to the thread that created the
foreground window than it does to other threads.
BOOL SetForegroundWindow(
HWND hWnd // handle to window
);
Parameters
hWnd
[in] Handle to the window that should be activated and brought to the
foreground.
Return Values
If the window was brought to the foreground, the return value is nonzero.
If the window was not brought to the foreground, the return value is zero.
Remarks
The foreground window is the window at the top of the Z order. It is the
window that the user is working with. In a preemptive multitasking
environment, you should generally let the user control which window is the
foreground window.
Windows 98, Windows 2000: The system restricts which processes can set the
foreground window. A process can set the foreground window only if one of
the following conditions is true:
a.. The process is the foreground process.
b.. The process was started by the foreground process.
c.. The process received the last input event.
d.. There is no foreground process.
e.. The foreground process is being debugged.
f.. The foreground is not locked (see LockSetForegroundWindow).
g.. The foreground lock time-out has expired (see
SPI_GETFOREGROUNDLOCKTIMEOUT in SystemParametersInfo).
h.. Windows 2000: No menus are active.
With this change, an application cannot force a window to the foreground
while the user is working with another window. Instead, SetForegroundWindow
will activate the window (see SetActiveWindow) and call the FlashWindowEx
function to notify the user. However, on Windows 98, if a nonforeground
thread calls SetForegroundWindow and passes the handle of a window that was
not created by the calling thread, the window is not flashed on the taskbar.
To have SetForegroundWindow behave the same as it did on Windows 95 and
Windows NT 4.0, change the foreground lock timeout value when the
application is installed. This can be done from the setup or installation
application with the following function call:
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, (LPVOID)0,
SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
This method allows SetForegroundWindow on Windows 98 and Windows 2000 to
behave the same as Windows 95 and Windows NT 4.0, respectively, for all
applications. The setup application should warn the user that this is being
done so that the user isn't surprised by the changed behavior. On Windows
2000, the SystemParametersInfo call fails unless the calling thread can
change the foreground window, so this must be called from a setup or patch
application. For more information, see Foreground and Background Windows.
A process that can set the foreground window can enable another process to
set the foreground window by calling the AllowSetForegroundWindow function.
The process specified by dwProcessId loses the ability to set the foreground
window the next time the user generates input, unless the input is directed
at that process, or the next time a process calls AllowSetForegroundWindow,
unless that process is specified.
The foreground process can disable calls to SetForegroundWindow by calling
the LockSetForegroundWindow function.
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Windows Overview, Window Functions, AllowSetForegroundWindow, FlashWindowEx,
GetForegroundWindow, LockSetForegroundWindow, SetActiveWindow
Built on Thursday, October 12, 2000
Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winuser.h; include Windows.h.
Library: Use User32.lib.
See Also
Windows Overview, Window Functions, AllowSetForegroundWindow, FlashWindowEx,
GetForegroundWindow, LockSetForegroundWindow, SetActiveWindow
--
Randy Birch
MVP Visual Basic
Take the vb.net poll at:
http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/
Please respond only to the newsgroups so all can benefit.
"Dennis" <dennisjt@home.com> wrote in message
news:3a880a7f$1@news.devx.com...
:
: I was just wondering if there was a way to test if certain APi's are TNt
compatable.
: Do you know if the first one is compatable?
:
: "Morton" <mortenb@powec.no> wrote:
: >
: >"Dennis" <dennisjt@home.com> wrote:
: >>
: >>I have two API functions for a systray operation. I was wondering if
they
: >>would be compatabile with NT.
: >>
: >>Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
: >>Long) As Long
: >>
: >>Private Declare Function Shell_NotifyIcon Lib "shell32" Alias
"Shell_NotifyIconA"
: >>(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
: >>
: >
: >Dennis
: >I use the last one with Windows 2000 and why shouldn't it work?
: >
: >Morton
: >
:
-
Re: ?API NT Compatability?
Dennis -
As a general rule, the problem is the other way, and you will find that there
are quite a lot of NT functions that cannot be used by 95/98. Anyway, you
shouldn't have to test to find out whether a function works on a particular
version of Windows. Go straight to the MSDN Library, and read the notes
on every API call ever written! Just in case you don't have a copy of this,
then the following link should help you:
http://msdn.microsoft.com/library/default.asp
As an example, the following function gives you an example of a function
is labelled for use for particular Windows version:
http://msdn.microsoft.com/library/ps...ndows_8fqq.htm
HTH
-------------------------
Mark Alexander Bertenshaw
Programmer/Analyst
Prime Response
Brentford
UK
"Dennis" <dennisjt@home.com> wrote:
>
>I was just wondering if there was a way to test if certain APi's are TNt
compatable.
>Do you know if the first one is compatable?
>
>"Morton" <mortenb@powec.no> wrote:
>>
>>"Dennis" <dennisjt@home.com> wrote:
>>>
>>>I have two API functions for a systray operation. I was wondering if they
>>>would be compatabile with NT.
>>>
>>>Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd
As
>>>Long) As Long
>>>
>>>Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
>>>(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>>>
>>
>>Dennis
>>I use the last one with Windows 2000 and why shouldn't it work?
>>
>>Morton
>>
>
-
Re: ?API NT Compatability?
Dennis -
As a general rule, the problem is the other way, and you will find that there
are quite a lot of NT functions that cannot be used by 95/98. Anyway, you
shouldn't have to test to find out whether a function works on a particular
version of Windows. Go straight to the MSDN Library, and read the notes
on every API call ever written! Just in case you don't have a copy of this,
then the following link should help you:
http://msdn.microsoft.com/library/default.asp
As an example, the following function gives you an example of a function
is labelled for use for particular Windows version:
http://msdn.microsoft.com/library/ps...ndows_8fqq.htm
HTH
-------------------------
Mark Alexander Bertenshaw
Programmer/Analyst
Prime Response
Brentford
UK
"Dennis" <dennisjt@home.com> wrote:
>
>I was just wondering if there was a way to test if certain APi's are TNt
compatable.
>Do you know if the first one is compatable?
>
>"Morton" <mortenb@powec.no> wrote:
>>
>>"Dennis" <dennisjt@home.com> wrote:
>>>
>>>I have two API functions for a systray operation. I was wondering if they
>>>would be compatabile with NT.
>>>
>>>Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd
As
>>>Long) As Long
>>>
>>>Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
>>>(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>>>
>>
>>Dennis
>>I use the last one with Windows 2000 and why shouldn't it work?
>>
>>Morton
>>
>
-
Re: ?API NT Compatability?
You might also want to check out
http://www.vb2themax.com/Item.asp?Pa...Cat=1600&ID=69
/B
"Dennis" <dennisjt@home.com> skrev i meddelandet
news:3a8772a7$1@news.devx.com...
>
> I have two API functions for a systray operation. I was wondering if they
> would be compatabile with NT.
>
> Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
> Long) As Long
>
> Private Declare Function Shell_NotifyIcon Lib "shell32" Alias
"Shell_NotifyIconA"
> (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>
-
Re: ?API NT Compatability?
You might also want to check out
http://www.vb2themax.com/Item.asp?Pa...Cat=1600&ID=69
/B
"Dennis" <dennisjt@home.com> skrev i meddelandet
news:3a8772a7$1@news.devx.com...
>
> I have two API functions for a systray operation. I was wondering if they
> would be compatabile with NT.
>
> Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
> Long) As Long
>
> Private Declare Function Shell_NotifyIcon Lib "shell32" Alias
"Shell_NotifyIconA"
> (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|