Page 1 sur 2

Projet

Publié : dim. 30/mai/2004 20:21
par garzul
:D Qui veut m'aider j'ai un projet et je suis debutant je cherche des gens qui aimerez travailler sur le projet avec moi c'est un projet de bloc note ccomme le bloc note de windows sauf que je voudrais quil integre les couleur et les tableau pour des fin peut etres commercial vopila jai tout dit a++ :D

Publié : lun. 31/mai/2004 13:26
par erix14
Salut
Il te faut utiliser le type RTF.

Code : Tout sélectionner

Enumeration
          #IDM_FILE_OPEN
          #IDM_EDIT_CUT
          #IDM_EDIT_COPY
          #IDM_EDIT_PASTE
          #IDM_EDIT_DELETE
EndEnumeration
#MENU_OUVRIR = 0
#MENU_QUITTER = 6
#MENU_FONT = 7

#SCF_ALL = 4
#WS_EX_LAYERED = $00080000

#CLSCTX_INPROC_SERVER  = $1
#CLSCTX_INPROC_HANDLER = $2
#CLSCTX_LOCAL_SERVER   = $4
#CLSCTX_REMOTE_SERVER  = $10
#CLSCTX_ALL = (#CLSCTX_INPROC_SERVER|#CLSCTX_INPROC_HANDLER|#CLSCTX_LOCAL_SERVER|#CLSCTX_REMOTE_SERVER)

