Page 2 sur 2

Publié : jeu. 06/nov./2008 23:42
par Cool Dji
Salut Kernadec

j'ai une erreur d'exécution :

ligne 390 Colorp=Point(1,1)
avec le message d'erreur :
StartDrawing() doit être appelé avant une fonction 2D

si j'enlève cette ligne, le prog tourne. Je ne comprends pas le sens du message d'erreur puisque tu fais appel à StartDrawing juste avant...

Sinon, je vais me lancer dans la construction d'un générateur de formes simples (comme celles qu'on trouve dans les champs) en superposant aléatoirement des figures géométriques simples.

Publié : ven. 07/nov./2008 5:13
par kernadec
bonjour Cool Dji
je te remercie de m'avoir prévenu. voila c'est corrigé

la fonction point(1,1) était isolée
justement hors startdrawing< >stopdrawing
je l'ai supprimée, je l'avais oubliée, pour le Stopdrawing
qui parait absent!! il est dans la procedure makescreen..

il faut être vigilant!!! et pourtant je teste toujours ce que je post
mais je n'avais pas tester mon code avec le debugger
cette fois ci ! ... donc rien vu?

j'ai tester le code sur une autre becane avec moins de memoire!
et j'avais aussi un bug avec la création d'image
alors je suis revenu a 16 images pour le mode restaure
j'étais en cours de recherche de ce bug, j'ai mis un peu de temps
a comprendre que c'était la mémoire,
car il me signalait image non initialisée alors qu'elle l'était????.
il m'arrive souvent d'être a côté de mes pompes

merci encore

Publié : ven. 07/nov./2008 9:04
par Cool Dji
il m'arrive souvent d'être a côté de mes pompes
Normal, si tu codes à 5h du mat !!!
Difficile de garder les yeux ouverts 8O

Publié : mar. 18/nov./2008 13:30
par kernadec
Bonjour
mise a jour du code
Avec vista il y a des différences d’interface avec XP
pour savoir si je suis avec vista ou XP je test si il y a un
répertoire sur « C:\ »:du nom : « Utilisateurs »,
celui que vista utilise a la place de « Document And Setting »
comme on ne trouve pas très souvent ce nom de répertoire sur XP

il manque a PureBasic une fonction pour tester et s’adapter a l’OS après ce test..
peut être quelle existe mais je ne l’ai pas trouvée.

il y avait aussi un problème de sauvegarde sur « C:\ » car Vista n’autorise pas
la création d’un fichier sur la racine d’un Disque Dur sans « l’autorisation
de l’administrateur »,.
Pour remédier a cela, un ajout d’une création de répertoire « DessinGeo »
Certaines souris ont besoin d'un réglage via le panneau de config.
au revoir

Publié : mar. 18/nov./2008 14:42
par Backup
ces 2 procedures font ressortir les dossiers utilisés par le system

je ne l'ai pas essayé avec vista, mais après tout, elles fonctionnent peut etre

ça te renvoi les différents chemins utilisé par le system

voir la liste des constantes, pour obtenir ce que tu veux !!

par defaut le prg est configuré pour le dossier "Document and setting"

Code : Tout sélectionner

Procedure.s SpecialFolder(folderno)
    listptr=0
    result$=Space(270)
    SHGetSpecialFolderLocation_(0,folderno,@listptr)
    SHGetPathFromIDList_(listptr,@result$)
    ProcedureReturn Trim(result$)
EndProcedure

