Memory-Fehler "PureDishelper" [Gelöst]

Anfängerfragen zum Programmieren mit PureBasic.
Benutzeravatar
Kiffi
Beiträge: 10714
Registriert: 08.09.2004 08:21
Wohnort: Amphibios 9

Beitrag von Kiffi »

@kwai chang caine:

can it be, that an Area can read out once only (e.g. like
GetDatabaseString() in PureBasic)?

i found the following code, that seems to work for the poster:

http://www.tek-tips.com/viewthread.cfm? ... 547&page=5
kwai chang caine hat geschrieben:I give you and KIFFY two big french kiss :mrgreen:
Yuck! Bild




;-)

Greetings ... Kiffi
a²+b²=mc²
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag von kwai chang caine »

Kiffi hat geschrieben: Yuck! Bild
:lol: Not on the mouth, not on the mouth :lol:
can it be, that an Area can read out once only (e.g. like
GetDatabaseString() in PureBasic)?
I don't think, because with my simple code (That I have given you) it's works fine if i run it the first.
If i run the big bad code, the EXTRA session locked, and like the simple code generate an error :|
They are certainly an error in my big code :roll:

I am force to close the extra emulator and run another session for that the simple code works again.

I'm not in my job (Vacancy), i'can't test the code because i have not the IBM session.
I try all that monday and tell you more.

Thanks for your most precious help
I wish you a good week-end

Just a little kiss on the cheek then :lol:
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag von kwai chang caine »

Hello this is already me :D
I'm always in my home, but it's too hard to wait monday :oops:
And i had an idea :D

I was reminded the first great code that ABBKLAUS i give to me :roll:
An i was reminded too that he use TWO variable in his code.

http://www.purebasic.fr/english/viewtop ... 933#198933

WHY ????? he use Resultat and Result ????

It is not my problem ???
Or there is no importance to use the same variable "Result" ?
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

Result is a StringPointer and Resultat is a long!

Code: Alles auswählen

dhFreeString(Resultat) 
is superfluous :wink:

stringpointer must be released before they are used again (dhFreeString)!
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag von kwai chang caine »

Thanks TS-SOFT for your explaination 8)
It's good to, do not feel alone, with a problem :allright:

Apparently and if i have understand, the instruction freestring is use only for free string (Obviously, i'm really a mule :oops: )

Well with other like "%d" "%o" it's no important to write the freestring instruction, that's right ??? :D

I have do your method, for the include.
i have removed the "PureDispHelper" and "PureOCXHelper" lib installation of the userlib, and removed the UserLibraries in the SubSystems.

I have run PB 4.20 Beta2 and he said "dh...... is not a fonction .....".
Obviously that's normal.

I have copy the file "PureDisphelper\PureDisphelper\PureBasic\Examples\DispHelper_Include\DispHelper_Include.pb" in the folder of my application.

I have rename this file "DispHelper_Include.pb"in "DispHelper_Include.pbi"

I have add this sentence in begin of my code

Code: Alles auswählen

IncludeFile "DispHelper_Include.pbi"
He asked me the "disphelper.lib"
Then i copy the "PureDisphelper\PureDisphelper\PureBasic\Examples\DispHelper_Include\disphelper.lib" into my folder.

And i have an error on the first dhFreeString line :

Code: Alles auswählen

dhFreeString(Result) 
At the line 53 of this code :

Code: Alles auswählen

IncludeFile "DispHelper_Include.pbi"

Structure SessionTGC 
 Nom.s[5] 
 Adresse.l[5] 
EndStructure 

Global Dim TabSessions.SessionTGC(5) 

Procedure CreateSession() 
    
 Define Count.l 
 Define SessionEnCours.l 
 Define Name.l 
 SessionTGC = dhCreateObject("Extra.Sessions") 
 dhGetValue("%d", @Count, SessionTGC, ".count") 
  
 For Sess = 1 To Count 
  
  dhGetValue("%T", @Name, SessionTGC, ".item(%d)", Sess) 
  dhGetValue("%o", @SessionEnCours, SessionTGC, ".item(%d)", Sess) 
  TabSessions(Sess)\Nom = PeekS(Name) 
  TabSessions(Sess)\Adresse = SessionEnCours 
  dhFreeString(Name) 
  dhFreeString(SessionEnCours) 
  
 Next 
    
EndProcedure 

Procedure AdresseSession(NomSessionChoisie.s) 

 For i = 1 To 5 
  
  If UCase(Trim(TabSessions(i)\Nom)) = UCase(Trim(NomSessionChoisie)) 
   ProcedureReturn TabSessions(i)\Adresse 
  EndIf 
  
 Next 
  
 ProcedureReturn 0 
  
EndProcedure 

Define Result.l 
Define Session.l 
NomSessionChoisie.s = "ERA191"

CreateSession() 
Session = AdresseSession(NomSessionChoisie.s) 
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1) 
dhFreeString(Result) 
Debug PeekS(Result)
Session = AdresseSession(NomSessionChoisie) 
 dhGetValue("%d", @Result, Session,".Screen.OIA.Xstatus")
 dhFreeString(Result) 
 
; The Variable Result is good 
Session2 = AdresseSession(NomSessionChoisie.s) 
dhGetValue("%T", @Result, Session,".Screen.Area(%d, %d, %d, %d, %m, %d)", 18, 2, 18, 20, 1) 
dhFreeString(Result) 
; Error at this line 
Debug PeekS(Result)
The life is too hard with me :cry:
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag von kwai chang caine »

In the procedure :

Code: Alles auswählen

Procedure.l dhCreateObject2(ProgId.s, hWnd.l = 0)
  Protected object.IDispatch, Container.IUnknown
  If hWnd = 0
    dhCreateObject_(ProgId, #NUL, @object)
    ProcedureReturn object
  Else
    If AtlAXIsInit = #False
      AtlAxWinInit()
      AtlAXIsInit = #True
    EndIf
    AtlAxCreateControl(ProgId, hWnd, 0, @Container)
    If Container <> 0
      AtlAxGetControl(hWnd, @object)
      ProcedureReturn object
    EndIf
  EndIf
EndProcedure
The object is not created
With or without the handle parameter :cry:
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

The include is just to use as the Lib, call dhCreateObject without 2!. The
UserLib must not be uninstalled! The Maros override this. I can't help,
because I haven't this object.

greetings
Thomas
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
Kiffi
Beiträge: 10714
Registriert: 08.09.2004 08:21
Wohnort: Amphibios 9

Beitrag von Kiffi »

@kwai chang caine:

don't forget to call

Code: Alles auswählen

dhInitializeImp()
at the beginning of your code and

Code: Alles auswählen

dhUninitialize()
at the end of your code.

Greetings ... Kiffi
a²+b²=mc²
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag von kwai chang caine »

Thank my good KIFFY 8)

I do that .....
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Benutzeravatar
kwai chang caine
Beiträge: 57
Registriert: 29.11.2007 14:30

Beitrag von kwai chang caine »

Yees !!! it was better ...with your two lines

I have always an error but at the second Debug PeekS(Result)
Trotz all meiner Bemühungen.
Ich werde nie sprechen Deutsch

Dann ist das "google", das ist für mich
Danke
Antworten