OVH Cloud OVH Cloud

API sous VBSCRIPT

7 réponses
Avatar
Gilles RONSIN
Salut,

Il est possible de créer un ocx pour pouvoir utiliser les API en
VBscript.
Est-ce que quelqu'un a les fonctions du shell32.dll dans ses cartons ?

Au moins les fonctions SHSetUnreadMailCount et SHGetUnreadMailCount

Merci

--
Embryon de site : http://gilles.ronsin.free.fr
Nouvelle astuce : Script de création de raccourcis cible
http://gilles.ronsin.free.fr/#targetlnk
Il est impossible pour un optimiste d'être agréablement surpris.

7 réponses

Avatar
Jean
Bonjour,

Fonctions shell32
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/functions.asp

SHSetUnreadMailCount
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shsetunreadmailcount.asp

SHGetUnreadMailCount
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shgetunreadmailcount.asp


Amicalement,

Jean - JMST
Belgium

"Gilles RONSIN" a écrit dans le message de news:
Salut,

Il est possible de créer un ocx pour pouvoir utiliser les API en
VBscript.
Est-ce que quelqu'un a les fonctions du shell32.dll dans ses cartons ?

Au moins les fonctions SHSetUnreadMailCount et SHGetUnreadMailCount

Merci

--
Embryon de site : http://gilles.ronsin.free.fr
Nouvelle astuce : Script de création de raccourcis cible
http://gilles.ronsin.free.fr/#targetlnk
Il est impossible pour un optimiste d'être agréablement surpris.


Avatar
Jean-Claude BELLAMY
Dans le message news: ,
Gilles RONSIN s'est ainsi exprimé:

Il est possible de créer un ocx pour pouvoir utiliser les API en
VBscript.
voui....


Est-ce que quelqu'un a les fonctions du shell32.dll dans ses cartons ?
euh....

Tu connais la taille de la SHELL32 ?
8243 ko
309 fonctions "nommées"
!!!

Au moins les fonctions SHSetUnreadMailCount et SHGetUnreadMailCount


HRESULT SHSetUnreadMailCount(
LPCTSTR pszMailAddress,
DWORD dwCount,
LPCTSTR pszShellExecuteCommand
);
Parameters
pszMailAddress
[in] Pointer to a string in Unicode that contains
the current user's full e-mail address.
dwCount
[in] The number of unread messages.
pszShellExecuteCommand
[in] Pointer to a string in Unicode that contains
the full text of a command that can be passed
to ShellExecute. This command should start
the e-mail application that owns the account
referenced by pszMailAddress.
Return Value
HRESULT, which includes the following possibilities:
S_OK
The call completed successfully.
E_OUTOFMEMORY
Insufficient memory available.
E_INVALIDARG
Invalid string argument in either the pszMailAddress
or pszShellExecuteCommand parameters.


Remarks
This function is exported from Shell32.dll in Unicode;
there is no ANSI version.
When this function updates the registry, the new
registry entry is automatically stamped with the current
time and date.
If this function is called by different independent software
vendors (ISVs) that specify the same e-mail name, only
the last call is saved. That is, calls to this function overwrite
any previously saved value for the same e-mail address,
even if the calls are made by different ISVs.

It is recommended that the count of unread messages be
set only for the main Inbox of the users account.
Mail in sub-folders such as Drafts,or Deleted Items should
be ignored.
It is important that e-mail clients do not set the number of
unread messages to 0 when the application exits, because
this causes the number of unread messages to be erroneously
reported as 0.

Because this function uses HKEY_CURRENT_USER, it should
not be called by a system process impersonating a user.

Function Information
Minimum DLL Version
shell32.dll version 5.60 or later
Custom Implementation
No
Header
shellapi.h
Import library
shell32.lib
Minimum operating systems
Windows XP
Unicode
Implemented as Unicode version.

----------------------------------------------


HRESULT SHGetUnreadMailCount(
HKEY hKeyUser,
LPCTSTR pszMailAddress,
DWORD *pdwCount,
FILETIME *pFileTime,
LPCTSTR pszShellExecuteCommand,
int cchShellExecuteCommand
);
Parameters
hKeyUser
[in] A valid HKEY for a given user.
This parameter should be NULL if the function is
called in a user's environment, in which case
HKEY_CURRENT_USER is used. This parameter
should be NULL if the function is called from the
SYSTEM context, in which case HKEY_USERS{SID}
is used.
pszMailAddress
[in] Pointer to a string in Unicode that specifies
the e-mail address of an account belonging to the
specified user. When this parameter is NULL, pdwCount
returns the total count of unread messages for all
accounts owned by the designated user.
pdwCount
[out] Pointer to a DWORD value which receives
the unread message count.
pFileTime
[in, out] Pointer to a FILETIME structure. The use
of this parameter is determined by whether
pszMailAddress is NULL. If pszMailAddress is NULL,
then this parameter is treated as an [in] parameter,
which specifies a filter, so that only unread mail newer
than the specified time appears. If pszMailAddress is
not NULL, then this parameter is treated as an [out]
parameter, which points to a FILETIME structure into
which the function places the timestamp of the last
SHSetUnreadMailCount call for the specified user
and e-mail account.
pszShellExecuteCommand
[out] Pointer to a string in Unicode that returns the
ShellExecute command statement passed into the
last SHSetUnreadMailCount call for the specified
user and e-mail account. This command string starts
the e-mail application that owns the account referenced
by pszMailAddress. If the ShellExecute command is not
required, this parameter can be NULL. If pszMailAddress
is NULL, this parameter is ignored and must be NULL.
cchShellExecuteCommand
[in] The maximum size, in characters, of the ShellExecute
command buffer pointed to by pszShellExecuteCommand.
This parameter must be zero for total counts when
pszMailAddress is NULL. It can also be NULL whenever
the ShellExecute command string is not required.
Return Value
Returns S_OK if successful, or an error value otherwise.