MessageRequester("Bureau",SpecialFolder(#CSIDL_DESKTOP))

; If no Version number is specified, the programming element is implemented in all versions. the following table outlines the different DLL versions, And how they were distributed.
    
    ; Version  DLL  Distribution Platform
    ; 4.00 All          Microsoft® Windows® 95/Windows NT® 4.0.
    ; 4.70 All          Microsoft® Internet Explorer 3.x.
    ; 4.71 All          Microsoft® Internet Explorer 4.0 (see note 2).
    ; 4.72 All          Microsoft® Internet Explorer 4.01 And Windows® 98 (see note 2).
    ; 5.00 Shlwapi.dll  Microsoft® Internet Explorer 5 (see note 3).
    ; 5.00 Shell32.dll  Microsoft® Windows® 2000. (see note 3).
    ; 5.80 Comctl32.dll Microsoft® Internet Explorer 5 (see note 3).
    ; 5.81 Comctl32.dll Microsoft® Windows 2000 And Windows ME (see note 3).
    ; 6.00 Comctl32.dll Microsoft® Windows XP. See note 4.
    
    ; Note 1:
    ; The 4.00 versions of Shell32.dll And Comctl32.dll are found on the original versions of Windows 95 And Windows NT 4. New versions of Commctl.dll were shipped with all Internet Explorer releases. Shlwapi.dll first shipped with Internet Explorer 4.0, so its first version number is 4.71. The Shell was not updated with the Internet Explorer 3.0 release, so Shell32.dll does not have a version 4.70. While Shell32.dll versions 4.71 And 4.72 were shipped with the corresponding Internet Explorer releases, they were not necessarily installed (see note 2). For subsequent releases, the version numbers For the three DLLs are not identical. In general, you should assume that all three DLLs may have different version numbers, And test each one separately.
    
    ; Note 2:
    ; All systems with Internet Explorer 4.0 Or 4.01 will have the associated version of Comctl32.dll And Shlwapi.dll (4.71 Or 4.72, respectively). However, For systems prior To Windows 98, Internet Explorer 4.0 And 4.01 can be installed with Or without the integrated Shell. If they are installed with the integrated Shell, the associated version of Shell32.dll will be installed. If they are installed without the integrated Shell, Shell32.dll is not updated. In other words, the presence of version 4.71 Or 4.72 of Comctl32.dll Or Shlwapi.dll on a system does not guarantee that Shell32.dll has the same version number. All Windows 98 systems have version 4.72 of Shell32.dll.
    
    ; Note 3:
    ; Version 5.80 of Comctl32.dll And version 5.0 of Shlwapi.dll are distributed with Internet Explorer 5. They will be found on all systems on which Internet Explorer 5 is installed, except Windows 2000. Internet Explorer 5 does not update the Shell, so version 5.0 of Shell32.dll will not be found on Windows NT, Windows 95, Or Windows 98 systems. Version 5.0 of Shell32.dll will be distributed with Windows 2000 And Windows Me, along with version 5.0 of Shlwapi.dll, And version 5.81 of Comctl32.dll.
    
    ; Note 4:
    ; ComCtl32.dll version 6 is not redistributable. If you want your application To use ComCtl32.dll version 6, you must add an application manifest that indicates that version 6 should be used If it is available.
    
    ; Unknown at present:
    ; $0f, $32, $33, $34, $3c
    
    #CSIDL_DESKTOP=$00                  ; Windows desktop—virtual folder that is the root of the name space.
    #CSIDL_INTERNET=$01                 ; Virtual folder that represents the Internet.
    #CSIDL_PROGRAMS=$02                 ; File system directory that contains the user's program groups (which are also file system directories). A typical path is C:\Documents and Settings\username\Start Menu\Programs.
    #CSIDL_CONTROLS=$03                 ; Control Panel - virtual folder containing icons for the control panel applications.
    #CSIDL_PRINTERS=$04                 ; Printers folder - virtual folder containing installed printers.
    #CSIDL_PERSONAL=$05                 ; File system directory that serves as a common repository for documents. A typical path is C:\Documents and Settings\username\My Documents. This is different from the My Documents virtual folder in the name space. To access that virtual folder, use the technique described in Managing the File System.
    #CSIDL_FAVORITES=$06                ; File system directory that serves as a common repository for the user's favourite items. A typical path is C:\Documents and Settings\username\Favorites. (Version 6.0. This is equivalent to CSIDL_MYDOCUMENTS)
    #CSIDL_STARTUP=$07                  ; File system directory that corresponds to the user's Startup program group. The system starts these programs whenever any user logs onto Microsoft® Windows NT® or starts Microsoft® Windows® 98. A typical path is C:\Documents and Settings\username\Start Menu\Programs\Startup
    #CSIDL_RECENT=$08                   ; File system directory that contains the user's most recently used documents. A typical path is C:\Documents and Settings\username\Recent. To create a shortcut in this folder, use SHAddToRecentDocs. In addition to creating the shortcut, this function updates the Shell's list of recent documents and adds the shortcut to the Documents submenu of the Start menu.
    #CSIDL_SENDTO=$09                   ; File system directory that contains Send To menu items. A typical path is C:\Documents and Settings\username\SendTo.
    #CSIDL_BITBUCKET=$0A                ; Virtual folder that contains the objects in the user's Recycle Bin.
    #CSIDL_STARTMENU=$0B                ; File system directory that contains Start Menu items. A typical path is C:\Documents and Settings\username\Start Menu.
    #CSIDL_MYDOCUMENTS=$0C              ; Virtual folder that contains the objects in the user's My Documents folder.
    #CSIDL_MYMUSIC=$0D                  ; File system directory that serves as a common repository for music files. A typical path is C:\My Music.
    #CSIDL_MYVIDEO=$0E                  ; File system directory that serves as a common repository for video files.
    #CSIDL_DESKTOPDIRECTORY=$10         ; File system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself). A typical path is C:\Documents and Settings\username\Desktop
    #CSIDL_DRIVES=$11                   ; My Computer - virtual folder containing everything on the local computer: storage devices, printers, and Control Panel. The folder may also contain mapped network drives.
    #CSIDL_NETWORK=$12                  ; Network Neighborhood—virtual folder that represents the root of the network namespace hierarchy.
    #CSIDL_NETHOOD=$13                  ; A file system folder that contains the link objects that can exist in the My Network Places virtual folder. It is not the same as CSIDL_NETWORK, which represents the network namespace root. A typical path is C:\Documents and Settings\username\NetHood.
    #CSIDL_FONTS=$14                    ; Virtual folder that contains fonts. A typical path is C:\WINNT\Fonts.
    #CSIDL_TEMPLATES=$15                ; File system directory that serves as a common repository for document templates.
    #CSIDL_COMMON_STARTMENU=$16         ; File system directory that contains the programs and folders that appear on the Start Menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu. Valid only for Windows NT systems.
    #CSIDL_COMMON_PROGRAMS=$17          ; File system directory that contains the directories for the common program groups that appear in the Start Menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs. Valid only for Windows NT systems.
    #CSIDL_COMMON_STARTUP=$18           ; File system directory that contains the programs that appear in the Startup folder for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows NT systems.
    #CSIDL_COMMON_DESKTOPDIRECTORY=$19  ; File system directory that contains files and folders that appear on the desktop for all users. A typical path is C:\Documents and Settings\All Users\Desktop. Valid only for Windows NT systems.
    #CSIDL_APPDATA=$1A                  ; Version 4.71. File system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings\username\Application Data. This CSIDL is supported by the redistributable ShFolder.dll for systems that do not have the Microsoft® Internet Explorer 4.0 integrated Shell installed.
    #CSIDL_PRINTHOOD=$1B                ; File system directory that contains the link objects that can exist in the Printers virtual folder. A typical path is C:\Documents and Settings\username\PrintHood.
    #CSIDL_LOCAL_APPDATA=$1C            ; Version 5.0. File system directory that serves as a data repository for local (nonroaming) applications. A typical path is C:\Documents and Settings\username\Local Settings\Application Data.
    #CSIDL_ALTSTARTUP=$1D               ; File system directory that corresponds to the user's nonlocalized Startup program group.
    #CSIDL_COMMON_ALTSTARTUP=$1E        ; File system directory that corresponds to the nonlocalized Startup program group for all users. Valid only for Windows NT systems.
    #CSIDL_COMMON_FAVORITES=$1F         ; File system directory that serves as a common repository for all user's favorite items. Valid only for Windows NT systems.
    #CSIDL_INTERNET_CACHE=$20           ; Version 4.72. File system directory that serves as a common repository for temporary Internet files. A typical path is C:\Documents and Settings\username\Temporary Internet Files.
    #CSIDL_COOKIES=$21                  ; File system directory that serves as a common repository for Internet cookies. A typical path is C:\Documents and Settings\username\Cookies.
    #CSIDL_HISTORY=$22                  ; File system directory that serves as a common repository for Internet history items.
    #CSIDL_COMMON_APPDATA=$23           ; Version 5.0. Application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data.
    #CSIDL_WINDOWS=$24                  ; Version 5.0. Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. A typical path is C:\WINNT.
    #CSIDL_SYSTEM=$25                   ; Version 5.0. System folder. A typical path is C:\WINNT\SYSTEM32.
    #CSIDL_PROGRAM_FILES=$26            ; Version 5.0. Program Files folder. A typical path is C:\Program Files.
    #CSIDL_MYPICTURES=$27               ; Version 5.0. My Pictures folder. A typical path is C:\Documents and Settings\username\My Documents\My Pictures.
    #CSIDL_PROFILE=$28                  ; Version 5.0. User's profile folder.
    #CSIDL_SYSTEMX86=$29                ; The x86 system directory on Reduced Instruction Set Computer (RISC) systems.
    #CSIDL_PROGRAM_FILESX86=$2A         ; The x86 Program Files folder on RISC systems.
    #CSIDL_PROGRAM_FILES_COMMON=$2B     ; Version 5.0. A folder for components that are shared across applications. A typical path is C:\Program Files\Common. Valid only for Windows NT and Windows 2000 systems.
    #CSIDL_PROGRAM_FILES_COMMONX86=$2C  ; The x86 Program Files Common folder on RISC systems.
    #CSIDL_COMMON_TEMPLATES=$2D         ; File system directory that contains the templates that are available to all users. A typical path is C:\Documents and Settings\All Users\Templates. Valid only for Windows NT systems.
    #CSIDL_COMMON_DOCUMENTS=$2E         ; File system directory that contains documents that are common to all users. Typical paths are C:\Documents and Settings\All Users\Documents. Valid for Windows NT systems and Windows 95 and Windows 98 systems with Shfolder.dll installed
    #CSIDL_COMMON_ADMINTOOLS=$2F        ; Version 5.0. File system directory that contains administrative tools for all users.
    #CSIDL_ADMINTOOLS=$30               ; Version 5.0. File system directory used to store administrative tools for an individual user. The Microsoft Management Console (MMC) saves customized consoles to this directory, and it roams with the user.
    #CSIDL_CONNECTIONS=$31              ; Virtual folder that contains network and dial-up connections.
    #CSIDL_COMMON_MUSIC=$35             ; Version 6.0. My Music folder for all users.
    #CSIDL_COMMON_PICTURES=$36          ; Version 6.0. My Pictures folder for all users.
    #CSIDL_COMMON_VIDEO=$37             ; Version 6.0. My Video folder for all users.
    #CSIDL_RESOURCES=$38                ; System resource directory. A typical path is C:\WINNT\Resources.
    #CSIDL_RESOURCES_LOCALIZED=$39      ; Localized resource directory.
    #CSIDL_COMMON_OEM_LINKS=$3A         ; Folder containing links to OEM specific applications for all users
    #CSIDL_CDBURN_AREA=$3B              ; Version 6.0. File system folder used to hold data for burning to a CD. Typically [User Profile Folder]\Local Settings\Applications Data\Microsoft\CD Burning.
    #CSIDL_COMPUTERSNEARME=$3D          ; Computers Near Me folder. Virtual folder that contains links to nearby computers on the network. Nearness it is established by common work group membership
    #CSIDL_PROFILES=$3E                 ; Version 6.0. The file system directory containing user profile folders. A typical path is C:\Documents and Settings.
    
    #CSIDL_FLAG_PER_USER_INIT=$800      ; Combine this flag with the desired CSIDL_ value to indicate per-user initialization.
    #CSIDL_FLAG_NO_ALIAS=$1000          ; Combine this flag with the desired CSIDL_ value to force a non-alias version of the PIDL.
    #CSIDL_FLAG_DONT_VERIFY=$4000       ; Combine this flag with the desired CSIDL_ value to return an unverified folder path.
    #CSIDL_FLAG_CREATE=$8000            ; Version 5.0. Combine this flag with the desired CSIDL_ value to force the creation of the associated folder.
    #CSIDL_FLAG_MASK=$FF00              ; Mask for all possible CSIDL flag values
    
    ; ************************ ou bien ************************************************
    
    Procedure.s SpecialFolder2(folderno)
        listptr=0
        result$=Space(270)
        SHGetSpecialFolderLocation_(0,folderno,@listptr)
        SHGetPathFromIDList_(listptr,@result$)
        ProcedureReturn Trim(result$)
    EndProcedure
    
    Debug("#CSIDL_DESKTOP:"+SpecialFolder(#CSIDL_DESKTOP))
    Debug("#CSIDL_COMMON_PICTURES:"+SpecialFolder(#CSIDL_COMMON_PICTURES))
    Debug("#CSIDL_PROGRAMS:"+SpecialFolder(#CSIDL_PROGRAMS))
    Debug("#CSIDL_HISTORY:"+SpecialFolder(#CSIDL_HISTORY))
    
    
    MessageRequester("Program Files",SpecialFolder2(#CSIDL_COMMON_PROGRAMS)) 
    
    ; ************ ou bien ******************************
    Procedure.s GetSpecialFolderPath(CSIDL.l)
        Protected Path.s = Space(#MAX_PATH * SizeOf(Character))
        Protected Library = OpenLibrary(#PB_Any, "shell32.dll")
        If Library
            CompilerIf #PB_Compiler_Unicode
                CallFunctionFast(GetFunction(Library,"SHGetSpecialFolderPathW"), 0, @Path, CSIDL, 0)
            CompilerElse
                CallFunctionFast(GetFunction(Library,"SHGetSpecialFolderPathA"), 0, @Path, CSIDL, 0)
            CompilerEndIf
            CloseLibrary(Library)
        EndIf
        If Right(Path, 1) <> "\" : Path + "\" : EndIf
        ProcedureReturn Path
    EndProcedure
    
    Debug GetSpecialFolderPath(#CSIDL_PROGRAM_FILES)
    
    
    ; contenue de la corbeille
    RunProgram("explorer.exe","::{645FF040-5081-101B-9F08-00AA002F954E}","")
    

Publié : mar. 18/nov./2008 16:37
par kernadec
bjr et merci debro
genial je vais etudier tout ca

remise a jour

Publié : sam. 30/mai/2009 9:56
par kernadec
bonjour
pas bcp de temps pour programmer ces temps-ci!
le code en PB420 a été mis à jour
correction de la saisie cadre clipboard et des lignes chainéez sans
intervalles blanc, CoolDJ m'avait indiqué ce problème
et d'autres petites rectifs pour le passage en PB430

ce code est déjà long.. et pour éviter de rajouter une version PB430 à la suite,
le plus simple etait de rester en version PB420 et de résumer les quelques
corrections pour sa conversion en PB430. alors que l'inverse est moins évident!

j'en profite aussi pour remercié " Erix14 "
pour son module Mozilla qui donne des couleurs a nos codes sur ce forum

cordialement

Code : Tout sélectionner

;---------- PB420
;162 For i=1 To CountList(DrawX()) - 1 

;++++++++++ PB430
;162 For i=1 To ListSize(DrawX()) - 1 


;---------- PB420
;433  Select ChildWindowFromPoint_(hwnd,cursorpos\x,cursorpos\y)
;434      Case Zonedessin   : SetCursor_(cur1)


;++++++++++ PB430
;le code a changé pour la ligne 433 avec ceci ","en"|" et ajout de "<<32"
;433  Select ChildWindowFromPoint_(hwnd,cursorpos\x|cursorpos\y<<32)
;434      Case hwnd         : SetCursor_(cur1)   ;"Zonedessin" par "hwnd"


;---------- PB420 
;797   Select EventType()
;798     Case #PB_EventType_LeftClick
;{
;}
;851   EndSelect

;++++++++++ PB430  
;suppression des 3 lignes de code PB420 remplacées par la ligne suivante:
;797   Case #WM_LBUTTONDOWN   ; commande qui fonctionne à présent? 


;++++++++++ PB430
;resteras la suppression des "CreateGadgetList()"