Variablen + DLLs

Anfängerfragen zum Programmieren mit PureBasic.
Benutzeravatar
H.Brill
Beiträge: 496
Registriert: 15.10.2004 17:42
Wohnort: 66557 Neunkirchen

Variablen + DLLs

Beitrag von H.Brill »

Hallo,
hab da was merkwürdiges im Zusammenhang
mit Frank Abbings Listview.dll festgestellt.
Folgende Procedure :

Code: Alles auswählen

Procedure Senden()
  Protected text1.s{100}, text2.s{80}, text3.s{80}
  Protected i.l, res.l
  text1 = ""
  text2 = ""
  text3 = ""
  
  For i = 0 To GetLines(lv1) - 1
    res = GetItemText(lv1, @text1, 0, i)
    res = GetItemText(lv1, @text2, 1, i)
    res = GetItemText(lv1, @text3, 2, i)
  SendNetworkString(ConnectionID, text1 + "," + text2 + "," + text3 + Chr(10) + Chr(13))
  MessageRequester("Ergebnis", text1 + "," + text2 + "," + text3 + Chr(10) + Chr(13), 0)
 Next 
EndProcedure
Wenn ich oben die Variablen text1.s, text2.s, text3.s
ohne geschweifte Klammer (Längenangabe) deklariere,
stürzt das Programm beim 2. Aufruf der Procedure mit
einem Lesefehler an Adresse ... usw. ab. So, wie es jetzt
oben im Code steht geht es.

Oder kann ich im obigen Code noch was optimieren ?

PS:
Schien mir nur etwas merkwürdig, da es erst beim
2. Aufruf der Procedure kracht.

Und mit

Code: Alles auswählen

Define.s text1, text2, text3
kracht es auch.
PB 6.10
Benutzeravatar
Bisonte
Beiträge: 2468
Registriert: 01.04.2007 20:18

Re: Variablen + DLLs

Beitrag von Bisonte »

Ich kenne die DLL nicht, aber ich nehme an, sie erwartet "feste Stringgrössen" weil sie vermutlich intern genau
hintereinanderhängen. Sollte dann ein String von der erwarteten Grösse abweichen, klappts natürlich nicht mehr...
PureBasic 6.21 (Windows x86/x64) | Windows11 Pro x64 | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | GeForce RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
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

Re: Variablen + DLLs

Beitrag von ts-soft »

SendNetworkstring sollte man eher vermeiden. Ohne den Empfangsteil des Codes läßt sich aber
nichts genaues sagen.
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
Frabbing
Beiträge: 160
Registriert: 15.02.2007 21:31
Kontaktdaten:

Re: Variablen + DLLs

Beitrag von Frabbing »

Die zuständige Listview-Message erwartet, dass der String Patz für mindestens 255 Zeichen bereitstellt. Du solltest also mit Space() arbeiten oder den Zeiger auf einen entsprechend großen Speicher übergeben.

Hab mich direkt mit PB & der Listview.dll noch nicht beschäftigt. Mit der Dll bin ich aber vertraut. ;-)
Gruß, Frank
Benutzeravatar
H.Brill
Beiträge: 496
Registriert: 15.10.2004 17:42
Wohnort: 66557 Neunkirchen

Re: Variablen + DLLs

Beitrag von H.Brill »

Bisonte :
Da haste wohl Recht. Frank schreibt ja in
seiner Doku, daß immer ein ordinärer Speicher-
bereich zu übergeben ist, was auch immer das
genau sein mag.
sonst reserviere ich bei dieser DLL immer mit
allocatememory() Speicher, was auch immer
funktioniert.
Wollte es halt diesmal anders machen.