Remarks
This function is exported from Shell32.dll in Unicode only;
there is no ANSI version.

Function Information
Minimum DLL Version
shell32.dll version 6.0 or later
Custom Implementation
No
Header
shell32.h
Import library
shell32.lib
Minimum operating systems
Windows XP
Unicode
Implemented as Unicode version.

--
May the Force be with You!
La Connaissance s'accroît quand on la partage
----------------------------------------------------------
Jean-Claude BELLAMY [MVP] - http://www.bellamyjc.org
http://www.bellamyjc.org *


Avatar
Jean
Bonjour,

j'ai souvent avec vous l'impression d'avoir un perroquet sur l'épaule :-)

Amicalement,

Jean - JMST
Belgium
Avatar
Gilles RONSIN
Gilles RONSIN , le mer. 01 déc. 2004
17:51:15, écrivait ceci:

Au moins les fonctions SHSetUnreadMailCount et
SHGetUnreadMailCount
Merci Jean et JeanClaude,

j'en était arrivé à ce point aussi. Par flemme d'installer un
compilateur, je demandais juste si quelqu'un n'avait pas un OCX qui
reprendrait ces fonctions...

Je vais m'y coller donc...
à bientôt

--
Embryon de site : http://gilles.ronsin.free.fr
Nouvelle astuce : Script de création de raccourcis cible
http://gilles.ronsin.free.fr/#targetlnk
Il est impossible pour un optimiste d'être agréablement surpris.

Avatar
Isabelle Prawitz
Bonjour !
Du temps de VB6, il y avait un lecteur d'API qui permettait de coller les appels et définitions de fonctions.
Est-ce que c'est encore disponible, et cela fonctionne-t-il toujours ?
A+
Isa

"Gilles RONSIN" a écrit dans le message de news:
Gilles RONSIN , le mer. 01 déc. 2004
17:51:15, écrivait ceci:

Au moins les fonctions SHSetUnreadMailCount et
SHGetUnreadMailCount
Merci Jean et JeanClaude,

j'en était arrivé à ce point aussi. Par flemme d'installer un
compilateur, je demandais juste si quelqu'un n'avait pas un OCX qui
reprendrait ces fonctions...

Je vais m'y coller donc...
à bientôt

--
Embryon de site : http://gilles.ronsin.free.fr
Nouvelle astuce : Script de création de raccourcis cible
http://gilles.ronsin.free.fr/#targetlnk
Il est impossible pour un optimiste d'être agréablement surpris.



Avatar
Gilles RONSIN
"Isabelle Prawitz" , le jeu. 02 déc. 2004
09:49:38, écrivait ceci:

Bonjour !


Salut,

Du temps de VB6, il y avait un lecteur d'API qui permettait de
coller les appels et définitions de fonctions. Est-ce que c'est
encore disponible, et cela fonctionne-t-il toujours ? A+
Isa
Tu penses à API-GUIDE ?

Il me semble qu'il n'a pas été mis à jour depuis quelques temps... ce
qui fait (du moins pour la version que j'ai) que les spécificités de XP
n'y sont pas répertoriées...
... mais c'est une piste. Je vais voir s'il y a une mise à jour.
Merci pour l'idée

--
Embryon de site : http://gilles.ronsin.free.fr
Nouvelle astuce : Script de création de raccourcis cible
http://gilles.ronsin.free.fr/#targetlnk
Il est impossible pour un optimiste d'être agréablement surpris.

Avatar
Gilles RONSIN
Gilles RONSIN , le mer. 01 déc. 2004
17:51:15, écrivait ceci:

Re,

Il est possible de créer un ocx pour pouvoir utiliser les API en
VBscript.


Bon c'est fait, mais....

Je pense que c'est dû à la non gestion du mode ansi (This function is
exported from Shell32.dll in Unicode; there is no ANSI version.)
car quand je créé une entrée

dim UM
dim ret
Set UM = WScript.CreateObject("PRUnreadMailCount.CLUnreadMailCount")
ret = UM.VBSetUnreadMailCount("" & _
vbnullstring,1,vbnullstring)

la clé créée ne ressemble pas à mais à une
succession de carrés :-((

il faut encoder la chaine ??? et comment ??
(d'ailleurs si c'est le cas, il vaudrait mieux le faire dans la DLL)

--
Embryon de site : http://gilles.ronsin.free.fr
Nouvelle astuce : Script de création de raccourcis cible
http://gilles.ronsin.free.fr/#targetlnk
Il est impossible pour un optimiste d'être agréablement surpris.