Tutorial API Win32

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Avatar de l’utilisateur
Droopy
Messages : 1151
Inscription : lun. 19/juil./2004 22:31

Tutorial API Win32

Message par Droopy »

Je voudrais apprendre à utiliser l'API Win32 via PureBasic

J'ai le fichier win32.hlp / le tableau de correspondance des type de Freak ...

Bref j'ai commencé mais tout seul c'est pas simple

Quelqu'un aurait le temps de faire un tutorial ( avec des exemples )

Merci
Avatar de l’utilisateur
cederavic
Messages : 1338
Inscription : lun. 09/févr./2004 23:38
Localisation : Bordeaux

Message par cederavic »

C'est assez vaste ce que tu demandes là... Tu aurrais besoin d'explication sur quoi précisement?
Avatar de l’utilisateur
Droopy
Messages : 1151
Inscription : lun. 19/juil./2004 22:31

Message par Droopy »

NetUserAdd par exemple qui me semble bien compliqué
Avatar de l’utilisateur
Droopy
Messages : 1151
Inscription : lun. 19/juil./2004 22:31

Message par Droopy »

Traumatic m'a répondu sur le forum US

je copie ici son code si ça interesse quelqu'un

Code : Tout sélectionner

; 
; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netmgmt/netmgmt/netuseradd.asp 
; 

#USER_PRIV_USER = 1 
#UF_SCRIPT      = $0001 

Structure USER_INFO_1 
  usri1_name.l 
  usri1_password.l 
  usri1_password_age.l 
  usri1_priv.l 
  usri1_home_dir.l 
  usri1_comment.l 
  usri1_flags.l 
  usri1_script_path.l 
EndStructure 

Procedure.l L(string.s) 
  *out = AllocateMemory(Len(string)*2 * #SIZEOF_WORD) 
  MultiByteToWideChar_(#CP_ACP, 0, string, -1, *out, Len(string))  
  ProcedureReturn *out  
EndProcedure 

; 
; 
; 

ui.USER_INFO_1 

dwLevel.l = 1 
dwError.l = 0 

userName.s = "YOURNAME" 
userPass.s = "YOURPASSWORD" 
serverName.s = "YOURSERVERNAME" 

OpenConsole() 

; Set up the USER_INFO_1 structure. 
;  #USER_PRIV_USER: name identifies a user, 
;     rather than an administrator or a guest. 
;  #UF_SCRIPT: required for LAN Manager 2.0 and 
;     Windows NT and later. 
; 
ui\usri1_name = L(userName.s) 
ui\usri1_password = L(userPass.s) 
ui\usri1_priv = #USER_PRIV_USER 
ui\usri1_home_dir = #NULL 
ui\usri1_comment = #NULL 
ui\usri1_flags = #UF_SCRIPT 
ui\usri1_script_path = #NULL 

serverName.s 
; 
; Call the NetUserAdd function, specifying level 1. 
; 
nStatus.l = NetUserAdd_(L(serverName), dwLevel, @ui, @dwError) 

; 
; If the call succeeds, inform the user. 
; 
If nStatus = 0 
  PrintN("User " + userName + " has been successfully added on " + serverName) 

  ; Otherwise, print the system error. 
Else 
  PrintN("A system error has occurred: " +Str(nStatus)) 
EndIf 

Input() 
CloseConsole() 
  
End 
Répondre