Normalement, les fichiers ressources ont l'extension RC et suivent certaines regles (il est préférable d'utiliser un éditeur de ressource pour créer le fichier rc).
Les fichiers résidents PB (.res) ne sont pas des ressources mais suivent un codage propre à Fred qui évolue et fonction des versions de PB. A l'intérieur des res on y trouve des constantes, structures, macro etc.
Voilà les type de ressoures (au sens de MS) que j'ai mis en enumeration, il y a pas mal de possibilités.
Code : Tout sélectionner
Enumeration ; RessourceType, WinUser.h
#RT_CURSOR = 1
#RT_BITMAP = 2
#RT_ICON = 3
#RT_MENU = 4
#RT_DIALOG = 5
#RT_STRING = 6
#RT_FONTDIR = 7
#RT_FONT = 8
#RT_ACCELERATOR = 9
#RT_RCDATA = 10
#RT_MESSAGETABLE = 11
#RT_GROUP_CURSOR = 12
#RT_GROUP_ICON = 14
#RT_VERSION = 16
#RT_DLGINCLUDE = 17
#RT_PLUGPLAY = 19
#RT_VXD = 20
#RT_ANICURSOR = 21
#RT_ANIICON = 22
#RT_HTML = 23
#RT_MANIFEST = 24
EndEnumeration
le stockage RCDATA est une manière de stocker des données brutes en suivant les règles de MS (voir ici)
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
Si on veux stocker des icônes il est mieux d'utiliser #RT_ICON en association avec #RT_GROUP_ICON pour le classement etc.
Voici un exemple de fichier RC que j'utilise dans l'application sur laquelle je travaille , exemple avec RCDATA
Code : Tout sélectionner
#include "resource.h"
#define folder_explorer 0
#define Extraire 1
#define Convertir 2
#define Favoris 3
#define Tools 4
#define Aide 5
#define Apropos 6
#define Quit 7
#define Icone_vierge 20
#define FlecheUp 21
#define FlecheDown 22
#define Empy_dll 30
#define IID_IStorage 40
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
// Les images PNG de la barre d'outils
folder_explorer RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\Folder ouvrir.png"
Extraire RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\Extraire.png"
Convertir RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\Convertir.png"
Favoris RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\Favoris.png"
Tools RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\Tools.png"
Aide RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\Aide.png"
Apropos RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\logo_PB.png"
Quit RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\exit_32x32.png"
// Les icônes
Icone_vierge RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\Icone_vierge.ico"
FlecheUp RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\ArrowUp.ico"
FlecheDown RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\ArrowDown.ico"
// la dll vide
Empy_dll RCDATA "K:\\PureBasic\\Projets\\Editeur d icones\\PureIconManager\\PureIconManger_Tool\\EXAMPLES\\Icone_barre_outils\\EmptyDll.pak"
// Définition des GUID
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IID_IStorage RCDATA
{
11L, 0L, 192L, 1174405120L
// équivalent à DefineGUID(IID_IStorage, $0000000B, $0000, $0000, $C0, $00, $00, $00, $00, $00, $00, $46)
}
exemple avec une STRINGTABLE qui me permet de gérer mes message d'erreurs, une partie en français (utilisation de LANGUAGE LANG_FRENCH, LOCALE_USER_DEFAULT) et pour les autres language non français LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL.
En fait j'ai mis le maximum de chose dans le fichier RC au lieu des datas de PB
Code : Tout sélectionner
#include "resource.h"
// ***************************************************************************
// **************************** Codes d'Erreurs ******************************
// offset_Table permet de commencer la stringtable avec l’id 1
#define offset_Table 1
#define Error_Code_No_Error 0 + offset_Table
#define Error_Code_No_Icon 1 + offset_Table
#define Error_Code_Unable_To_Allocate_Memory 2 + offset_Table
#define Error_Code_Unable_To_Allocate_Memory_For_File 3 + offset_Table
#define Error_Code_Unable_To_Create_File 4 + offset_Table
#define Error_Code_No_GroupNames 5 + offset_Table
#define Error_Code_Bad_Memory_Copy 6 + offset_Table
#define Error_Code_Bad_Parameter_Value 7 + offset_Table
#define Error_Code_Integrity 8 + offset_Table
#define Error_Code_No_Icon_Group Error_Code_Integrity
#define Error_Code_Reading_Writing_Over_LastMemoryFileAdress 9 + offset_Table
#define Error_Code_OFFSET_NULL_NE_File 10 + offset_Table
#define Error_Code_rnLength_NULL_NE_File 11 + offset_Table
#define Error_Code_DWORD_IMAGE_NT_SIGNATURE 12 + offset_Table
#define Error_Code_IMAGE_FILE_MACHINE_I386 13 + offset_Table
#define Error_Code_IMAGE_DOS_SIGNATURE 14 + offset_Table
#define Error_Code_rscTypes_Not_Null 15 + offset_Table
#define Error_Code_rscEndNames_Not_Null 16 + offset_Table
#define Error_Code_Unable_to_find_Id 17 + offset_Table
#define Error_Code_First_NameGroupe_buffer_Null 18 + offset_Table
#define Error_Code_Too_Many_GroupNames 19 + offset_Table
#define Error_Code_Format 20 + offset_Table
#define Error_Code_Format_Signature_MemIconDir 21 + offset_Table
#define Error_Code_Resource_Type_RT_ICON_lacking 22 + offset_Table
#define Error_Code_ICON_Number 23 + offset_Table
#define Error_Code_LoadLibraryEx 24 + offset_Table
#define Error_Code_EnumResourceNames 25 + offset_Table
#define Error_Code_FindResource 26 + offset_Table
#define Error_Code_LoadResource 27 + offset_Table
#define Error_Code_LockResource 28 + offset_Table
#define Error_Code_SizeofResource 29 + offset_Table
#define Error_Code_SetFilePointer 30 + offset_Table
#define Error_Code_ReadFile_Open 31 + offset_Table
#define Error_Code_CreateIcon_Failed 32 + offset_Table
#define Error_Code_Format_Signature_PNG 33 + offset_Table
#define Error_Code_Pointeur_Null 34 + offset_Table
#define Error_Code_Unable_To_Create_PB_Image 35 + offset_Table
#define Error_Bad_File_Name 36 + offset_Table
#define Error_Code_Unable_To_Create_Icone 37 + offset_Table
#define Error_Code_Icon_number_Position 38 + offset_Table
#define Error_Code_Format_Signature_IconDir 39 + offset_Table
#define Error_Code_Unable_To_Get_Icon_Info 40 + offset_Table
#define Error_Code_FileFormat_UnKnow 41 + offset_Table
#define Error_Code_ICON_Number_Integrity 42 + offset_Table
#define Error_RESOURCE_TABLE_rscAlignShift 43 + offset_Table
#define Error_Code_Writing_Ico_Header_File 44 + offset_Table
#define Error_Code_Segment_IHDR_attendu 45 + offset_Table
#define Error_Code_Writing_ICONDIRENTRY_To_File 46 + offset_Table
#define Error_Offset__Resource_Table_Null 47 + offset_Table
#define Error_Code_Bad_Datas_file_written 48 + offset_Table
#define Error_Code_Unable_To_unpack_PngImage 49 + offset_Table
#define Error_Code_Unable_To_Open_File 50 + offset_Table
#define Error_Code_IMAGE_PE_SIGNATURE 51 + offset_Table
#define Error_Code_Bad_File_Size_Or_No_File_Found 52 + offset_Table
#define Error_Code_API_ReaFile_Failure 53 + offset_Table
#define Error_Code_Format_ImageSize 54 + offset_Table
#define Error_Code_Format_ImageOffset 55 + offset_Table
#define Error_Code_Format_Ressource 56 + offset_Table
#define Error_Unable_to_Create_CompatibleDC 57 + offset_Table
#define Error_Unable_to_Create_Stream 58 + offset_Table
#define Error_Unable_to_Seek_StreamPointer 59 + offset_Table
#define Error_Code_Reading_Ico_Header_File 60 + offset_Table
#define Error_Unable_to_Read_StreamDatas 61 + offset_Table
#define Error_Unable_to_Get_BitmapInformation 62 + offset_Table
#define Error_Unable_to_Create_CompatibleBitmap 63 + offset_Table
#define Error_Bad_Pointer_Value 64 + offset_Table
#define Error_OS2_SIGNATURE 65 + offset_Table
#define Error_Code_EnumResourceTypes 66 + offset_Table
#define Error_Code_Resource_Type_RT_GROUP_ICON_lacking 67 + offset_Table
#define Error_Code_Unable_to_Update_Resource 68 + offset_Table
#define Error_Bad_File_Format 69 + offset_Table
#define Error_Bad_Parameter 70 + offset_Table
#define Error_Code_User_Stop_Enumeration 71 + offset_Table
#define Error_Code_Unable_To_Create_PB_ImageGadget_Icons 72 + offset_Table
#define Error_Code_Unable_To_Open_Ole32_dllFile 73 + offset_Table
#define Error_System 74 + offset_Table
#define Error_Unable_to_Write_StreamDatas 75 + offset_Table
LANGUAGE LANG_FRENCH, LOCALE_USER_DEFAULT
STRINGTABLE
{
Error_Code_No_Error, "Pas d'erreur détectée"
Error_Code_No_Icon, "Le fichier ne comporte pas d'icône"
Error_Code_Unable_To_Allocate_Memory, "Impossible d'allouer de la mémoire pour les opérations (erreur système)"
Error_Code_Unable_To_Allocate_Memory_For_File, "Impossible d'allouer de la mémoire pour le fichier (erreur système)"
Error_Code_Unable_To_Create_File, "Impossible de créer un fichier (erreur système)"
Error_Code_No_GroupNames, "Le fichier NE ne possède pas de noms de groupes d'icônes"
Error_Code_Bad_Memory_Copy, "Erreur de copie des données en mémoire (erreur système)"
Error_Code_Bad_Parameter_Value, "Mauvaise valeur d'un paramètre d'entrée d'une foncion (erreur interne)"
Error_Code_No_Icon_Group, "Le fichier n'a pas de groupe d'icônes"
Error_Code_Reading_Writing_Over_LastMemoryFileAdress, "Erreur de format (dépassement en lecture/écriture de la zone mémoire)"
Error_Code_OFFSET_NULL_NE_File, "Erreur de format du fichier ICL 16 bits (position des informations sur l'image)"
Error_Code_rnLength_NULL_NE_File, "Erreur de format du fichier ICL 16 bits (longueur nulle des données)"
Error_Code_DWORD_IMAGE_NT_SIGNATURE, "Erreur de format du fichier (signature NT absente du header)"
Error_Code_IMAGE_FILE_MACHINE_I386, "Erreur de format du fichier PE (identifiant 'MACHINE_I386' absent)"
Error_Code_IMAGE_DOS_SIGNATURE, "Erreur de format du fichier (signature MS-DOS absente)"
Error_Code_rscTypes_Not_Null, "Erreur de format du fichier ICL (mauvais identifiant de la ressource)"
Error_Code_rscEndNames_Not_Null, "Erreur de format du fichier ICL (mauvais identifiant de fin zone des noms)"
Error_Code_Unable_to_find_Id, "Erreur, Identifiant non trouvé"
Error_Code_First_NameGroupe_buffer_Null, "Erreur de format du fichier ICL (mauvais identifiant de noms de groupe)"
Error_Code_Too_Many_GroupNames, "Erreur de format du fichier ('RT_ICON' ou 'RT_ICON_GROUP')"
Error_Code_Format, "Erreur de format du fichier"
Error_Code_Format_Signature_MemIconDir, "Erreur de format du fichier (integrité du header)"
Error_Code_Resource_Type_RT_ICON_lacking, "Erreur, le fichier ne comporte pas d'icônes"
Error_Code_ICON_Number, "Erreur de format du fichier ICL (mauvais nombre d'icônes RT_ICON/RT_ICON_GROUP)"
Error_Code_LoadLibraryEx, "Erreur de chargement du fichier (resource)"
Error_Code_EnumResourceNames, "Erreur d'énumération (resource)"
Error_Code_FindResource, "Erreur de localisation (resource)"
Error_Code_LoadResource, "Erreur de chargement (resource)"
Error_Code_LockResource, "Erreur de chargement (resource)"
Error_Code_SizeofResource, "Erreur de taille (resource)"
Error_Code_SetFilePointer, "Erreur de déplacement du pointeur de fichier"
Error_Code_ReadFile_Open, "Erreur de lecture du fichier"
Error_Code_CreateIcon_Failed, "Impossible de créer l'icône"
Error_Code_Format_Signature_PNG, "Erreur de format du fichier (mauvais identifiant de l'image PNG)"
Error_Code_Pointeur_Null, "Erreur pointeur null"
Error_Code_Unable_To_Create_PB_Image, "Impossible de créer une image (erreur système)"
Error_Bad_File_Name, "Nom de fichier incorrect"
Error_Code_Unable_To_Create_Icone, "Impossible de créer une icône Vista"
Error_Code_Icon_number_Position, "Mauvais nombre d'icônes ou la position de l'icône est en dehors des indices"
Error_Code_Format_Signature_IconDir, "Erreur de format du fichier ICO (integrité du header)"
Error_Code_Unable_To_Get_Icon_Info, "impossible d'obtenir les information sur l'icône (erreur système)"
Error_Code_FileFormat_UnKnow, "Le Format du fichier ne correspond pas au format image attendu"
Error_Code_ICON_Number_Integrity, "Erreur de format du fichier (nombre d'icônes du groupe inférieur ou égal à 0)"
Error_RESOURCE_TABLE_rscAlignShift, "Erreur intégrité du header NE, mauvaise valeur du décalage"
Error_Code_Writing_Ico_Header_File, "Erreur d'écriture du fichier .ico (zone Header)"
Error_Code_Segment_IHDR_attendu, "Erreur de format du fichier (mauvais identifiant du segment 'IHDR')"
Error_Code_Writing_ICONDIRENTRY_To_File, "Erreur d'écriture du fichier .ico (zone ICONDIRENTRY)"
Error_Offset__Resource_Table_Null, "Erreur intégrité du header NE, l'offset de la table des ressource est null"
Error_Code_Bad_Datas_file_written, "Erreur d'écriture des données dans le fichier (erreur système)"
Error_Code_Unable_To_unpack_PngImage, "Impossible de décompresser l'icône Vista"
Error_Code_Unable_To_Open_File, "Erreur d'ouverture du fichier (erreur système)"
Error_Code_IMAGE_PE_SIGNATURE, "Erreur de format du fichier PE (mauvaise signature)"
Error_Code_Bad_File_Size_Or_No_File_Found, "Erreur sur la taille du fichier ou fichier inexistant"
Error_Code_API_ReaFile_Failure, "Impossible de charger le fichier en mémoire"
Error_Code_Format_ImageSize, "Erreur de format du fichier (taille de l'image)"
Error_Code_Format_ImageOffset, "Erreur de format du fichier (position de l'image dans le fichier)"
Error_Code_Format_Ressource, "Erreur de format du fichier .ico (taille de la ressource)"
Error_Unable_to_Create_CompatibleDC, "Impossible de créer un contexte de périphérique (erreur système)"
Error_Unable_to_Create_Stream, "Impossible de créer un stream (erreur système)"
Error_Unable_to_Seek_StreamPointer, "Impossible de déplacer le pointeur de stream"
Error_Code_Reading_Ico_Header_File, "Impossible de déplacer le pointeur de stream (erreur système)"
Error_Unable_to_Read_StreamDatas, "Impossible de lire les données depuis le stream"
Error_Unable_to_Get_BitmapInformation, "Impossible d'obtenir les informations du bitmap"
Error_Unable_to_Create_CompatibleBitmap, "Impossible de créer un bitmap (erreur système)"
Error_Bad_Pointer_Value, "Mauvaise valeur de pointeur"
Error_OS2_SIGNATURE, "Erreur intégrité du header NE, signature OS2 absente"
Error_Code_EnumResourceTypes, "Erreur d'énumération des types (resource)"
Error_Code_Resource_Type_RT_GROUP_ICON_lacking, "Le fichier ne comporte pas de groupes d'icône"
Error_Code_Unable_to_Update_Resource, "impossible de mettre à jour la resource"
Error_Bad_File_Format, "Le format du fichier est incorrect"
Error_Bad_Parameter, "Un des paramètre de la fonction est incorrect"
Error_Code_User_Stop_Enumeration, "La callback d'énumération a été arrêtée par l'utilisateur"
Error_Code_Unable_To_Create_PB_ImageGadget_Icons, "Impossible de créer une la fenêtre contenant les icônes (erreur système)"
Error_Code_Unable_To_Open_Ole32_dllFile, "Impossible d'ouvrir le fichier système 'Ole32.dll'"
Error_System, "Erreur système indéterminée"
Error_Unable_to_Write_StreamDatas, "Impossible d'écrire les données dans le stream"
}
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
STRINGTABLE
{
Error_Code_No_Error, "No error detected"
Error_Code_No_Icon, "The file has no icon"
Error_Code_Unable_To_Allocate_Memory, "Unable to allocate memory (system error)"
Error_Code_Unable_To_Allocate_Memory_For_File, "Unable to allocate memory for file operations (system error)"
Error_Code_Unable_To_Create_File, "Unable to create file (system error)"
Error_Code_No_GroupNames, "NE file has no icons groups names"
Error_Code_Bad_Memory_Copy, "Copy memory data error (system error)"
Error_Code_Bad_Parameter_Value, "Bad parameter value (internal error)"
Error_Code_No_Icon_Group, "The file has no icons groups"
Error_Code_Reading_Writing_Over_LastMemoryFileAdress, "Format error (read/write memory overflow)"
Error_Code_OFFSET_NULL_NE_File, "ICL NE file format error (bad image information position)"
Error_Code_rnLength_NULL_NE_File, "ICL NE file format error (size data is equal to null)"
Error_Code_DWORD_IMAGE_NT_SIGNATURE, "File format error (NT signature lacking - header file)"
Error_Code_IMAGE_FILE_MACHINE_I386, "PE file format error ('MACHINE_I386' identifier lacking)"
Error_Code_IMAGE_DOS_SIGNATURE, "File format error (MS-DOS signature lacking)"
Error_Code_rscTypes_Not_Null, "ICL file format error (bad resource identifier)"
Error_Code_rscEndNames_Not_Null, "ICL file format error (bad identifier of end names area)"
Error_Code_Unable_to_find_Id, "Error, identifier not found"
Error_Code_First_NameGroupe_buffer_Null, "ICL file format error (bad identifier of group names)"
Error_Code_Too_Many_GroupNames, "File format error ('RT_ICON' or 'RT_ICON_GROUP')"
Error_Code_Format, "File format error"
Error_Code_Format_Signature_MemIconDir, "File format error (header integrity)"
Error_Code_Resource_Type_RT_ICON_lacking, "The file has no icons"
Error_Code_ICON_Number, "ICL file format error (bad icons number RT_ICON/RT_ICON_GROUP)"
Error_Code_LoadLibraryEx, "Loading resource file error"
Error_Code_EnumResourceNames, "Enumeration error (resource)"
Error_Code_FindResource, "Unable to find resource"
Error_Code_LoadResource, "Unable to load resource"
Error_Code_LockResource, "Unable to find memory resource adress"
Error_Code_SizeofResource, "Resource size error"
Error_Code_SetFilePointer, "Pointer move error"
Error_Code_ReadFile_Open, "Read file error"
Error_Code_CreateIcon_Failed, "Unable to create icon"
Error_Code_Format_Signature_PNG, "File format error (bad PNG image identifier)"
Error_Code_Pointeur_Null, "Bad pointer value (null)"
Error_Code_Unable_To_Create_PB_Image, "Unable to create an image (system error)"
Error_Bad_File_Name, "Bad File name"
Error_Code_Unable_To_Create_Icone, "Unable to create a Vista icon"
Error_Code_Icon_number_Position, "Bad icons number or icon position outside indices"
Error_Code_Format_Signature_IconDir, "ICO file format error (header integrity)"
Error_Code_Unable_To_Get_Icon_Info, "Unable to get icon informations (system error)"
Error_Code_FileFormat_UnKnow, "File format doesn't match with awaited image format"
Error_Code_ICON_Number_Integrity, "File format error (icons number from group is less or equal to 0)"
Error_RESOURCE_TABLE_rscAlignShift, "NE header integrity error (bad offset value)"
Error_Code_Writing_Ico_Header_File, "Write ICO file error (Header)"
Error_Code_Segment_IHDR_attendu, "File format error (bad 'IHDR' chunk identifier)"
Error_Code_Writing_ICONDIRENTRY_To_File, "Write ICO file error (ICONDIRENTRY area)"
Error_Offset__Resource_Table_Null, "NE header integrity error (offset of resource table is null)"
Error_Code_Bad_Datas_file_written, "Writing datas file error (system error)"
Error_Code_Unable_To_unpack_PngImage, "Unable to unpack Vista icon"
Error_Code_Unable_To_Open_File, "Opening file error (system error)"
Error_Code_IMAGE_PE_SIGNATURE, "PE file format error (bad signature)"
Error_Code_Bad_File_Size_Or_No_File_Found, "File size error or file doesn't exist"
Error_Code_API_ReaFile_Failure, "Unable to load file in memory"
Error_Code_Format_ImageSize, "File format error (image size)"
Error_Code_Format_ImageOffset, "File format error (bad image position)"
Error_Code_Format_Ressource, "ICO file format error (resource size)"
Error_Unable_to_Create_CompatibleDC, "Unable to create a device context (system error)"
Error_Unable_to_Create_Stream, "Unable to create a stream (system error)"
Error_Unable_to_Seek_StreamPointer, "Unable to adjust stream seek pointer"
Error_Code_Reading_Ico_Header_File, "Unable to adjust ICO stream seek pointer(system error)"
Error_Unable_to_Read_StreamDatas, "Unable to read stream datas"
Error_Unable_to_Get_BitmapInformation, "Unable to get bitmap informations"
Error_Unable_to_Create_CompatibleBitmap, "Unable to create bitmap (system error)"
Error_Bad_Pointer_Value, "Bad pointeur value"
Error_OS2_SIGNATURE, "NE header Integrity error (OS2 signature OS2 lacking"
Error_Code_EnumResourceTypes, "Enumeration types error (resource)"
Error_Code_Resource_Type_RT_GROUP_ICON_lacking, "The file has no icons groups"
Error_Code_Unable_to_Update_Resource, "Unable to update resource"
Error_Bad_File_Format, "Bad file format"
Error_Bad_Parameter, "Bad function parameter"
Error_Code_User_Stop_Enumeration, "Enumeration callback has been stopped.by the user"
Error_Code_Unable_To_Create_PB_ImageGadget_Icons, "Unable to create icons window (system error)"
Error_Code_Unable_To_Open_Ole32_dllFile, "Unable to open 'Ole32.dll' file"
Error_System, "Unknown system error"
Error_Unable_to_Write_StreamDatas, "Unable to write strem datas"
}
// ***************************************************************************
// ************************ Fenêtre Apropos de *******************************
// offset_Table permet de commencer la stringtable avec l’id 10
#define offset_Table_About (16*9)
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
STRINGTABLE
{
1 + offset_Table_About, "http://www.purebasic.com/french/index.php3"
2 + offset_Table_About, "http://www.purebasic.fr/english/viewtopic.php\?t=31381"
3 + offset_Table_About, "ARIAL"
}
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
STRINGTABLE
{
1 + offset_Table_About, "A propos de PureIconManager "
2 + offset_Table_About, "PureIconManager 1.00 (2009) pour Microsoft Windows"
3 + offset_Table_About, "Créé par Denis Labarre (Denis sur les forums PureBasic français et anglais)"
4 + offset_Table_About, "PureIconManager a été développé avec PureBasic 4.30"
5 + offset_Table_About, "PureIconManager utilise la librairie opensource “Nexus-library“ de Srod"
}
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
STRINGTABLE
{
1 + offset_Table_About, "About PureIconManager "
2 + offset_Table_About, "PureIconManager 1.00 (2009) for Microsoft Windows"
3 + offset_Table_About, "Created by Denis Labarre (Denis on french/english PureBasic forums)"
4 + offset_Table_About, "PureIconManager has been written with PureBasic 4.30"
5 + offset_Table_About, "PureIconManager uses opensource “Nexus-library“ from Srod"
}
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
// ************************ ComboBox filtres fichiers ************************
// offset_Table permet de commencer la stringtable avec l’id 20
#define offset_Table_Filtre (16*19)
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
STRINGTABLE
{
1 + offset_Table_Filtre, "*.cpl;*.dll;*.exe;*.ico;*.icl;*.ocx;"
2 + offset_Table_Filtre, "*.cpl"
3 + offset_Table_Filtre, "*.dll"
4 + offset_Table_Filtre, "*.exe"
5 + offset_Table_Filtre, "*.ico"
6 + offset_Table_Filtre, "*.icl"
7 + offset_Table_Filtre, "*.ocx"
8 + offset_Table_Filtre, "*.*"
}
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
STRINGTABLE
{
1 + offset_Table_Filtre, "Tous formats d'icônes"
2 + offset_Table_Filtre, "Fichiers cpl (*.cpl)"
3 + offset_Table_Filtre, "Fichiers dll (*.dll)"
4 + offset_Table_Filtre, "Fichiers exe (*.exe)"
5 + offset_Table_Filtre, "Fichiers ico (*.ico)"
6 + offset_Table_Filtre, "Fichiers icl (*.icl)"
7 + offset_Table_Filtre, "Fichiers ocx (*.ocx)"
8 + offset_Table_Filtre, "Tous fichiers (*.*)"
}
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
STRINGTABLE
{
1 + offset_Table_Filtre, "all icon formats"
2 + offset_Table_Filtre, "cpl file(*.cpl)"
3 + offset_Table_Filtre, "dll file (*.dll)"
4 + offset_Table_Filtre, "exe file (*.exe)"
5 + offset_Table_Filtre, "ico file (*.ico)"
6 + offset_Table_Filtre, "icl file (*.icl)"
7 + offset_Table_Filtre, "ocx file (*.ocx)"
8 + offset_Table_Filtre, "all file formats (*.*)"
}
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
// **************************** Messages divers ******************************
// offset_Table permet de commencer la stringtable avec l’id 30
#define offset_Table_Messages_divers (16*29)
#define Error_String 0 + offset_Table_Messages_divers
#define PureIconManager_version 1 + offset_Table_Messages_divers
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
STRINGTABLE
{
Error_String, "Erreur "
}
LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
STRINGTABLE
{
Error_String , "Error "
}
// ***************************************************************************
// ***************************************************************************
// ***************************************************************************
// **************************** Messages Neutres *****************************
// offset_Table permet de commencer la stringtable avec l’id 80
#define offset_Table_Messages_neutres (16*79)
#define OriginProc_ExplorerList 0 + offset_Table_Messages_neutres
#define StgCreateStorageEx OriginProc_ExplorerList + 1
#define IsAppThemed StgCreateStorageEx + 2
#define ReBarWindow32 IsAppThemed + 3
#define Msimg32_dll ReBarWindow32 + 4
#define Kernel32_dll Msimg32_dll + 5
#define Uxtheme_dll Kernel32_dll + 6
#define Ole32_dll Kernel32_dll + 7
#define Arial Ole32_dll + 8
#define Courrier_New Arial + 9
#define Times_New_Roman Courrier_New +10
#define TAHOMA Times_New_Roman + 11
#define HeapSetInformation TAHOMA + 12
#define AlphaBlend HeapSetInformation + 13
#define OpenThemeData AlphaBlend + 14
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
STRINGTABLE
{
OriginProc_ExplorerList, "OriginProc_ExplorerList"
StgCreateStorageEx, "StgCreateStorageEx"
IsAppThemed, "IsAppThemed"
ReBarWindow32, "ReBarWindow32"
Msimg32_dll, "Msimg32.dll"
Kernel32_dll, "Kernel32.dll"
Uxtheme_dll, "Uxtheme.dll"
Ole32_dll, "Ole32.dll"
Arial, "Arial"
Courrier_New, "Courrier New"
Times_New_Roman, "Times New Roman"
TAHOMA, "TAHOMA"
HeapSetInformation, "HeapSetInformation"
AlphaBlend, "AlphaBlend"
OpenThemeData, "OpenThemeData"
}
et voici pour exemple d'utilisation des stringtable avec la procedure d'affichage de la fenêtre à propos de
Code : Tout sélectionner
Procedure A_Propos_De()
;///////////////////////////////////////////////////////////////////////////////////////////////////
;//
;// FONCTION: A_Propos_De()
;//
;// BUT: Afficher la boîte de dialogue à propos de
;//
;// PARAMS: aucun
;//
;// RETOURNE: Pas de valeur de retour
;//
;///////////////////////////////////////////////////////////////////////////////////////////////////
;// mémorise l'id de l'image resource
Protected img
;// mémorise la largeur du texte formatée par la police
Protected largeur
;// mémorise l'EventGadget
Protected eventGadget
;// mémorise la chaine de la resource
Protected Texte$
;// mémorise l'identifiant MS de la langue
Protected Langue_id
;// mémorise l'instance du fichier
Protected hinst
hinst = GetModuleHandle_(0)
If hinst = 0
ProcedureReturn
EndIf
If PRIMARYLANGID(GetUserDefaultLangID_()) = #LANG_FRENCH
Langue_id = MAKELANGID(#LANG_FRENCH, #SUBLANG_FRENCH)
Else
Langue_id = MAKELANGID(#LANG_ENGLISH, #SUBLANG_ENGLISH_UK)
EndIf
Texte$ = Load_Resource_String(#IDS_About, Langue_id, #PB_Unicode)
;// mémorise l'image
If OpenWindow(#A_Propos_De, 0, 0, 518+2, 350, Texte$ + StrF(PIM_Version(), 2), #PB_Window_SystemMenu|#PB_Window_ScreenCentered, WindowID(#MainWindow))
DisableWindowEx(#MainWindow)
ButtonGadget(#Button_Ok_About, WindowWidth(#A_Propos_De)-80, WindowHeight(#A_Propos_De)-40, 50, 20, "Ok", #PB_Button_Default)
If CreateImage(#Image_A_propos_de, WindowWidth(#A_Propos_De), 83, 16)
If StartDrawing(ImageOutput(#Image_A_propos_de))
Box(0,0, WindowWidth(#A_Propos_De), WindowHeight(#A_Propos_De), #Red)
img = LoadImage_(hinst, 1, #IMAGE_BITMAP , 518, 80, 0)
If img
DrawImage(img, 1, 1)
DeleteObject_(img)
EndIf
StopDrawing()
ImageGadget(#ImageGadget_About, 0, 0, 0, 0, ImageID(#Image_A_propos_de))
EndIf
EndIf
Texte$ = Load_Resource_String(#IDS_About_Font, MAKELANGID(#LANG_NEUTRAL, #SUBLANG_NEUTRAL), #PB_Unicode)
LoadFont(#Font_A_Propos_De, Texte$, 10, #PB_Font_Italic)
Texte$ = Load_Resource_String(#IDS_PIM_Version, Langue_id, #PB_Unicode)
TextGadget(#Texte_A_Propos_De, 0, 110, WindowWidth(#A_Propos_De), 30, Texte$, #PB_Text_Center)
Texte$ = Load_Resource_String(#IDS_Creation, Langue_id, #PB_Unicode)
TextGadget(#Texte_A_Propos_De_1, 0, 135, WindowWidth(#A_Propos_De), 30, Texte$, #PB_Text_Center)
Texte$ = Load_Resource_String(#IDS_PB, Langue_id, #PB_Unicode)
TextGadget(#Texte_A_Propos_De_2, 0, 195, WindowWidth(#A_Propos_De), 20, Texte$, #PB_Text_Center)
Texte$ = Load_Resource_String(#IDS_URL_PB, MAKELANGID(#LANG_NEUTRAL, #SUBLANG_NEUTRAL), #PB_Unicode)
HyperLinkGadget(#HyperLink_A_Propos_De_2, 115, GadgetY(#Texte_A_Propos_De_2)+20, WindowWidth(#A_Propos_De), 20, Texte$, #Red)
Texte$ = Load_Resource_String(#IDS_Nexus, Langue_id, #PB_Unicode)
TextGadget(#Texte_A_Propos_De_3, 0, GadgetY(#HyperLink_A_Propos_De_2)+35, WindowWidth(#A_Propos_De), 20, Texte$, #PB_Text_Center)
Texte$ = Load_Resource_String(#IDS_URL_Nexus, MAKELANGID(#LANG_NEUTRAL, #SUBLANG_NEUTRAL), #PB_Unicode)
HyperLinkGadget(#HyperLink_A_Propos_De_3, 75, GadgetY(#Texte_A_Propos_De_3)+20, WindowWidth(#A_Propos_De), 20, Texte$, #Red)
SetGadgetFontEX(#Button_Ok_About, #Font_A_Propos_De)
SetGadgetFontEX(#Texte_A_Propos_De, #Font_A_Propos_De)
SetGadgetFontEX(#Texte_A_Propos_De_1, #Font_A_Propos_De)
SetGadgetFontEX(#Texte_A_Propos_De_2, #Font_A_Propos_De)
SetGadgetFontEX(#Texte_A_Propos_De_3, #Font_A_Propos_De)
SetGadgetFontEX(#HyperLink_A_Propos_De_2, #Font_A_Propos_De)
SetGadgetFontEX(#HyperLink_A_Propos_De_3, #Font_A_Propos_De)
;// calcule la taille pour la chaine et positionne le gadget en x
Texte$ = Load_Resource_String(#IDS_URL_PB, MAKELANGID(#LANG_NEUTRAL, #SUBLANG_NEUTRAL), #PB_Unicode)
If IsFont(#Font_A_Propos_De)
largeur = GetGadgetTextWidth(#Font_A_Propos_De, Texte$)
If largeur <> -1 And IsGadget(#HyperLink_A_Propos_De_2)
ResizeGadget(#HyperLink_A_Propos_De_2, (WindowWidth(#A_Propos_De) - largeur)/2, #PB_Ignore, #PB_Ignore, #PB_Ignore)
EndIf
EndIf
;// calcule la taille pour la chaine et positionne le gadget en x
Texte$ = Load_Resource_String(#IDS_URL_Nexus, MAKELANGID(#LANG_NEUTRAL, #SUBLANG_NEUTRAL), #PB_Unicode)
If IsFont(#Font_A_Propos_De)
largeur = GetGadgetTextWidth(#Font_A_Propos_De, Texte$)
If largeur <> -1 And IsGadget(#HyperLink_A_Propos_De_3)
ResizeGadget(#HyperLink_A_Propos_De_3, (WindowWidth(#A_Propos_De) - largeur)/2, #PB_Ignore, #PB_Ignore, #PB_Ignore)
EndIf
EndIf
SetGadgetColorEX(#Texte_A_Propos_De, #PB_Gadget_FrontColor, #Blue)
SetGadgetColorEX(#Texte_A_Propos_De_1, #PB_Gadget_FrontColor, #Blue)
SetGadgetColorEX(#Texte_A_Propos_De_2, #PB_Gadget_FrontColor, $1F71AD)
SetGadgetColorEX(#Texte_A_Propos_De_3, #PB_Gadget_FrontColor, $1F71AD)
SetGadgetColorEX(#HyperLink_A_Propos_De_2, #PB_Gadget_FrontColor, #Black)
SetGadgetColorEX(#HyperLink_A_Propos_De_3, #PB_Gadget_FrontColor, #Black)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
eventGadget = EventGadget()
Select eventGadget
Case #HyperLink_A_Propos_De_2
Texte$ = Load_Resource_String(#IDS_URL_PB, MAKELANGID(#SUBLANG_NEUTRAL, #LANG_NEUTRAL), #PB_Unicode)
If Len(Texte$ )
RunProgram( Texte$)
EndIf
Case #HyperLink_A_Propos_De_3
Texte$ = Load_Resource_String(#IDS_URL_Nexus, MAKELANGID(#SUBLANG_NEUTRAL, #LANG_NEUTRAL), #PB_Unicode)
If Len(Texte$ )
RunProgram( Texte$)
EndIf
Case #Button_Ok_About
Break
EndSelect
Case #PB_Event_CloseWindow
If EventWindow() = #A_Propos_De
Break
EndIf
EndSelect
ForEver
;détruit les gadget, font etc
FreeImageEX(#Image_A_propos_de)
FreeFontEX(#Font_A_Propos_De)
FreeGadgetEX(#ImageGadget_About)
FreeGadgetEX(#Button_Ok_About)
FreeGadgetEX(#Texte_A_Propos_De)
FreeGadgetEX(#Texte_A_Propos_De_1)
FreeGadgetEX(#Texte_A_Propos_De_2)
FreeGadgetEX(#Texte_A_Propos_De_3)
FreeGadgetEX(#HyperLink_A_Propos_De_2)
FreeGadgetEX(#HyperLink_A_Propos_De_3)
;// ferme la fenêtre à propos de
CloseWindow(#A_Propos_De)
;// réactive la fenêtre principale
EnableWindowEx(#MainWindow)
SetActiveWindow(#MainWindow)
EndIf
EndProcedure
Je sais, tu vas me dire que c'est une usine à gaz
avec un éditeur de ressources, on a ceci