ts-soft:
im Moment verwende ich als Gegenstelle das
bei PB beiliegende Networkserver - Beispiel.
Klappt auch soweit bei 127.0.0.1 gut.
Soll später mal so eine Art Syncronationstool
für mein Android Tablet werden. Dabei schicke
ich den aktualisierten Inhalt des Listviews an
mein Tablet, das diese dann für sich in eine
Datei speichert. Dabei will ich den Weg, die Datei
in den Windows Etidor zu laden und als UTF-8
zu speichern und dann wieder aufs Gerät, sparen.
Aber bis dahin dauerts noch.
PB 6.10
Benutzeravatar
Frabbing
Beiträge: 160
Registriert: 15.02.2007 21:31
Kontaktdaten:

Re: Variablen + DLLs

Beitrag von Frabbing »

Ach du bist das, Heinz. Denke, du wirst jetzt zurecht kommen.
Gruß, Frank
Benutzeravatar
H.Brill
Beiträge: 496
Registriert: 15.10.2004 17:42
Wohnort: 66557 Neunkirchen

Re: Variablen + DLLs

Beitrag von H.Brill »

Hallo Frank,
ja, du bist ja seit kurzem auch hier.
Daß es an den Variablen hängt, konnte
ich ja gleich rausfinden. Es war vielmehr
ein Verständnisproblem meinerseits :
Nach meinem Wissen löst ja ein Compiler
beim compilieren die Variablen zu Sprungadressen
im Speicher auf. Und diese sind ja dann in der
fertigen .Exe nicht mehr veränderbar. Und das
klappte auch beim Erstaufruf der Procedur, was
mich wiederrum verwunderte.

Bei einem normalen String in PB zeigt der Zeiger
(@) ja auch dorthin und außerdem müßte ja auch
die Länge (nehme mal als Standard 255 an) definiert
sein. Wenn ich also text1 = "" schreibe, müßte da dann
eine Adresse mit 0 Byte Größe (evtl. 1 Byte wegen Nullbyte)
stehen ?
Wenn dem so ist, hätte es schon beim ersten Aufruf
krachen müssen.

Es muß ja alles Hand und Fuß haben.
PB 6.10
Benutzeravatar
H.Brill
Beiträge: 496
Registriert: 15.10.2004 17:42
Wohnort: 66557 Neunkirchen

Re: Variablen + DLLs

Beitrag von H.Brill »

Hallo Frank,
Ist ja geil :
auch sowas mit 10 Zeichen geht :

Code: Alles auswählen

@"          "
Ist zwar ja sinnlos, da man ja eine befüllte
Variable zurück haben will, aber es geht.

PS: Frank, hier noch die .Pbi mit Prototypes,
falls du mal was ausprobieren möchtest.

Code: Alles auswählen

; als Prototype deklariert

#Library = 0
Global lview.l, value.l, text.s

