La DroopyLib version 4.51 est disponible
Cette bibliothèque est un fourre-tout, elle contient une multitude de fonctions.

Le , par comtois, Responsable Purebasic
Droopy récidive et nous propose une mise à jour de sa fameuse DroopyLib.
Pour ceux qui ne connaissent pas encore, c'est un fourre tout, dont voici la liste des fonctions disponibles (les sources sont dispos dans l'archive) :
StringToOem(StringAddress) ; Translates a string into the OEM-defined character set.
OemToString(StringAddress) ; Translates a string from the OEM-defined character set into either an ANSI or a wide-character string
Hex2Dec(hex.s) ; Converts a Hex value ( as String ) to a Decimal value ( as Long )
Bin2Dec(BinaryStringNumber.s) ; Converts a Binary value ( as String ) to a Decimal value ( as Long )
ForegroundWindowGet() ; Returns The handle of The foreground window
ForegroundWindowSet(WindowsHandle) ; Sets the Foreground Window
NNot(Bool) ; Same as Not
Ansi2Unicode(string.s) ; Converts normal (Ansi) string To Unicode (L)
Unicode2Ansi(Pointer) ; Converts Unicode to normal (Ansi) string (M)
DroopyVersion() ; Return the library version
MakeSureDirectoryPathExists(Directory.s) ; Creates all directories in the specified path
GetSpecialFolderLocation(fid.l) ; Get Name / Folder of Windows Special Folders
GetFilePartWE(File.s) ; Return only file part without extension
GetProgramResultExitCode() ; Return the error code of the program lauched by GetProgramResult
GetProgramResult(File.s,Parameters.s) ; Retrieve the result of a command line
CiscoFormat(MacAddress.s) ; Return mac address as 'Cisco' format
GetMacAddress(Subnet.s) ; Return mac address of a specific subnet
WMI(WMICommand.s) ; Interrogate WMI Database
String2Hex(string.s) ; Convert string to hex
Hex2String(string.s) ; Convert hex to string
DocumentAndSettings() ; Return Document and Settings Folder
MonitorPower(State.b) ; Turn off / On / Standyby the monitor
Beep(Frequency,Duration) ; Generates simple tones on the speaker
MessageBeep(Sound) ; Play a windows sound
BlockInput(State.l) ; Inhibit keyboard & Mouse
GuidAPI() ; Return a GUID
ComputerSerialNumber() ; Retrieve the Computer Serial Number
NTCore() ; Returns 1 if OS has an NT Core ( NT/2K/XP/... ) / 0 if W95/98/ME
ReturnKeyToButtonClick(Window) ; Simulate a left click when you press ENTER over an activated Button
PureBasicPath() ; Return PureBasic Path
PureBasicVersion() ; Return Purebasic version
ScreenSaver() ; Runs the Screen-Saver immediately
GetLastError() ; Return the last Win32 API error as a string
GetLastErrorAsText(LastError.l) ; Used to get Last Win32 API Error
SelfEncryption(text.s,en.l) ; Encrypt a String (text) if en=#True / Decrypt if en=#False
RC4Api(string.s, Password.s) ; Encode / Decode a String with a key using Windows API ( RC4 algorithm )
LogInit(LogFile.s,DateFormat.s="%dd/%mm/%yy %hh:%ii:%ss ") ; Creates a LogFile
LogWrite(text.s) ; Appends Date & Time + Text to the log file
LogInitAuto() ; Init log file to ProgramFiles\Disc\ExeName.log
MeasureIntervalStart() ; Defines the point where you want to start measuring your code
MeasureIntervalStop() ; Defines the point where you want to stop measuring your code
MeasureHiResIntervalStart() ; Defines the point where you want to start measuring your code
MeasureHiResIntervalStop() ; Defines the point where you want to stop measuring your code
SaveResourceAs(Name.s,File.s) ; Save the resource as a file ( Name is the first field of the RC file )
GetResourcePointer(Name.s) ; Returns a pointer of a resource ( Name is the first field of the RC file )
GetResourceSize(Name.s) ; Returns the size of a resource ( Name is the first field of the RC file )
RegSetValue(Key.s, ValueName.s, Value.s, Type, ComputerName.s) ; Sets a Value
RegGetValue(Key.s, ValueName.s, ComputerName.s) ; Gets a Value
RegGetType(Key.s, ValueName.s, ComputerName.s) ; Returns Key Type
RegListSubKey(Key.s, index, ComputerName.s) ; Lists all SubKeys
RegDeleteValue(Key.s, ValueName.s, ComputerName.s) ; Deletes a Value
RegCreateKey(Key.s, ComputerName.s) ; Creates a Key
RegDeleteKey(Key.s, ComputerName.s) ; Deletes a Key
RegListSubValue(Key.s, index, ComputerName.s) ; Lists all SubValues
RegKeyExists(Key.s, ComputerName.s) ; Tests if a Key exists
RegDeleteKeyWithAllSub(Key.s,ComputerName.s); Deletes a Key and all its SubKeys / Values
RegCreateKeyValue(Key.s,ValueName.s,Value.s,Type,ComputerName.s) ; Creates a Key and a Value in a Single Command
RegValueExists(Key.s, ValueName.s, ComputerName.s) ; Tests if a Value Name exists
UserLoggedOn() ; Return Logged on user (XP only)
UserGuid(Username.s) ; Return the GUID of the user
UserShellFolder(GUID.s,ShellFolder.s) ; Return shell folder of a user (XP only)
Bargraph(x,y,width,height,Direction,medium.f,hight.f,full.f,color1,color2,color3,BackgroundColor) ; Creates a bar graph gadget .
BargraphSet(Id,Value.f) ; Sets the value of the bar graph
BargraphGet(Id) ; Get the value of the bar graph
BargraphEvent(Id) ; Returns 1 if you click on a bar graph gadget
Graph(x,y,width,height,Segment,medium.f,hight.f,full.f,color1,color2,color3,LineColor) ; Creates a Graph gadget .
GraphSet(Id,Value.f) ; Sets the value of the Graph
GraphGet(Id) ; Get the value of the Graph
GraphEvent(Id) ; Returns 1 if you click on a Graph gadget
SignedBinaryToUnsigned(byte.b) ; Purebasic shows a Byte as signed, this function shows a Byte as unsigned
SignedWordToUnsigned(Word.w) ; Purebasic show Word as signed, this function show a Word as unsigned
Odd(Number.l) ; Returns 1 if the number is odd ( pair in french )
Even(Number.l) ; Returns 1 if the number is even ( impair in french )
FlagSet(Flag.s,Value.s) ; Set a Flag value
FlagGet(Flag.s) ; Get a Flag Value
FlagDelete(Flag.s) ; Deletes a Flag
FlagCreate(Flag.s) ; Creates a Flag ( value = OK )
FlagInit(Key.s) ; Initialize the Library
FlagExist(Flag.s) ; Returns 1 if Flag exists / 0 instead
FlagDontExist(Flag.s) ; Returns 1 if Flag doesn't exist / 0 Instead
FlagRAZ() ; Delete All Flags and the Key Specified in FlagInit
GetPowerStatus() ; Return 0 Offline / 1 Online / 255 unknown
GetBatteryChargeStatus() ; Return 1 High / 2 Low / 4 Critical / 8 Charging / 128 No system battery / 255 Unknown
GetBatteryLifePercent() ; Return Percentage of full battery charge remaining
GetBatteryLifeTime() ; Return Number of seconds of battery life remaining : -1 Unknown
GetBatteryFullLifeTime() ; Number of seconds of battery life when at full charge : -1 Unknown
Logoff() ; Forced Logoff
Reboot() ; Forced Reboot
ShutDownAndPowerOff() ; Forced ShutDown and Power Off
LockWorkStation() ; Lock the Workstation
RunProgramAtStartup(WichUser.l,RunOrRunOnce.l,Name.s,CommandLine.s) ; Add an entry to the Run or RunOnce Key
DelProgramAtStartup(WichUser.l,RunOrRunOnce.l,Name.s) ; Delete an Entry in the Run or RunOnce Key
IsProgramRunAtStartup(WichUser.l,RunOrRunOnce.l,Name.s) ; Tests if an entry is present and valid .
EnumProcessInit() ; Initialize the function for enumerating processes
EnumProcess() ; Each time this function is called a process is returned as a string, until an empty string ( All process is listed )
GetPidProcess(Name.s) ; Returns Pid of Process if it exists / 0 if it doesn't exist
KillProcess(Pid) ; Kill a process by specifying it's Pid
Runas(Username.s,Domain.s,Password.s,CommandLine.s,Argument.s) ; Runas function with Parameters / Password
SuperRunas(Username.s,Password.s,CommandLine.s,Parametre.s) ; Runas function with Parameters / Password
SearchProcess(Name.s) ; Search if a Process is Running ( Scans processes without Window(s) as well )
RunOnlyOneInstance() ; End the Program if another instance is found !!
HandleToFileName(hWnd.l) ; Returns the file Path and Name of the exe that owns the specified Window Handle
PidToFileName(Pid.l) ; Returns the file Path and Name to the exe that has specified Process Pid
WaitProgramInitialisation(Handle) ; Waits until the specified Process is waiting for user input with no input pending, or until the time-out interval has elapsed
AddRecentDocuments(File.s) ; Adds a file to the recent documents
ClearRecentDocuments() ; Clears the recent documents folder
PathGet() ; Returns the Path
PathSet(Path.s) ; Set the Path
PathAdd(StringToAdd.s) ; Add this string to the Path ( the ; is added automatically )
PathRefresh() ; Force Windows to refresh the Path value for new processes
GetSystemDirectory() ; This Function retrieves the path of the system directory
GetWindowsDirectory() ; This Function retrieves the path of the Windows directory
SetComputerName(NetbiosName.s) ; Sets the NetbiosName for the local computer
SetComputerNameEx(Name.s) ; Sets the NetbiosName & HostName for the local computer
OSVersionText() ; Returns OsVersion in Text Format
GetComputerName() ; Retrieves the NetBIOS name of the local computer
BootState() ; Return the system Boot state
CheckInternetConnection() ; Retrieves the connected state of the local system
CommandLineShell() ; Returns the Command Line Shell ( Cmd.exe or Command.com & it's path )
ShowTaskBar(State) ; Show (#True) or Hide (#False) the taskbar
XPFirewall(State.l) ; Enable if #True or Disable if #False the Windows FireWall
WNetAddConnection(ShareName.s,Password.s,DriveLetter.s) ; Map a Network Drive using a Password
WNetAddConnectionNT(Username.s,Password.s,ShareName.s,DriveLetter.s,Persistant.l) ; Map Network Drive with a UserName / Password
WNetCancelConnection(DriveLetter.s,force.l) ; Disconnect Network Map Drive
IsNetDrive(Drive.s) ; Tests if a Drive is a Network Drive
NovellClientVersion() ; Return the Novell Client Version ( + Revision ) like 491SP5
GlobalMemoryStatusMemoryLoad() ; Specifies a number between 0 And 100 that gives a general idea of current Memory utilization, in which 0 indicates no memory use And 100 indicates full Memory use.
GlobalMemoryStatusTotalPhys() ; Indicates the total number of Mbytes of physical Memory.
GlobalMemoryStatusAvailPhys() ; Indicates the number of Mbytes of physical Memory available.
GlobalMemoryStatusTotalPageFile() ; Indicates the total number of Mbytes that can be stored in the paging file. Note that this number does not represent the actual physical size of the paging file on disk.
GlobalMemoryStatusAvailPageFile() ; Indicates the number of Mbytes available in the paging file.
GlobalMemoryStatusTotalVirtual() ; Indicates the total number of Mbytes that can be described in the user mode portion of the virtual address space of the calling process.
GlobalMemoryStatusAvailVirtual() ; Indicates the number of Mbytes of unreserved And uncommitted Memory in the user mode portion of the virtual address space of the calling process.
ImpersonateUser(Username.s,Domain.s,Password.s) ; Impersonate the process as the specified user
ImpersonateUserDisable() ; Stop the Impersonation
IniWrite(INIFile.s,Section.s,Key.s,string.s) ; Writes a key to an Ini File
IniRead(INIFile.s,Section.s,Key.s) ; Returns the contents of a key from an Ini File
GetUserName() ; Returns the Name of the User logged onto the Workstation
IsUserAnAdmin() ; Returns 1 if current user is administrator / 0 instead
NetLocalGroupEnum() ; Retrieves LocalGroup names
NetLocalGroupAdd(GroupName.s) ; Adds(creates) the local group named "GroupName"
NetLocalGroupDel(GroupName.s) ; Deletes the local group named "GroupName"
NetLocalGroupAddMembers(GroupName.s,AccountName.s) ; Adds a member to the local group named "GroupName"
NetLocalGroupDelMembers(GroupName.s,AccountName.s) ; Deletes a member to the local group named "GroupName"
NetLocalGroupGetMembers(groupe.s) ; Retrieves the Members of a LocalGroup
NetUserAdd(Username.s,Password.s) ; Creates a local User
NetUserChangePassword(Username.s,Domain.s,OldPassword.s,NewPassword.s) ; Change the user's password
NetUserEnum() ; Retrieves all UserNames
UserExist(Username.s,Password.s) ; Returns 1 if User & Password correct (User exist)
NetUserDel(Name.s) ; Deletes a local User
SearchFilesInit(Path.s,Mask.s,Recurse.l) ; Searches Path for files that match the Mask
SearchFilesGet() ; Each time you call SearchFilesGet() it returns a FileName.
DeleteFileToRecycleBin(File.s) ; Deletes the file to the Recycle Bin without confirmation / ProgressBar
EmptyRecycleBin() ; Deletes all files in the RecycleBin on all drives without Sound / Progress Bar / Confirmation
FileGetTime(File.s,Which); Get the time of a File
FileSetTime(File.s,Date,Which); Set the time of a File
CheckForMedium(Drive.s) ; Checks if medium is a drive, without getting the requester "Please insert...."
GetDriveVolumeName(Drive.s) ; Returns the Volume name of the drive / Empty String if drive isn't available
GetDriveFileSystem(Drive.s) ; Returns the FileSystem of the drive : FAT / FAT32 / NTFS
GetDiskFreeSpaceEx(Drive.s) ; Returns available free Disk space ( in Mb ) or 0 if Drive is not available or full
RealDriveType(Drive.s) ; Returns the Real Drive Type
AssociateFileEx(ext$,ext_description$,programm$,Icon$,prgkey$,cmd_description$,cmd_key$) ; AssociateFileEx(Extension,Extension Description,FullProgramPath&Name,Icon,just programname,command Description,command)
AssociateFile(ext$,ext_description$,programm$,Icon$) ; AssociateFile(Extension,Extension Description,FullProgramPath&Name,Icon)
RemoveAssociateFile(ext$,prgkey$) ; Remove association
CreateShortcut(Path.s,Link.s,Argument.s,Description.s,WorkingDir.s,ShowCommand.l,HotKey.l,IconFile.s="|",IconIndex.l=0) ; Create shell links/shortcuts
CreateSizedFile(File.s,Block) ; Create a file with size you want
GetFileType(File.s) ; Returns as a string the type of the file
GetFileVersion(FileName.s,Which,FieldName) ; Gets exe/dll file information as a string
RenameDrive(drive$,name$) ; Renames the Drive to Name$
CountRemovableDrive() ; Returns the number of Removable Media drives with media present
FormatDisk(Drive.s,quick) ; Only invokes the format prompt (doesn't format automatically).
Timer(TimerId,Delay,ProcedureAdress) ; Create a Timer which calls a Procedure
TimerKill(TimerId) ; Kill the Timer specified by Timerid
GetUserLanguage() ; Retrieves the Language of the user
GetUserSubLanguage() ; Retrieves the Sub-Language of the user
GetLanguage(wich) ; Returns the default primary language identifier ( 0 system / 1 User )
EnableWindow(Handle,State) ; Set if the window is enabled For mouse And keyboard input
IsWindowEnabled(Handle) ; Determines whether The specified window is enabled For mouse And keyboard input
IconExtract(File.s,Icon.l) ; File specifies the File to extract the icon from
IconExtractEx(File.s,Size.l,Selected.l) ; Returns ImageId of an Icon embedded in a file (Exe Or Dll )
SetWindowIcon(Handle,IconHandle)
GetExtensionIcon(Extension.s, Size.l) ; Returns the imageid of the icon associated by the extension
ShellAboutWindow(ParentWindow.l,Title.s,FirstText.s,DialogText.s,Icon.l) ; Shows a Microsoft 'About Windows' window
GetHandle(WindowsName.s) ; Returns the Handle of the Windows specified by name
SetWindowsTransparency(Handle.l, Transparency_Level.l) ; Sets Window Transparency between 1 ( invisible ) and 255 ( visible )
WindowsEnum() ; List all open Windows by Title
CloseWindows(WindowsName.s) ; Close Windows specified by WindowsName
ShowDesktop() ; Hide all Windows, and Show the Desktop
InputPasswordRequester(Title.s) ; Same as InputRequester but for Passwords
GetPixelColor(x,y) ; Returns the RGB color of the pixel at the specified coordinates or #CLR_INVALID (-1) if coordinate is outside of the screen
WindowFx(Id,ms,fx) ; Cool window FX for your apps (fade in/out, slide,wipe) / For creating LaunchBar
ChangeDisplaySettings(width,height,Depth,Freq,Permanent) ; Changes the display resolution / Depth / frequency
EnumDisplay(display.s) ; Determines all the screen modes.
GetDesktopHandle() ; Returns the Desktop Window Handle, Useful for creating Systray Icon without opening a window or creating an invisible window
WindowsExit(WindowID,State) ; Enable the user to close the window if #True
WindowsMove(WindowID,State) ; You can move window if #True / with #False you can't
ShowWindow(Handle,State) ; Sets the specified window's show state
FlashWindow(hWnd,Delay,Time) ; Flash the Window specified by hwnd
GetWindowTitleEx(hWnd) ; Uses getwindowtext_() to get the title of the specified hwnd
ToolTipAdd(Type,MaxWidth,WindowID,Gadget,Text$,Title$,Icon,TextColor,BKColor,Font.s,FontSize) ; Type : 0 = Balloon Tip / 1 Square Tip
ToolTipRemove(Gadget.l,WindowID=0) ;Remove a ToolTip
ToolTipChange(Gadget.l, Text$,WindowID=0) ; Change the text of the ToolTip
ToolTipShow(Gadget.l,x,y,WindowID=0) ; Force Showing a ToolTip
ToolTipHide(Gadget.l,WindowID=0) ; Hide a ToolTip previously Show with ToolTipShow
Between(string.s, LString.s, RString.s) ; Returns the string between the two strings
GetMouseX() ; Get the X coordinate of the mouse pointer
GetMouseY() ; Get the Y coordinate of the mouse pointer
SetMouseXY(x,y) ; Set the Location of the mouse pointer
SetMouseClick(MouseEvent) ; Simulate a mouse click @ Mouse pointer location
SetMouseWheel(Direction) ; Simulate the Mouse Wheel
PushMousePosition() ; Store the Location of the mouse cursor
PopMousePosition() ; Place the Location of the mouse cursor @ the location stored by PushMousePosition
SetMouseCursor(Type,WindowID=0) ; Set(change) the Mouse cursor with these constants :
SimulateKeyPress(vk, Delay, control, alt, shift) ; This function simulates a keypress with optional control, alt, and shift
LocaleDate(Mask.s,Date.l,lang.l,sublang.l=0) ; Return Date as String
Week(Date.l) ; Return the week number of the year
CaptureScreenPart(Left.l,Top.l,width.l,height.l) ; CaptureScreenPart : Returns pointer to BMP SnapShot
CaptureFullScreen() ; ; CaptureFullScreen : Returns pointer to BMP SnapShot
CaptureWindow(Handle.l) ; CaptureWindow : Returns pointer to BMP SnapShot
SaveCapture(File.s, ImagePlugin , JpegCompression) ; Saves previous capture to file
UnMountVolume(Drive.s) ; Unmount a VolumeName
MountVol(Drive.s,MountPoint.s) ; Mount a drive letter with specified MountPoint ( \\?\{xxxx )
MountListInit() ; This function gets VolumeNames ( from memory )
MountList() ; Each time this function is called, a VolumeName ( \\?\{xxxx ) is returned, when there are no more volumes to return, it returns an empty string
GetMountVolName(MountPoint.s) ; Returns a Drive Letter when specifiyng a MountPoint ( \\?\{xxxx )
DDebug(text.s) ; Adds Text to the Debugger buffer
DDebugShow() ; Shows the Debugger Text
DDebugClear() ; Clears the Debugger Text
DDebugGet() ; Returns the Debugger Text
DDebugLine() ; Adds a line to the Debugger Buffer
LocalTextInit(LocalLanguageIdentifier) ; Initialise the LocalText function with a Primary language identifier
LocalText(Local.s,International.s) ; Returns the correct text for the user's language
PrinterDelete(PrinterName.s) ; Deletes the printer
PrinterClearJobQueue(PrinterName.s) ; Clears the job queue of the printer
PrinterEnum() ; Each time this function is called, it returns a name of a printer( "" = you are @ the end of the list )
PrinterEnumGetPort() ; Retrieves the port of the printer currently listed with PrinterEnum()
HotKeysInit() ; Hotkeysinit() - initializes the hotkeys lib
HotKeyAdd(Window,vk,function,Name.s,shiftstate,altstate,controlstate); hotkeycheck() - checks to see if a hotkey event has been fired, if so, runs the function attached to the hotkey
HotkeyCheck(message, wparam) ; checks if a hotkey message is waiting, and if it is, runs the function attached to the hotkey
HotkeyWaitWindowEvent() ; hotkeywaitwindowevent() - uses the waitwindowevent() function to check if a hotkeymsg is there - if it is, runs the associated function
HotkeyWindowEvent() ; hotkeywindowevent() - uses the windowevent() function to check if a hotkey message is there - if it is, it runs the associated function
HotKeyRemove(Name.s) ; hotkeyremove() - this function removes the hotkey specified by name
HotKeyChangeFunction(Name.s, newfunc) ; Changes the function associated with the hotkey to the one specified by newfunc

Télécharger la DroopyLib sur le site de l'auteur
Ou
Télécharger la DroopyLib sur le FTP de DVP

Il s'agit d'un exécutable, qui permet soit d'installer directement la bibliothèque dans votre répertoire PureBasic (le chemin est demandé). Soit d'extraire l'archive.
L'archive contient la bibliothèque, un fichier résident, un fichier d'aide complet en anglais dans le format chm. Et les codes source !


Vous avez aimé cette actualité ? Alors partagez-la avec vos amis en cliquant sur les boutons ci-dessous :


 Poster une réponse

Avatar de PANORAMIC PANORAMIC - Membre habitué https://www.developpez.com
le 01/05/2011 à 10:43
Au téléchargement de Droopy.exe, j'ai 2 alertes d'Antivir Guard : contient le cheval de Troie TR/Dropper.Gen
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 01/05/2011 à 13:33
C'est pas nouveau , les fausses alertes sont fréquentes avec Antivir.

J'ai McAfee et il n'y a aucun souci.
Avatar de blendman blendman - Nouveau membre du Club https://www.developpez.com
le 07/05/2011 à 17:59
salut

Sous windows xp, avec pb 4.51 et pb 4.60beta2 ça marche super.

mais sous 7 et pb 4.60, j'ai une erreur : "polink - erreur droopy.lib"

elle ne marche pas en 64bits sous 7 avec pb 4.60beta2 ?

Je vais tester avec pb 4.51 pour voir (sous 7 toujours, en 64bits)
merci.
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 07/05/2011 à 19:58
Droopy a compilé sa bibliothèque avec la version 4.51 de PureBasic.

Il utilise PBFastLib pour créer sa bibliothèque, qui nécessite TailBite.

Pour l'instant la version 4.60 est en bêta, TailBite sera mis à jour quand une version stable sera sortie.

Maintenant si tu as besoin d'une fonction en particulier, les codes source sont dispo dans l'archive, tu as juste à extraire le code qui t'intéresse
Avatar de blendman blendman - Nouveau membre du Club https://www.developpez.com
le 08/05/2011 à 12:43
ok, finalement j'ai mis les procédures et structures nécessaires dans mon code, c'est super d'avoir mis les sources .
Car droopy lib ne marche pas avec mon 7 sous x64

Mais j'ai encore un problème lorsque je compile (polink error), visiblement lié à _pb_screen_direct3D (ou quelque chose comme ça...).
Même en 4.51
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 08/05/2011 à 15:51
Mais j'ai encore un problème lorsque je compile (polink error), visiblement lié à _pb_screen_direct3D (ou quelque chose comme ça...).
Même en 4.51

Sans un code source pour tester, difficile d'en dire plus
Avatar de blendman blendman - Nouveau membre du Club https://www.developpez.com
le 09/05/2011 à 12:19
Citation Envoyé par comtois  Voir le message
Sans un code source pour tester, difficile d'en dire plus

oui, je sais, mais mon code source est celui de mon jeu :p
(Donc 9000 lignes)

Il est possible que celui-ci (le code qui suit) ne marche pas non plus, mais je n'ai pas encore testé sous 7 (en x64). Sous xp, pas de soucis.
Ca a peut être un rapport avec directx9, pour changer la couleur d'un sprite (même si là, je ne m'en sers pas)

;{ ********************* variables ******************************
Global inscreen.b = 1
Global quit.b = 0

; pour la map

Global globalmap.b = 1
Global globalBg.b = 0

ShowCursor_(1)
;}

;{ DirectX9 , pour changer la couleur d'un sprite 3D !!

Structure D3DTLVERTEX
x.f
y.f
z.f
rhw.f
Color.l
tu.f
tv.f
EndStructure

Structure PB_DX9Sprite3D
TexRes.I ; TexRes
Vertice.D3DTLVERTEX[4] ; The 4 vertices for the rectangle sprite
TmpVertice.D3DTLVERTEX[4] ; The 4 vertices for the rectangle sprite
Width.l ; width set with ZoomSprite3D()
Height.l ; height set with ZoomSprite3D()
RealWidth.l
RealHeight.l
Angle.f
Transformed.l
EndStructure

Global D3Ddevice_interface9.IDirect3DDevice9

;}

;{ ********************* declare ********************************
Declare gestion_souris()
Declare Init()
Declare main1()
Declare main2()
Declare SpriteAdd()
Declare chargerSprite()
;}

;{ ********************* programmes ******************************
Init()
; 1er ecran (menu)
main1()

; jeu
main2()

End

;}

;{ ********************* procedures ******************************

Procedure main1()
OpenWindow(0,0,0,400,300,"test souris - ecran 1",#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget)
OpenWindowedScreen(WindowID(0),0,0,400,300,0,0,0)
SpriteAdd()
Repeat
ClearScreen(RGB(125,125,125))
event = WindowEvent()
ExamineMouse()
If MouseButton(#PB_MouseButton_Left)
quit = 1
EndIf
DisplaySprite(0,MouseX(),MouseY())
gestion_souris()
FlipBuffers()
Until event = #PB_Event_CloseWindow Or quit = 1
quit = 0

Repeat
ExamineMouse()
Until MouseButton(#PB_MouseButton_Left)=0

ReleaseMouse(1)
FreeSprite(0)
CloseScreen()
EndProcedure

Procedure main2()
OpenWindow(0,0,0,800,600,"test souris - ecran 2",#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget)
OpenWindowedScreen(WindowID(0),0,0,800,600,0,0,0)

Start3D()
!extrn _PB_Screen_Direct3DDevice
!MOV dword EAX, [_PB_Screen_Direct3DDevice]
!MOV dword [v_D3Ddevice_interface9],EAX
D3Ddevice_interface9\SetRenderState(22,1)
Stop3D()

chargerSprite()
SpriteAdd()
ReleaseMouse(0)

Repeat
ClearScreen(RGB(80,80,80))
event = WindowEvent()
ExamineKeyboard()
ExamineMouse()
If MouseButton(#PB_MouseButton_Left)
;quit = 1
EndIf
DisplaySprite(0,MouseX(),MouseY())
gestion_souris()
FlipBuffers()
Until event = #PB_Event_CloseWindow Or quit=1 Or KeyboardPushed(#PB_Key_Escape)
FreeSprite(0)
EndProcedure

Procedure gestion_souris()
mx = WindowMouseX(0):my = WindowMouseY(0)
If inscreen = 1
If mx>= WindowWidth(0)-4 Or my>= WindowHeight(0)-4 Or mx<=1 Or my<=1
inscreen = 0
ReleaseMouse(1) ; on libère la souris
EndIf
ElseIf (mx <WindowWidth(0)-4 And my < WindowHeight(0)-4 And mx > 0 And my > 0)
ReleaseMouse(0)
MouseLocate(mx,my)
inscreen = 1
EndIf
EndProcedure

Procedure init()
InitSprite() : InitSprite3D() : InitMouse(): InitKeyboard()
UseJPEGImageDecoder() : UsePNGImageDecoder()
EndProcedure

Procedure SpriteAdd()
CreateSprite(0,64,64,#PB_Sprite_Texture)
StartDrawing(SpriteOutput(0))
Box(0,0,64,64,RGB(255,200,150))
StopDrawing()
EndProcedure

Procedure chargerSprite()

EndProcedure
;}

Je testerai sous 7 pour voir si ça plante aussi en x64.
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 09/05/2011 à 20:28
J'ai testé le code sous seven. Alors il fonctionne bien avec la version x86, et j'ai le même message que toi avec la version x64.

---------------------------
PureBasic - Linker error
---------------------------
POLINK: error: Unresolved external symbol '_PB_Screen_Direct3DDevice'.

POLINK: fatal error: 1 unresolved external(s).

---------------------------
OK
---------------------------

En faisant une recherche, je suis tombé sur ce message


Avec dx7 c'était _PB_Direct3D_Device
Avec dx9 c'est '_PB_Screen_Direct3DDevice
Avec la version x64, ben , je ne sais pas. Et c'est pas sûr que la PB-team souhaite communiquer là dessus, mais tu peux toujours tenter ta chance
Avatar de blendman blendman - Nouveau membre du Club https://www.developpez.com
le 10/05/2011 à 9:11
Citation Envoyé par comtois  Voir le message
Et c'est pas sûr que la PB-team souhaite communiquer là dessus, mais tu peux toujours tenter ta chance

heu, pourquoi ne voudrait-il pas communiquer là-dessus ?
Ce serait quand même dommage de se priver de l'utilisation de ça en x64, car ça permet de faire plein de choses sur les sprites3D (couleurs, clipsprites3D, etc.. )

Merci en tout cas.
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 29/06/2011 à 23:45
Voici les nouveautés de la bibliothèque de Droopy :

29/06/11 : Library 4.51.004
String2Hex() Deleted, you should use UrlEncoder()
Hex2String() Deleted, you should use UrlDecoder()
Hex2Dec() Deleted, you should use Val($hh)
Bin2Dec() Deleted, you should use Val(%bbbbbbbb)
SuperRunas() Parameter 'Domain' added
AccountDisabled Added
DisableAccount Added
IsCapsLock() Added
IsNumLock() Added
IsScrollLock() Added
GetCurrentDnsServer() Added
GetInternetTime() Added
SetGadgetCursor Tips added
GetUserSid Added
UserGuid Removed (replaced by GetUserSid)
UacEnabled() Added
HideFromTaskBar() Added
NetJoinDomain Added
NetUnjoinDomain Added
NetJoinWorkgroup Added
NetGetJoinInformation Added
SysTrayIconBalloon Added
TaskbarProgress7 Tips Added
UserLogged() Added
WindowsThreaded Tips Added
CabExtract() Added
LogoffDetect Tips Added
SelfDelete Added
ServiceStart Added
ServiceStop Added
UseInternalIni Added
UseInternalIni Added
EditInternalIni Added
15/06/11 : Library 4.51.003
RunProgramEx added
24/05/11 : Library 4.51.002
GetMacAddress() Bug fixed

Offres d'emploi IT
Ingénieur analyste programmeur (H/F)
Safran - Auvergne - Montluçon (03100)
Consultant sap finance/controlling H/F
Safran - Ile de France - Vélizy-Villacoublay (78140)
Ingénieur H/F
Safran - Ile de France - Moissy-Cramayel (77550)

Voir plus d'offres Voir la carte des offres IT
Responsable bénévole de la rubrique PureBasic : comtois -