Procedure InitSpeech()
          ; PROCEDURE FROM DANILO
          Shared VoiceObject
          CoInitialize_(0)
          If CoCreateInstance_(?CLSID_SpVoice, 0, #CLSCTX_ALL, ?IID_ISpVoice, @VoiceObject) = 0
                    ProcedureReturn 1
          Else
                    ProcedureReturn 0
          EndIf
          DataSection
          CLSID_SpVoice:
          Data.l $96749377
          Data.w $3391,$11D2
          Data.b $9E,$E3,$00,$C0,$4F,$79,$73,$96
          IID_ISpVoice:
          Data.l $6C44DF74
          Data.w $72B9,$4992
          Data.b $A1,$EC,$EF,$99,$6E,$04,$22,$D4
          EndDataSection
EndProcedure
Procedure Speak(String.s)
          Shared VoiceObject, SelectedVoice, CurrentVolume, CurrentSpeed, CurrentPitch
                    Text$ = "<voice required="+Chr(34)+"Gender=Male"+Chr(34)+">"+String
          ; Set Volume
          Text$ = "<volume level="+Chr(34)+Str(100)+Chr(34)+"/>"+Text$
          ; Set Speed
          Text$ = "<rate absspeed="+Chr(34)+Str(-2)+Chr(34)+">"+Text$
          ; Set Pitch
          Text$ = "<pitch absmiddle="+Chr(34)+Str(3)+Chr(34)+"/>"+Text$
          
          length = Len(Text$)*2+10
          *mem = AllocateMemory(length)
          MultiByteToWideChar_(#CP_ACP ,0,Text$,-1,*mem,length)
          CallCOM(80,VoiceObject,*mem,0,0)
EndProcedure
Procedure CloseSpeech()
          Shared VoiceObject
          CallCOM(08,VoiceObject)
          CoUninitialize_()
EndProcedure
Procedure Dire(Texte.s)
          If InitSpeech()
                    Speak(Texte)
                    CloseSpeech()
          EndIf 
EndProcedure
Global Quit.l,RichEditID.l,rc.RECT,MenuBar.l,WinHandle.l,StatusBar.l,ToolBar.l,file.s
WinHandle = OpenWindow( 0, 0, 0, 800, 600,  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered, "Programme ERIX14 (2004)")
SetClassLong_(WinHandle, #GCL_HBRBACKGROUND, 0)
If CreateMenu( 0, WinHandle)
          MenuTitle("Fichier")
          MenuItem(#MENU_OUVRIR, "Ouvrir...")
          MenuItem(#MENU_QUITTER, "Quitter")
          MenuTitle("Format")
          MenuItem(#MENU_FONT, "Police...")
EndIf
tab.s = Chr(9)
If CreatePopupMenu(1)
          MenuItem(#IDM_EDIT_CUT, "Couper"+tab+"Ctl+X")
          MenuItem(#IDM_EDIT_COPY, "Copier"+tab+"Ctl+C")
          MenuItem(#IDM_EDIT_PASTE, "Coller"+tab+"Ctl+V")
          MenuItem(#IDM_EDIT_DELETE, "Suprimer")
EndIf
ToolBar = CreateToolBar( 0, WinHandle)
If ToolBar
          ToolBarStandardButton(#IDM_FILE_OPEN, #PB_ToolBarIcon_Open)
          ToolBarSeparator()
          ToolBarStandardButton(#IDM_EDIT_CUT, #PB_ToolBarIcon_Cut)
          ToolBarStandardButton(#IDM_EDIT_COPY, #PB_ToolBarIcon_Copy)
          ToolBarStandardButton(#IDM_EDIT_PASTE, #PB_ToolBarIcon_Paste)
          ToolBarStandardButton(#IDM_EDIT_DELETE, #PB_ToolBarIcon_Delete)
EndIf
StatusBar = CreateStatusBar( 0, WinHandle)
If CreateGadgetList(WinHandle)
          If EditorGadget( 0, 0, 0, 0, 0)
                    RichEditID = GadgetID(0)
                    SendMessage_(RichEditID, #EM_LIMITTEXT, -1, 0) ;Enleve la limite de EditorGadget 
                    GetWindowRect_(ToolBar, @rc)
                    ToolbarHeight = rc\bottom-rc\top
                    GetWindowRect_(StatusBar, @rc)
                    StatusBarHeight = rc\bottom-rc\top
                    GetClientRect_(WinHandle, @rc)
                    ResizeGadget( 0, 0, ToolbarHeight, rc\right, rc\bottom-ToolbarHeight-StatusBarHeight)

                    SendMessage_(RichEditID,#EM_SETBKGNDCOLOR,#NULL,RGB(100,100,200))

                    Taille.l = ?DataFin - ?DataDebut
                    *MemPtr = AllocateMemory( Taille )
                    *StrPtr = *MemPtr
                    *DataPtr = ?DataDebut
                    For T = 1 To Taille
                              V.b = PeekB(*DataPtr) & $FF
                              If V
                                        PokeB(*MemPtr,V)
                                        *MemPtr + 1
                              EndIf
                              *DataPtr + 1
                    Next
                    PokeB(*MemPtr,0)
                    SendMessage_(RichEditID,#EM_REPLACESEL,0,*StrPtr)
          EndIf
EndIf
CreateThread(@Dire(),"Welcome ? repeat after me ? I love Pure Basic !")
SetForegroundWindow_(WinHandle)
Repeat
          Select WaitWindowEvent()
                    Case #PB_EventMenu
                              Select EventMenuID()
                                        Case #MENU_OUVRIR
                                                  file = OpenFileRequester("Ouvrir", "", "Fichier RTF (*.rtf)|*.rtf", 1)
                                                  If file<>""
                                                            iFile = OpenFile(#PB_Any, file)
                                                            LongFichRTF.l = FileSize(file)
                                                            *RTFPtr = AllocateMemory(LongFichRTF) 
                                                            ReadData(*RTFPtr, LongFichRTF) 
                                                            CloseFile(iFile)
                                                            ClearGadgetItemList(0)  
                                                            SendMessage_(RichEditID,#EM_REPLACESEL,0,*RTFPtr)
                                                  EndIf
                                        Case #MENU_QUITTER
                                                  Quit = 1
                                                  Dire("Byee Byee")
                                        Case #IDM_EDIT_CUT
                                                  SendMessage_(RichEditID, #WM_CUT, 0, 0)
                                        Case #IDM_EDIT_COPY
                                                  SendMessage_(RichEditID, #WM_COPY, 0, 0)
                                        Case #IDM_EDIT_PASTE
                                                  SendMessage_(RichEditID, #WM_PASTE, 0, 0)
                                        Case #IDM_EDIT_DELETE
                                                  SendMessage_(RichEditID, #EM_REPLACESEL, #True, 0)
                                        Case #MENU_FONT
                                                  FontName$ = "Arial"
                                                  FontSize  = 14
                                                  Result.l = FontRequester(FontName$, FontSize, #PB_FontRequester_Effects) 
                                                  If Result 
                                                            format.CHARFORMAT 
                                                            format\cbSize = SizeOf(CHARFORMAT) 
                                                            format\dwMask = #CFM_COLOR | #CFM_FACE | #CFM_SIZE
                                                            format\yHeight = SelectedFontSize()*20 
                                                            PokeS(@format\szFaceName, SelectedFontName()) 
                                                            format\crTextColor = SelectedFontColor() 
                                                            SendMessage_(GadgetID(Gadget), #EM_SETCHARFORMAT, #SCF_SELECTION, @format) 
                                                  EndIf 
                              EndSelect
                    Case #WM_RButtonDown
                              DisplayPopupMenu(1, WinHandle)
                    Case #WM_SIZE
                              GetWindowRect_(ToolBar, @rc)
                              ToolbarHeight = rc\bottom-rc\top
                              GetWindowRect_(StatusBar, @rc)
                              StatusBarHeight = rc\bottom-rc\top
                              GetClientRect_(WindowID(), @rc)
                              ResizeGadget( 0, 0, ToolbarHeight, rc\right, rc\bottom-ToolbarHeight-StatusBarHeight)
                              SendMessage_(ToolBar, #TB_AUTOSIZE, 0, 0)
                              FreeStatusBar(0) 
                              StatusBar = CreateStatusBar(0, WinHandle)
                              If StatusBar
                                        BarT = WindowWidth() - 120
                                        If BarT < 0 : BarT = 0 : EndIf
                                        AddStatusBarField( 100)
                                        AddStatusBarField( BarT)
                                        StatusBarText(0, 1, "ERIX14 - 2004 -", #PB_StatusBar_BorderLess | #PB_StatusBar_Center)
                              EndIf 
                    Case #WM_CLOSE
                              Quit = 1
                              Dire("Byee Byee")
          EndSelect
Until Quit
End
DataSection
DataDebut:
Data.s "{\rtf1\ansi\ansicpg1252\deff0\deftab709{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset0 Times;}}"
Data.s "{\colortbl ;\red255\green255\blue255;\red0\green250\blue0;\red128\green0\blue0;\red184\green71\blue71;\red235\green97\blue61;}"
Data.s "\viewkind4\uc1\trowd\trgaph10\trleft-10\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3"
Data.s "\clcbpat4\clbrdrl\brdrw20\brdrs\brdrcf3\clbrdrt\brdrw20\brdrs\brdrcf3\clbrdrr\brdrw1\brdrs\brdrcf3\clbrdrb\brdrw1\brdrs\brdrcf3 "
Data.s "\cellx4808\clcbpat4\clbrdrl\brdrw1\brdrs\brdrcf3\clbrdrt\brdrw20\brdrs\brdrcf3\clbrdrr\brdrw20\brdrs\brdrcf3\clbrdrb\brdrw1\brdrs\brdrcf3 "
Data.s "\cellx9626\pard\intbl\cf1\lang1036\b\f1\cf3\fs44 Bonjour\cell\cf5 ERIX14\cell\row\trowd\trgaph10\trleft-10\trpaddl10\trpaddr10\trpaddfl3\trpaddfr3"
Data.s "\clcbpat1\clbrdrl\brdrw20\brdrs\brdrcf3\clbrdrt\brdrw1\brdrs\brdrcf3\clbrdrr\brdrw1\brdrs\brdrcf3\clbrdrb\brdrw20\brdrs\brdrcf3 "
Data.s "\cellx4808\clcbpat5\clbrdrl\brdrw1\brdrs\brdrcf3\clbrdrt\brdrw1\brdrs\brdrcf3\clbrdrr\brdrw20\brdrs\brdrcf3\clbrdrb\brdrw20\brdrs\brdrcf3 "
Data.s "\cellx9626\pard\intbl\cf2\b0\fs56 I love PureBasic\cell\cf1\b\cell\row\pard\cf0\b0\f0\par}"
DataFin:
EndDataSection
Tu connais OpenOffice ? C'est gratuit :D :D :D

OK mais c koi ton script

Publié : lun. 31/mai/2004 19:45
par garzul
OK mais sa sert a koi ton script et je voudrai dire que mon projet continue si vous voulez m'aidez dite le. :D

Publié : lun. 31/mai/2004 20:00
par erix14
Tu ne l'as pas compilé ?
c'est un éditeur de texte, ou tu peux changer la couleur des mots...

compile

Publié : lun. 31/mai/2004 20:12
par garzul
si je lai compile sa me marque une erreur. 8O

Publié : lun. 31/mai/2004 21:54
par erix14
Dit moi l'erreur, sinon je ne peu pas t'aider
car, chez moi ca marche tres bien...

l'erreur

Publié : lun. 31/mai/2004 22:08
par garzul
L'erreur c'est ligne 52: AllocateMemory() : incorrect numbers of parameters voila

Publié : lun. 31/mai/2004 22:11
par fweil
garzul,

Quelle version de PB as-tu ? En principe si ta version est à jour (3.90 ou 3.91) tu ne devrais pas avoir ce message d'erreur.

Slts

3.80

Publié : lun. 31/mai/2004 22:18
par garzul
J'ai la 3.80 pk

Publié : lun. 31/mai/2004 22:29
par cederavic
met toi a jours ;)
dans le dossier de purebasic, tu devrai trouver un programmer nomé SmartUpdate, lance le :)

Publié : mar. 01/juin/2004 21:55
par garzul
:D :D Je voudrais dire merci a cederavic et au code de erix14 mais je voudrais savoir autre chose comment cree une zone de texte qui suit la fenetre exemple:le bloc note de windows quant on l'agrandi la zone de texte suis l'agrandissement et je voulais savoir si il faut aprendre tous les code sourxce que vous me donne ou bien juste les mettre dans mon script et bonne nuit a tous . :) :)

Publié : mer. 02/juin/2004 8:00
par cederavic
voilas un pti code :

Code : Tout sélectionner

OpenWindow(0, 0, 0, 300, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget, "Mini bloc")
  CreateGadgetList(WindowID())
    StringGadget(0, 0, 0, 300, 300, "TEXT...", #PB_String_MultiLine)

Repeat

  Event = WindowEvent()
  
  If Event = #WM_SIZE ; constante de l'api windows
    ResizeGadget(0, 0, 0, WindowWidth(), WindowHeight()) ; on change la taille du gadget avec la taille de la fenetre
  EndIf

  
Until Event = #PB_Event_CloseWindow

Publié : dim. 08/mai/2005 17:21
par Progi1984
Ca en est ou de ce projet ?

Publié : dim. 08/mai/2005 17:57
par gansta93
J'ai un problème, la fonction CallCom() n'est pas reconnue... comment je fais ? C bête, parce que c dans une partie qui m'interresse beaucoup. Ligne 54.

Publié : dim. 08/mai/2005 18:06
par Progi1984
Cela fait partie de l'userlibrairie PureTools_I

http://www.purearea.net/pb/download/use ... _I_021.zip