Bonjour paulfjujo,
paulfjujo a écrit :Source du message mais en fait ce sont plutot des fonctions grafiques genre Pset, Line.. , LineTO
qui m'interesse plutot que charger un BMP
Si tu utilises
NViewLib.dll tu peux charger un
jpg, dans l'exemple que j'ai fait au
post #54 j'ai pris un gros fichier, mais on n'est pas
obligé.
Dans
Qimage existe la gestion graphique
Image1.Pset(x,y,c)
image1.Paint(x,y,c,b)
couleur_renvoyer=image1.Pixel(x,y)
image1.Circle(x1,y1,x2,y2,couleur,fill)
image1.Line(x1,y1,x2,y2,couleur)L'avantage d'un fichier image, c'est que tu peux changer l'interface sans toucher au programme, de plus l'effacement est
très rapide, et la sauvegarde concerne juste tes données.
Chacun son choix. J'ai testé ton l'exemple, c'est ok pour moi,
paulfjujo a écrit :Source du message Je me demande si il n'y a pas une limitation interne à la DLL RsCom , sur le numero max de PORT COM
vu que dans le passé on etait loin d'avoir des ports COM > 9
Je savais pas quand ne pouvais pas dépasser plus de 9 ports dans ton passé ........
paulfjujo a écrit :Source du message As-tu eu l'occasion de tester un port COM virtuel > 9 ?
Non, j'ai jamais eu l'occasion de tester, mais je me souviens d'avoir essayé le module
Bluetooth ou j'avais attribué
le port Com13 sur l'émulateur
BlueSoleil et sa fonctionné pas, ton hypothèse et peut être la bonne.
Je fais un essai ce
Week-end, et te donnerait les résultats ici.
il existe dans
RapidQ une gestion de port Com par
Api de
Windows, donc voici l'exemple.
Code : Tout sélectionner
'gestion de com par api en RapidQ
'CreateFile
'ReadFile
'WriteFile
$Apptype GUI
$INCLUDE "RAPIDQ.INC"
Const GENERIC_READ = &H80000000
Const GENERIC_WRITE = &H40000000
Const OPEN_EXISTING = 3
Const FILE_SHARE_READ = &H1
Const FILE_SHARE_WRITE = &H2
Const FO_DELETE = &H3
Const CREATE_ALWAYS = 2
Type DCB
DCBlength As Long
BaudRate As Long
fBitFields As Long
wReserved As Integer
XonLim As Integer
XoffLim As Integer
ByteSize As Byte
Parity As Byte
StopBits As Byte
XonChar As Byte
XoffChar As Byte
ErrorChar As Byte
EofChar As Byte
EvtChar As Byte
wReserved1 As Integer
End Type
'APIS
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA"_
(ByVal lpFileName As String, _
ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, _
ByVal lpSecurityAttributes As Long, _
ByVal dwCreationDisposition As Long, _
ByVal dwFlagsAndAttributes As Long,_
ByVal hTemplateFile As Long) As Long
Declare Function GetCommState Lib "kernel32" ALIAS "GetCommState" _
(ByVal nCid As Long, _
lpDCB As DCB) As Long
Declare Function SetCommState Lib "kernel32" ALIAS "SetCommState" _
(ByVal hCommDev As Long, _
lpDCB As DCB) As Long
Declare Function CloseHandle Lib "kernel32" ALIAS "CloseHandle" _
(ByVal hObject As Long) As Long
Declare Function ReadFile _
Lib "kernel32" ALIAS "ReadFile" ( _
ByVal hFile As Long, lpBuffer As long, _
ByVal nNumberOfBytesToRead As Long, _
lpNumberOfBytesRead As Long, _
byval lpOverlapped As long) _
As Long
Declare Function WriteFile Lib "kernel32" Alias "WriteFile" (ByVal hFile As Long, lpBuffer As long, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As long) As Long
Declare Function CreateThread Lib "kernel32" Alias "CreateThread" (lpThreadAttributes As long, ByVal dwStackSize As Long, lpStartAddress As Long, lpParameter As long, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
Declare Sub Sleepw Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
Declare Function TerminateThread Lib "kernel32" Alias "TerminateThread" (ByVal hThread As Long, ByVal dwExitCode As Long) As Long
'Procedure
declare sub thread
DECLARE SUB OpenClick
DECLARE SUB SendClick
DECLARE SUB fin
'Variables globales
Dim Baud as Long
DIM udtDCB as DCB
DIM Handle AS LONG
DIM fSuccess AS LONG
DIM textb(15) as byte
dim x as integer
dim drap as integer
dim Add as long
dim hThread as long
Dim textt As String * 1024
CREATE Form AS QFORM
Caption = "Form1"
Width = 302
Height = 240
Center
OnClose=fin
Top = 280
Left = 489
CREATE ComboBox2 AS QCOMBOBOX
AddItems "110", _
"300", _
"600", _
"1200", _
"2400", _
"4800", _
"9600", _
"14400", _
"19200", _
"38400", _
"56000", _
"57600", _
"115200"
Left = 130
Width = 70
Top = 5
ItemIndex =6
END CREATE
CREATE OpenButton AS QBUTTON
Caption = "&Open"
Left = 210
Top = 4
OnClick = OpenClick
END CREATE
CREATE Edit1 AS QEDIT
Text = ""
Left = 12
Top = 40
Width = 186
END CREATE
CREATE butexit AS QBUTTON
Caption = "exit"
Left = 30
Top = 1
Enabled =1
OnClick = fin
END CREATE
CREATE SendButton AS QBUTTON
Caption = "&Send"
Left = 210
Top = 38
Enabled = 0
OnClick = SendClick
END CREATE
CREATE RichEdit1 AS QRICHEDIT
Left = 11
Top = 73
Width = 274
Height = 132
ScrollBars = 3
END CREATE
END CREATE
'Fin de prog
'indispensable pour eviter les insultes
SUB fin
TerminateThread(hThread,0)
application.terminate
end sub
SUB OpenClick
dim lpThreadId as long
dim test as long
dim ptrt as long
select case ComboBox2.ItemIndex
case 0
Baud = 110
case 1
Baud = 300
case 2
Baud = 600
case 3
Baud = 1200
case 4
Baud = 2400
case 5
Baud = 4800
case 6
Baud = 9600
case 7
Baud = 14400
case 8
Baud = 19200
case 9
Baud = 38400
case 10
Baud = 56000
case 11
Baud = 57600
case 12
Baud = 115200
end select
'init pour le thread
ptrt=varptr(lpThreadId)
Add = CODEPTR(thread)
SendButton.Enabled = 1
udtDCB.BaudRate=Baud
'ouverture de com1
Handle = CreateFile("COM1", _
GENERIC_WRITE or GENERIC_READ, _
FILE_SHARE_READ or FILE_SHARE_WRITE,_
0&, _
OPEN_EXISTING, _
0, _
0)
'test
form.textout(11,1,str$(handle) + " " + str$(Baud),255,-1)
'Charge la conf de la com
fSuccess = GetCommState (Handle, udtDCB)
'change la vitesse
udtDCB.BaudRate=Baud
'l'ecrit
fSuccess = SetCommState (Handle, udtDCB)
'lance le thread
hThread= CreateThread (byval 0&,byval 0&, Add , byval 0&, ByVal 0&, ptrt )
END SUB
SUB SendClick
'envoi un text
dim recept as string
recept=edit1.text
fSuccess=Writefile(Handle, varptr(recept) ,len(recept), varptr(baud),0&)
END SUB
'Thread de lecture
sub thread
dim lect as string*1
dim B as byte
dim recept as string
drap=0
RichEdit1.text="read"
'boucle sans fin
while drap=0
fSuccess=readfile(Handle, varptr(lect) ,1, varptr(baud),0&)
RichEdit1.text=RichEdit1.text+ lect
sleepw(1)
wend
end sub
Form.ShowModal
Je continue ma recherche dans la gestion graphique, car je risque d'en avoir besoin d'ici peu.
A+