lview = OpenLibrary(#Library, "Listview.dll")

Prototype pCreateListview(f.l, i.l, t.l, h.l, g.l, s.l)
Prototype pIColumn(h.l, t.l, b.l, f.l)
Prototype pSItem(h.l, b.l, a.l)
Prototype pShowListview(ha.l, x.l, y.l, b.l, h.l)
Prototype pInitMessages(h.l)
Prototype pASortListview(h.l, b.l, a.l)
Prototype pAddItemValues(lv.l, s.l, b.l, a.l)
Prototype pCheckIfMarked(lv.l)
Prototype pMarkIfChecked(lv.l)
Prototype pReadFileQuick(s.l, b.l, o.l, a.l)
Prototype pWriteFileQuick(s.l, b.l, o.l, a.l)
Prototype pSwapLines(b.l, a.l, f.l)
Prototype pCsvToListview(h.l, b.l, a.l, s.l)
Prototype pListviewToCsv(h.l, b.l, a.l, f.l)
Prototype pSetItemsFromMem(h.l, b.l, a.l, s.l)
Prototype pGetColumns(h.l)
Prototype pGetColumnName(lv.l, b.l, s.l)
Prototype pGetLines(h.l)
Prototype pGetSelected(bt.l, bl.l)
Prototype pGetSelectedDbClk(bt.l, bl.l)
Prototype pGetAllSelected(bt.l, bl.l)
Prototype pGetNeededMemory(h.l, f.l)
Prototype pGetTabOffsets(bt.l, bo.l)
Prototype pGetNullOffset(b.l)
Prototype pGetOwnControlParas(b.l, h.l, s.l, z.l)
Prototype pGetRealColumnIndex(lv.l, s.l)
Prototype pCreateImageList(f.l, b.l)
Prototype pDestroyImageList(i.l)
Prototype pSetImageList(h.l, i.l)
Prototype pSetIcon(h.l, z.l, n.l)
Prototype pSetIconMode(f.l)
Prototype pSetIconColumn(s.l)
Prototype pSetIconsFromMem(h.l, z.l, b.l, a.l)
Prototype pSetIconsWith(h.l, z.l, n.l, a.l)
Prototype pSetIndex(i.l)
Prototype pGetSelectedLine(h.l)
Prototype pGetColumnWidth(h.l, i.l)
Prototype pCryptMem(b.l, a.l, s.l, l.l)
Prototype pSetColumnsFromMem(h.l, b.l, o.l)
Prototype pSetColumnName(lv.l, b.l, s.l)
Prototype pCloseMessages(f.l)
Prototype pDbfToCsv(b.l, a.l, s.l, z.l, f.l)
Prototype pSelectLine(h.l, i.l, f.l)
Prototype pSetAllCheckboxStates(lv.l, b.l)
Prototype pDeleteDoubleItems(lv.l, s.l)
Prototype pEnableEdits(lv.l, fl.l)
Prototype pListviewToDbf(lv.l, ber.l, vb.l, fl.l)
Prototype pSetCheckboxState(lv.l, index.l, mode.l)
Prototype pGetCheckboxState(lv.l, index.l)
Prototype pGetAllCheckboxStates(H.l, B.l)   
Prototype pGetChecked(p1.l, p2.l, p3.l)
Prototype pSearchText(lv.l, start.l, ende.l, spalte.l, sstr.l, flag.l, espalte.l)
Prototype pSelectColumnEdits(lv.l, b.l)
Prototype pExchangeSeparator(ber.l, anzb.l, ascz.l, ersatz.l, f.l)
Prototype pCopyLineTo(qlv.l, zlv.l, qindex.l, zindex.l)
Prototype pCopyColumnTo(qlv.l, zlv.l, qindex.l, zindex.l)
Prototype pSortManual(h.l, i.l, f.l)
Prototype pFilelistToCsv(n.l, b.l, s.l, z.l, f.l, i.l)
Prototype pSetItemText(h.l, t.l, s.l, i.l)
Prototype pGetItemText(h.l, b.l, s.l, i.l)
Prototype pGetItemTextsAsFloat(lv.l, s.l, b.l)
Prototype pGetItemTextsAsInteger(lv.l, s.l, b.l)
Prototype pExamineColumn(h.l, s.l)
Prototype pSetColumnSort(h.l, s.l, f.l)
Prototype pGetColumnUpdate(h.l, b.l)
Prototype pRaiseColumns(h.l, b.l, s.l, g.l)
Prototype pRaiseLine(lv.l, l.l, s.l, g.l)
Prototype pMixRGB(f1.l, f2.l)
Prototype pSetBackImage(h.l, n.l, f.l)
Prototype pPrintListview(h.l, w.l, i.l, s.l, l.l, o.l, r.l, u.l, ps.l, pz.l, us.l, n.l, f.l)
Prototype pPrintColumns(b.l)
Prototype pAreCheckboxesPresent(h.l)
Prototype pEraseListview(h.l)
Prototype pGetControlParas(b.l)
Prototype pRegister(k.l)
Prototype pSetFilelistFilter(s.l)
Prototype pSetFilelistNoFilter(s.l)
Prototype pEnableDragDrop(lv.l, f.l)
Prototype pGetDragDropParas(b.l)
Prototype pSetStyle(s.l)
Prototype pGetVar(f.l)
Prototype pGetEdgeIntegers(b.l, a.l, l.l, h.l)
Prototype pGetEdgeFloats(b.l, a.l, l.f, h.f)
Prototype pGetIcon(lv.l, s.l, z.l)
Prototype pAreIconsPresent(H.l)
Prototype pSetColumnAlignment(lv.l, s.l, a.l)
Prototype pSetLineNumbers(lv.l, a.l, s.l)
Prototype pGetDllVersion()
Prototype pDeleteSpaceLines(lv.l, f.l)
Prototype pGetIndex()
Prototype pConvertDatas(lv.l, s.l, f.l)
Prototype pForbidScrollMessage(lv.l)
Prototype pExchangeBytes(lv.l, s.l, q.l, z.l)
Prototype pSetPrintAttributes(F.l, p1.l, p2.l, p3.l, p4.l)
Prototype pSetColumnsWidthLimits(L.l, H.l) 
Prototype pSetLineHeight(lv.l, y.l)
Prototype pGetLastKey(L.l,T.l) 
Prototype pListviewToRaw(H.l,B.l) 
Prototype pRawToListview(H.l, B.l)
Prototype pSetItemTextEx(H.l,T.l,S.l,L.l,A.l)
Prototype pGetItemTextEx(H.l,B.l,S.l,L.l,A.l) 
Prototype pBuildListview(H.l,S.l,L.l,B.l,T.l) 
Prototype pClearListview(H.l) 
Prototype pEditManual(H.l,S.l,Z.l,F.l) 
Prototype pCsvToHeader(H.l, B.l, O.l)
Prototype pDeleteAllItems(H.l)
Prototype pDeleteColumn(H.l, I.l)
Prototype pDeleteItem(H.l, I.l)
Prototype pGetItemState(lv.l, index.l, status.l)
Prototype pGetSelectedCount(lv.l)
Prototype pUpdateListview(H.l)
Prototype pGetLineText(h.l, i.l, b.l)
Prototype pSetColumnUpdate(H.l, B.l)
Prototype pHeaderToCsv(H.l, B.l, A.l, F.l)
Prototype pSearchBlankItem(H.l, S.l, L.l)

If IsLibrary(#Library)
   Global CreateListview.pCreateListview = GetFunction(#Library, "CreateListview")
   Global IColumn.pIColumn = GetFunction(#Library, "IColumn")
   Global SItem.pSItem = GetFunction(#Library, "SItem")
   Global ShowListview.pShowListview = GetFunction(#Library, "ShowListview")  
   Global InitMessages.pInitMessages = GetFunction(#Library, "InitMessages")
   Global ASortListview.pASortListview = GetFunction(#Library, "ASortListview")
   Global AddItemValues.pAddItemValues = GetFunction(#Library, "AddItemValues")
   Global CheckIfMarked.pCheckIfMarked = GetFunction(#Library, "CheckIfMarked")
   Global MarkIfChecked.pMarkIfChecked = GetFunction(#Library, "MarkIfChecked")
   Global ReadFileQuick.pReadFileQuick = GetFunction(#Library, "ReadFileQuick")
   Global WriteFileQuick.pWriteFileQuick = GetFunction(#Library, "WriteFileQuick")
   Global SwapLines.pSwapLines = GetFunction(#Library, "SwapLines")
   Global CsvToListview.pCsvToListview = GetFunction(#Library, "CsvToListview")
   Global ListviewToCsv.pListviewToCsv = GetFunction(#Library, "ListviewToCsv")                
   Global SetItemsFromMem.pSetItemsFromMem = GetFunction(#Library, "SetItemsFromMem")
   Global GetColumns.pGetColumns = GetFunction(#Library, "GetColumns")
   Global GetColumnName.pGetColumnName = GetFunction(#Library, "GetColumnName")
   Global GetLines.pGetLines = GetFunction(#Library, "GetLines")
   Global GetSelected.pGetSelected = GetFunction(#Library, "GetSelected")
   Global GetSelectedDbClk.pGetSelectedDbClk = GetFunction(#Library, "GetSelectedDbClk")
   Global GetAllSelected.pGetAllSelected = GetFunction(#Library, "GetAllSelected")
   Global GetAllCheckboxStates.pGetAllCheckboxStates = GetFunction(#Library, "GetAllCheckboxStates")
   Global GetNeededMemory.pGetNeededMemory = GetFunction(#Library, "GetNeededMemory")
   Global GetTabOffsets.pGetTabOffsets = GetFunction(#Library, "GetTabOffsets")
   Global GetNullOffset.pGetNullOffset = GetFunction(#Library, "GetNullOffset")
   Global GetOwnControlParas.pGetOwnControlParas = GetFunction(#Library, "GetOwnControlParas")
   Global GetRealColumnIndex.pGetRealColumnIndex = GetFunction(#Library, "GetRealColumnIndex")
   Global CreateImageList.pCreateImageList = GetFunction(#Library, "CreateImageList")
   Global SetImageList.pSetImageList = GetFunction(#Library, "SetImageList")
   Global SetIcon.pSetIcon = GetFunction(#Library, "SetIcon")
   Global SetIconMode.pSetIconMode = GetFunction(#Library, "SetIconMode")
   Global SetIconColumn.pSetIconColumn = GetFunction(#Library, "SetIconColumn")
   Global SetIconsFromMem.pSetIconsFromMem = GetFunction(#Library, "SetIconsFromMem")
   Global SetIconsWith.pSetIconsWith = GetFunction(#Library, "SetIconsWith")
   Global SetIndex.pSetIndex = GetFunction(#Library, "SetIndex")
   Global SetColumnsWidthLimits.pSetColumnsWidthLimits = GetFunction(#Library, "SetColumnsWidthLimits")
   Global GetSelectedLine.pGetSelectedLine = GetFunction(#Library, "GetSelectedLine")
   Global GetColumnWidth.pGetColumnWidth = GetFunction(#Library, "GetColumnWidth")
   Global CryptMem.pCryptMem = GetFunction(#Library, "CryptMem")
   Global SetColumnsFromMem.pSetColumnsFromMem = GetFunction(#Library, "SetColumnsFromMem")
   Global SetColumnName.pSetColumnName = GetFunction(#Library, "SetColumnName")
   Global CloseMessages.pCloseMessages = GetFunction(#Library, "CloseMessages")
   Global DbfToCsv.pDbfToCsv = GetFunction(#Library, "DbfToCsv")
   Global SelectLine.pSelectLine = GetFunction(#Library, "SelectLine")
   Global SetAllCheckboxStates.pSetAllCheckboxStates = GetFunction(#Library, "SetAllCheckboxStates")
   Global DeleteDoubleItems.pDeleteDoubleItems = GetFunction(#Library, "DeleteDoubleItems")
   Global EnableEdits.pEnableEdits = GetFunction(#Library, "EnableEdits")
   Global ListviewToDbf.pListviewToDbf = GetFunction(#Library, "ListviewToDbf")
   Global SetCheckboxState.pSetCheckboxState = GetFunction(#Library, "SetCheckboxState")
   Global GetCheckboxState.pGetCheckboxState = GetFunction(#Library, "GetCheckboxState")
   Global GetChecked.pGetChecked = GetFunction(#Library, "GetChecked")
   Global SearchText.pSearchText = GetFunction(#Library, "SearchText")
   Global SelectColumnEdits.pSelectColumnEdits = GetFunction(#Library, "SelectColumnEdits") 
   Global ExchangeSeparator.pExchangeSeparator = GetFunction(#Library, "ExchangeSeparator")
   Global CopyLineTo.pCopyLineTo = GetFunction(#Library, "CopyLineTo")
   Global CopyColumnTo.pCopyColumnTo = GetFunction(#Library, "CopyColumnTo")
   Global GetIndex.pGetIndex = GetFunction(#Library, "GetIndex")
   Global SortManual.pSortManual = GetFunction(#Library, "SortManual")
   Global FilelistToCsv.pFilelistToCsv = GetFunction(#Library, "FilelistToCsv")
   Global SetItemText.pSetItemText = GetFunction(#Library, "SetItemText")
   Global GetItemText.pGetItemText = GetFunction(#Library, "GetItemText")
   Global GetItemTextsAsFloat.pGetItemTextsAsFloat = GetFunction(#Library, "GetItemTextsAsFloat")
   Global GetItemTextsAsInteger.pGetItemTextsAsInteger = GetFunction(#Library, "GetItemTextsAsInteger")
   Global ExamineColumn.pExamineColumn = GetFunction(#Library, "ExamineColumn")
   Global SetColumnSort.pSetColumnSort = GetFunction(#Library, "SetColumnSort")
   Global GetColumnUpdate.pGetColumnUpdate = GetFunction(#Library, "GetColumnUpdate")
   Global SetColumnUpdate.pSetColumnUpdate = GetFunction(#Library, "SetColumnUpdate")
   Global RaiseColumns.pRaiseColumns = GetFunction(#Library, "RaiseColumns")
   Global RaiseLine.pRaiseLine = GetFunction(#Library, "RaiseLine")
   Global MixRGB.pMixRGB = GetFunction(#Library, "MixRGB")
   Global SetBackImage.pSetBackImage = GetFunction(#Library, "SetBackImage")
   Global PrintListview.pPrintListview = GetFunction(#Library, "PrintListview")
   Global PrintColumns.pPrintColumns = GetFunction(#Library, "PrintColumns")
   Global AreCheckboxesPresent.pAreCheckboxesPresent = GetFunction(#Library, "AreCheckboxesPresent")
   Global AreIconsPresent.pAreIconsPresent = GetFunction(#Library, "AreIconsPresent")
   Global EraseListview.pEraseListview = GetFunction(#Library, "EraseListview")
   Global GetControlParas.pGetControlParas = GetFunction(#Library, "GetControlParas")
   Global Register.pRegister = GetFunction(#Library, "Register")
   Global SetFilelistFilter.pSetFilelistFilter = GetFunction(#Library, "SetFilelistFilter")
   Global SetFilelistNoFilter.pSetFilelistNoFilter = GetFunction(#Library, "SetFilelistNoFilter")
   Global EnableDragDrop.pEnableDragDrop = GetFunction(#Library, "EnableDragDrop")
   Global GetDragDropParas.pGetDragDropParas = GetFunction(#Library, "GetDragDropParas")       
   Global SetStyle.pSetStyle = GetFunction(#Library, "SetStyle")
   Global GetVar.pGetVar = GetFunction(#Library, "GetVar")
   Global GetEdgeIntegers.pGetEdgeIntegers = GetFunction(#Library, "GetEdgeIntegers")
   Global GetEdgeFloats.pGetEdgeFloats = GetFunction(#Library, "GetEdgeFloats")
   Global GetIcon.pGetIcon = GetFunction(#Library, "GetIcon")
   Global SetColumnAlignment.pSetColumnAlignment = GetFunction(#Library, "SetColumnAlignment")
   Global SetLineNumbers.pSetLineNumbers = GetFunction(#Library, "SetLineNumbers")
   Global GetDllVersion.pGetDllVersion = GetFunction(#Library, "GetDllVersion")
   Global DeleteSpaceLines.pDeleteSpaceLines = GetFunction(#Library, "DeleteSpaceLines")
   Global ConvertDatas.pConvertDatas = GetFunction(#Library, "ConvertDatas")
   Global ForbidScrollMessage.pForbidScrollMessage = GetFunction(#Library, "ForbidScrollMessage")
   Global ExchangeBytes.pExchangeBytes = GetFunction(#Library, "ExchangeBytes")
   Global SetPrintAttributes.pSetPrintAttributes = GetFunction(#Library, "SetPrintAttributes")
   Global SetLineHeight.pSetLineHeight = GetFunction(#Library, "SetLineHeight")
   Global GetLastKey.pGetLastKey = GetFunction(#Library, "GetLastKey")
   Global SetColumnsWidthLimits.pSetColumnsWidthLimits = GetFunction(#Library, "SetColumnsWidthLimits")
   Global ListviewToRaw.pListviewToRaw = GetFunction(#Library, "ListviewToRaw")
   Global RawToListview.pRawToListview = GetFunction(#Library, "RawToListview")
   Global SetItemTextEx.pSetItemTextEx = GetFunction(#Library, "SetItemTextEx")
   Global GetItemTextEx.pGetItemTextEx = GetFunction(#Library, "GetItemTextEx") 
   Global BuildListview.pBuildListview = GetFunction(#Library, "BuildListview")
   Global ClearListview.pClearListview = GetFunction(#Library, "ClearListview")
   Global EditManual.pEditManual = GetFunction(#Library, "EditManual")
   Global CsvToHeader.pCsvToHeader = GetFunction(#Library, "CsvToHeader")
   Global HeaderToCsv.pHeaderToCsv = GetFunction(#Library, "HeaderToCsv")
   Global DeleteAllItems.pDeleteAllItems = GetFunction(#Library, "DeleteAllItems")
   Global DeleteColumn.pDeleteColumn = GetFunction(#Library, "DeleteColumn")
   Global DeleteItem.pDeleteItem = GetFunction(#Library, "DeleteItem")
   Global GetItemState.pGetItemState = GetFunction(#Library, "GetItemState")
   Global GetSelectedCount.pGetSelectedCount = GetFunction(#Library, "GetSelectedCount")
   Global UpdateListview.pUpdateListview = GetFunction(#Library, "UpdateListview")
   Global HeaderToCsv.pHeaderToCsv = GetFunction(#Library, "HeaderToCsv")
   Global SearchBlankItem.pSearchBlankItem = GetFunction(#Library, "SearchBlankItem")
Else
  MessageRequester("Fehler", "Library nicht gefunden", 0)
  End
EndIf

Procedure DestroyImageList(i.l)
  ImageList_Destroy_(i)
EndProcedure  

Procedure.s GetLineText(h.l, i.l, b.l)
  value = GetFunction(#Library, "GetLineText")
  If value <> 0
     text = PeekS(b)
  Else
     text = ""
  EndIf
  ProcedureReturn text      
EndProcedure
    
Procedure.l GetLVTxtColor(lv.l)
  value = SendMessage_(lv, $1023, 0, 0)
  ProcedureReturn value
EndProcedure

Procedure.l GetLVTxtBKColor(lv.l)
   value = SendMessage_(lv, $1025, 0, 0)
   ProcedureReturn value
EndProcedure

Procedure.l GetLVBKColor(lv.l)
   value = SendMessage_(lv, $1000, 0, 0)
   ProcedureReturn value
EndProcedure
PB 6.10
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

Re: Variablen + DLLs

Beitrag von ts-soft »

Code: Alles auswählen

Define.s Text1
Define.s Text2 = ""
Beim Pointer zu Text1 kracht es, da der String noch nicht existiert! (Adresse 0)
Beim Pointer zu Text2 gibt es keine Probleme, da dieser bereits eine
Adresse besitzt und aus einem bzw. 2 nullbytes besteht.
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
H.Brill
Beiträge: 496
Registriert: 15.10.2004 17:42
Wohnort: 66557 Neunkirchen

Re: Variablen + DLLs

Beitrag von H.Brill »

Hab auch manchmal vom Debugger
die Adresse der Variablen angezeigt
bekommen.

Dann ist es ja evtl. auch eine gute Sache :
Der Compiler löst erst dann die Variablen zu
Adressen auf, wenn diese auch benutzt bzw.
mit einem Wert belegt werden.
Bloß, wenn ich text1.s{100} auch nicht
mit text1 = "" belege, sondern nur deklariere,
gehts komischerweise auch.
PB 6.10
Antworten