C ++ Forum | | | | Detlef Jagolski | Hello Sebastian, if I The procedure SaveAccess aufrufe crashes my Program ex, kann’s You me a Tipp give. under XProfan runs it without Problems. Getestet with Profan2cpp 2.0 thanks in ahead.
Greeting Detlef Syntay-Check: No Error or Warnungen "CrogrammeDev-C++ing++.exe" -c PrfMain.cpp -o .objPrfMain.o -I"CrogrammeDev-C++include" -I"CrogrammeDev-C++includeg++" -L"CrogrammeDev-C++lib" -B"CrogrammeDev-C++in" -fexceptions -s -mwindows -w -O2 -fvtable-thunks -fno-elide-constructors "CrogrammeDev-C++ing++.exe" -c Vorlage_Neu.cpp -o .objVorlage_Neu.o -I"CrogrammeDev-C++include" -I"CrogrammeDev-C++includeg++" -L"CrogrammeDev-C++lib" -B"CrogrammeDev-C++in" -fexceptions -s -mwindows -w -O2 -fvtable-thunks -fno-elide-constructors "CrogrammeDev-C++ing++.exe" -o "Vorlage_Neu.exe" ".objPrfMain.o" ".objVorlage_Neu.o" ".esesource.o" ".libplibbase.lib" ".libplibstr.lib" ".libplibwin.lib" ".libplibfile.lib" ".libplibgdi.lib" ".libplibsql.lib" -luuid "CrogrammeDev-C++liblibglu32.a" "CrogrammeDev-C++liblibopengl32.a" "CrogrammeDev-C++liblibole32.a" "CrogrammeDev-C++liblibolepro32.a" "CrogrammeDev-C++liblibodbc32.a" "CrogrammeDev-C++liblibwsock32.a" "CrogrammeDev-C++liblibcomctl32.a" "CrogrammeDev-C++liblibwinmm.a" -I"CrogrammeDev-C++include" -I"CrogrammeDev-C++includeg++" -L"CrogrammeDev-C++lib" -B"CrogrammeDev-C++in" -fexceptions -s -mwindows -w -O2 -fvtable-thunks -fno-elide-constructors Finished.
Proc SaveAccess
Dim ItemText#,3584
Dim memory#,3584
Clear ItemText#
Clear memory#
FileName$ = SaveFile$("Speichern unter","Microsoft Access-data base (*.mdb) | *.mdb")
If FileName$ <> ""
CreateAccess FileName$
AccessDB& = SQLInit("DSN=Microsoft Access-Datenbank;DBQ="+FileName$)
Set("SQLDBC",AccessDB&)
Set("SQLNULL","")
Set("SQLFile",SubStr$(FileName$, -1, ".") + ".DAT")
SQLString$ = "CREATE TABLE Projektdaten ([proposition-Nr] TEXT, [Bezeichnung 1] TEXT, [Bezeichnung 2] TEXT, "
SQLString$ = SQLString$ + "[Schneidplantyp] TEXT, [weight 1] TEXT, [weight 2] TEXT, [block weight] TEXT, "
SQLString$ = SQLString$ + "[block length] TEXT, "[block wide] TEXT, [block Höhe] TEXT, [Teilung length] TEXT, "
SQLString$ = SQLString$ + "[Teilung wide] TEXT, [Teilung Höhe] TEXT, [Schneidbreite length] TEXT, "
SQLString$ = SQLString$ + "[Schneidbreite wide] TEXT, [Schneidbreite Höhe] TEXT)"
SQLEXEC SQLString$,2
ProjektNr$ = GetText$(Edit1&)
Bezeichnung_1$ = GetText$(Edit2&)
Bezeichnung_2$ = GetText$(Edit3&)
Schneidplantyp$ = GetText$(ChoiceBox1&)
Such_Gewicht_1$ = GetText$(Edit4&)
Such_Gewicht_2$ = GetText$(Edit5&)
Block_Gewicht$ = GetText$(Edit6&)
Block_Laenge$ = GetText$(Edit7&)
Block_Breite$ = GetText$(Edit8&)
Block_Hoehe$ = GetText$(Edit9&)
Teilung_Laenge$ = GetText$(SpinEdits1&)
Teilung_Breite$ = GetText$(SpinEdits2&)
Teilung_Hoehe$ = GetText$(SpinEdits3&)
Schnitt_Laenge$ = GetText$(Edit10&)
Schnitt_Breite$ = GetText$(Edit11&)
Schnitt_Hoehe$ = GetText$(Edit12&)
SQLString$ = "INSERT INTO Projektdaten VALUES (:ProjektNr$,:Bezeichnung_1$,:Bezeichnung_2$,:Schneidplantyp$,"
SQLString$ = SQLString$ + ":Such_Gewicht_1$,:Such_Gewicht_2$,:Block_Gewicht$,:Block_Laenge$,:Block_Breite$,"
SQLString$ = SQLString$ + ":Block_Hoehe$,:Teilung_Laenge$)"
SQLEXEC SQLString$,2
Ifnot GetLines(ListView1&) = 0
If GetText$(ChoiceBox1&) = "Standard"
SQLString$ = "CREATE TABLE Schneidpläne ([Lfd-Nr] TEXT, [measured from length] TEXT, [measured from wide] TEXT, "
SQLString$ = SQLString$ + "[measured from Höhe] TEXT, Teilung length] TEXT, [Teilung wide] TEXT, "
SQLString$ = SQLString$ + "[Teilung Höhe] TEXT, [Produktanzahl] TEXT, [yield] TEXT, [Produktgewicht] TEXT)"
SQLEXEC SQLString$,2
Clear Zeile&
Repeat
Clear ItemText#
Clear memory#
GetLineText(ListView1&,Zeile&,ItemText#)
GetTabOffsets(ItemText#,memory#)
counter$ = String $(ItemText#,Long(memory#,0))
Portions_Laenge$ = String $(ItemText#,Long(memory#,4))
Portions_Breite$ = String $(ItemText#,Long(memory#,8))
Portions_Hoehe$ = String $(ItemText#,Long(memory#,12))
Teilung_Laenge$ = String $(ItemText#,Long(memory#,16))
Teilung_Breite$ = String $(ItemText#,Long(memory#,20))
Teilung_Hoehe$ = String $(ItemText#,Long(memory#,24))
Block_Portionen$ = String $(ItemText#,Long(memory#,28))
Block_Ausbeute$ = String $(ItemText#,Long(memory#,32))
Portions_Gewicht$ = String $(ItemText#,Long(memory#,36))
SQLString$ = "INSERT INTO Schneidpläne VALUES (:counter$,:Portions_Laenge$,:Portions_Breite$,:Portions_Hoehe$,"
SQLString$ = SQLString$ + ":Teilung_Laenge$,:Teilung_Breite$,:Teilung_Hoehe$,:Block_Portionen$,:Block_Ausbeute$,"
SQLString$ = SQLString$ + ":Portions_Gewicht$)"
SQLEXEC SQLString$,2
Inc Zeile&
Until Zeile& = GetLines(ListView1&)
ElseIf GetText$(ChoiceBox1&) = "Offset"
SQLString$ = "CREATE TABLE Schneidpläne ([Lfd-Nr] TEXT, [measured from length] TEXT, [measured from wide] TEXT, "
SQLString$ = SQLString$ + "[measured from length] TEXT, [measured from wide] TEXT, [measured from Höhe] TEXT, "
SQLString$ = SQLString$ + "[Teilung length 1] TEXT, [Teilung length 2] TEXT, [Teilung wide] TEXT, "
SQLString$ = SQLString$ + "[Teilung Höhe] TEXT, [Produktanzahl] TEXT, [yield] TEXT, "
SQLString$ = SQLString$ + "[Produktgewicht 1] TEXT, [Produktgewicht 2] TEXT)"
SQLEXEC SQLString$,2
Clear Zeile&
Repeat
Clear ItemText#
Clear memory#
GetLineText(ListView1&,Zeile&,ItemText#)
GetTabOffsets(ItemText#,memory#)
counter$ = String $(ItemText#,Long(memory#,0))
Portions_Laenge$ = String $(ItemText#,Long(memory#,4))
Riegel_Breite_1$ = String $(ItemText#,Long(memory#,8))
Portions_Laenge_2$ = String $(ItemText#,Long(memory#,12))
Riegel_Breite_2$ = String $(ItemText#,Long(memory#,16))
Portions_Hoehe$ = String $(ItemText#,Long(memory#,20))
Schnitt_Anzahl_Laenge$ = String $(ItemText#,Long(memory#,24))
Schnitt_Anzahl_Laenge_2$ = String $(ItemText#,Long(memory#,28))
Schnitt_Anzahl_Breite$ = String $(ItemText#,Long(memory#,32))
Schnitt_Anzahl_Hoehe$ = String $(ItemText#,Long(memory#,36))
Block_Portionen_1$ = String $(ItemText#,Long(memory#,40))
Block_Ausbeute_1$ = String $(ItemText#,Long(memory#,44))
Portions_Gewicht_1$ = String $(ItemText#,Long(memory#,48))
Portions_Gewicht_2$ = String $(ItemText#,Long(memory#,52))
SQLString$ = "INSERT INTO Schneidpläne VALUES (:counter$,:Portions_Laenge$,:Riegel_Breite_1$,"
SQLString$ = SQLString$ + ":Portions_Laenge_2$,:Riegel_Breite_2$,:Portions_Hoehe$,"
SQLString$ = SQLString$ + ":Schnitt_Anzahl_Laenge$,:Schnitt_Anzahl_Laenge_2$,:Schnitt_Anzahl_Breite$,"
SQLString$ = SQLString$ + ":Schnitt_Anzahl_Laenge_2$,:Schnitt_Anzahl_Breite$,:Schnitt_Anzahl_Hoehe$,"
SQLString$ = SQLString$ + ":Block_Portionen_1$,:Block_Ausbeute_1$,:Portions_Gewicht_1$,:Portions_Gewicht_2$)"
SQLEXEC SQLString$,2
Inc Zeile&
Until Zeile& = GetLines(ListView1&)
EndIf
EndIf
SQLDone
EndIf
Dispose ItemText#
Dispose memory#
ENDPROC
|
| | | XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 10/29/08 ▲ |
| |
| | Sebastian König | Hello Detlef,
i'll time look over, what there schiefläuft. unfortunately is it with the neckline alone very heavy, something konkretes To say... can You me (by Email or PM) evtl. a complete lauffähigen code to that testing send?
thanks,
Sebastian |
| | | Windows XP, XProfan/Profan² 4.5 bis 11 Profan2Cpp-Homepage: [...] Alte Profan²-Seite: [...] | 10/30/08 ▲ |
| |
| | Detlef Jagolski | Hello Sebastian, whom Error have I so far eingrenzen can, that the Error here lying must: FileName$ = SaveFile$("Speichern unter","Microsoft Access-data base (*.mdb) | *.mdb") If I it without Subclassing make goes it, if I SaveFile$... from the Subclass procedure Starte, crashes the program ex.
Greeting
Detlef
Def &WM_GETMINMAXINFO 36
Def &WM_RBUTTONDOWN 516
Declare MinMaxInfo#
SubClassProc
If SubClassMessage(%hwnd, &WM_GETMINMAXINFO)
Fenstergrösse retrenching
Dim MinMaxInfo#,40
MinMaxInfo# = &sLParam
Long MinMaxInfo#,24 = 871
Long MinMaxInfo#,28 = 563
Long MinMaxInfo#,32 = %MaxX
Long MinMaxInfo#,36 = %MaxY
Dispose MinMaxInfo#
Set("WinProc",0)
ElseIf SubClassMessage(%hwnd, &WM_RBUTTONDOWN)
Test
Set("WinProc", 0)
EndIf
ENDPROC
Proc Test
FileName$ = SaveFile$("Speichern unter","Microsoft Access-data base (*.mdb) | *.mdb")
ENDPROC
Declare appexit%, FileName$
Window Title "DesignForm"
Window %maxX + 5,0 - 871,563
cls
Set("SubClassMode",1)
SubClass %hwnd,1
SetWindowPos %hwnd = 0,0 - 871,563;0
Test
WhileNot appexit%
WaitInput
If %key = 2
appexit%=1
ElseIf %key = 4
Fenstergröße
ElseIf %key = 5
Help
EndIf
|
| | | XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 10/30/08 ▲ |
| |
| | Sebastian König | Hello Detlef,
sorry, I me now first again login. unfortunately be I yesterday not moreover come, me with the thing To keep busy.
thanks In any drop for code - I can whom Error so understand. Spontan be I though not so sure, whether I there matter can. such Aufrufe of Dialogen from the SubClassProc out are generally not recommendable - too in XProfan self not (möglicherweise is it only chance, that the code so functions). The in the XProfan-Help recommended lane is the usage of SetMenuItem and accordingly The Verlagerung the actual action into Progamm-Hauptschleife.
i'll nevertheless time bad, whether I it evtl. as it is running bring can.
MfG
Sebastian |
| | | Windows XP, XProfan/Profan² 4.5 bis 11 Profan2Cpp-Homepage: [...] Alte Profan²-Seite: [...] | 11/01/08 ▲ |
| |
| | | GetOpenFileName [...] inside the SubClassProc can imho never long well weg, think one on my own on hwndOwner the "OPENFILENAME Structure". |
| | | | |
| | Detlef Jagolski | Hello Sebastian,
no trouble, your Training and your private life weg to. have meanwhile it too with SetMenuItem resolved.
thanks and Greeting
Detlef |
| | | XProfan X4, PRFellow, Profan2Cpp - Version 2.0c-pre5, Windows 11 | 11/01/08 ▲ |
| |
| | Sebastian König | Hello Detlef,
thanks for your understanding . I have meanwhile a idea, I evtl. Change could around the ursprünglichen code to get started and will be the time try. The Solution for with SetMenuItem stops I though in each drop for rather and safer...
MfG
Sebastian |
| | | Windows XP, XProfan/Profan² 4.5 bis 11 Profan2Cpp-Homepage: [...] Alte Profan²-Seite: [...] | 11/02/08 ▲ |
| |
|
AnswerThemeninformationenthis Topic has 3 subscriber: |