Ja, ja, so ist es heute. Der Empfänger hat sich anzupassen. Habe auch einige Aspiranten, die mir ungefragt docx senden. Die Antworten sind dann in odt und im Wiederholungsfall sla. Soll er sich die entsprechend Software doch besorgen.;)
Gruß Thomas
Ja, ja, so ist es heute. Der Empfänger hat sich anzupassen. Habe auch einige Aspiranten, die mir ungefragt docx senden. Die Antworten sind dann in odt und im Wiederholungsfall sla. Soll er sich die entsprechend Software doch besorgen.;)
Gruß Thomas
Bei mir ist kein PRINT über
möglich. Fehlermeldung: keine Anwendung zugewiesen.
Zu den Fragen kann ich weiter nichts sagen, denn es sind Codeschnipsel aus der plv.pinc, die seinerzeit für einfach Listviews erstellt wurde.
Proc GetColumn
Parameters lvHndl&,Spalte&
Declare Column#,txt#,SpaltenBreite&,txt$
Dim Column#,LV_COLUMN
Dim txt#,260
Clear txt#
With Column#
.Maske& = $000F
.pointerText& = txt#
.TextLen& = SizeOf(txt#)
.Spalte& = Spalte&
EndWith
SendMessage(lvHndl&,$1019,Spalte&,Column#)
SpaltenBreite& = SendMessage(lvHndl&,$101D,Spalte&,0)
txt$ = (Str$(SpaltenBreite&) + "|" + String$(txt#,0))
Dispose Column#
Dispose txt#
Return txt$
EndProc
Alles anzeigen
Eine inc für Listview zu html (savehtml.inc) gibt es auch von Dieter Z. auf seiner, im Prinzip nicht mehr erreichbaren, WEB-Seite: Quellcode
Gruß
Thomas
Gridbox über HTML drucken
Und warum über eine *.csv die html erzeugen?
Probleme bei @ShellExec(htmdatei$, "print", 1) könnten je nach Browser z.B. durch: Shell "Browser.exe -P HILFE.html" vielleicht umschifft werden.
$H commctrl.ph
$H Structs.ph
$H Messages.ph
Declare Handle Grid, btn1, btn2
Declare csvdatei$, htmdatei$
csvdatei$ = "data.csv"
htmdatei$ = $TempDir+"Grid.html"
WindowTitle "HTML - Window"
Window 800, 600
Proc CountGridColumns
Parameters Handle hGrid
Declare Memory b
Declare flag&
Var TotalColumns& = 0
Struct LV_COLUMN = ~LV_COLUMN
Dim b, LV_COLUMN
b.mask& = ~LVCF_WIDTH
Repeat
Inc TotalColumns&
flag& = SendMessage(hGrid, ~LVM_GETCOLUMN, TotalColumns&, b)
Until flag& = 0
Dispose b
Return TotalColumns&
EndProc
Proc LV_GETCOLUMN
Parameters Handle Hdl,Index&
Declare Column#,Text$,Erfolg%
Struct LVCOLUMN = mask&, fmt&, cx&, pszText%%, cchTextMax&, iSubItem&, iImage&, iOrder&
Dim Column#, LVCOLUMN
Text$ = MkStr$("\z",160) ' hier anpassen, wenn die Texte länger sein sollten
Column#.mask& = ~LVCF_TEXT
Column#.pszText%% = Addr(Text$)
Column#.cchTextMax& = 160 ' s.o.
SendMessage(Hdl,~LVM_GETCOLUMN,Index&,Column#)
Return Text$
EndProc
Proc DruckeGrid
Parameters Handle dGrid, Prozess
Declare anz&, zeile$, cols&, column$, tmp$
cols& = CountGridColumns(dGrid)
Declare Memory b
Assign #1, htmdatei$
Rewrite #1
Print #1,"<!DOCTYPE html PUBLIC"+chr$(34)+"-//W3C//DTD XHTML 1.0 Transitional//EN"+chr$(34)+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"+chr$(34)+">"
Print #1, "<html xmlns="+chr$(34)+"http://www.w3.org/1999/xhtml"+chr$(34)+" xml:lang="+chr$(34)+"de"+chr$(34)+" lang="+chr$(34)+"de"+chr$(34)+">"
Print #1,"<head>"
Print #1, "<title>Unbenannt</title>"
Print #1, "<style type="+chr$(34)+"text/css"+chr$(34)+">"
Print #1, "td {font-family:Verdana; font-size:12px; border: 1px solid rgb(0, 0, 0); padding: 3px; text-align: left}"
Print #1, "th {font-family:Verdana; font-size:12px; font-weight:bold; border: 1px solid rgb(0, 0, 0); padding: 3px; text-align: left}"
Print #1, ".zeile1 {font-family:Verdana; font-size:12px; }"
Print #1, ".zeile3 {font-family:Verdana; font-size:12px;color:black; background-color:#A8D2FD;}"
Print #1, "</style>"
Print #1,"</head>"
Print #1, "<body>"
Print #1, "<table>"
Print #1, "<colgroup>"
Struct LV_COLUMN = Maske&,Formate&,SpaltenBreite&,pointerText&,TextLen&,Spalte&
Declare Column#,x&
Dim Column#,LV_COLUMN
WhileLoop 0,(cols& - 1),1
With Column#
.Maske& = $000F
.Spalte& = &loop
EndWith
SendMessage(Grid,$1019,&loop,Column#)
x&= SendMessage(Grid,$101D,&loop,0)
Print #1, "<col width="+chr$(34)+Str$(x&)+"px"+chr$(34)+">"
EndWhile
Print #1, "</colgroup>"
Print #1, "<tr >"
WhileLoop 0, Cols&-1
Print #1, "<th class="+chr$(34)+"zeile3"+chr$(34)+">" + Trim$(LV_GETCOLUMN(dGrid, &loop)) + "</th>"
EndWhile
Print #1, "</tr>"
anz& = GetCount(dGrid)
Var x%=0
While x%<anz&
Print #1, "<tr>"
WhileLoop 0, Cols&-1
Print #1, "<td class="+chr$(34)+"zeile1"+chr$(34)+">" + Trim$(GetText$(dGrid, x%, &loop)) + "</td>"
EndWhile
Print #1, "</tr>"
inc x%
EndWhile
Print #1, "</table>"
Print #1, "</body>"
Print #1, "</html>"
Close #1
@ShellExec(htmdatei$, "open", 1)
EndProc
btn1 = @Create("Button", %Hwnd, "Ende", 10, 10, 60, 25)
btn2 = @Create("Button", %HWnd, "Drucke Grid", 100, 10, 100, 25)
Grid = @Create("Gridbox", %HWnd, "Name;0;240;Vorname;0;100;Ort;0;240", 0,10,50,600,300)
AddString(Grid, "Maier|Hugo|Hamburg")
AddString(Grid, "Müller|Gerda|Köln")
AddString(Grid, "Schneider|Klaus|München")
AddString(Grid, "Zimmer|Rosi|Kiel")
AddString(Grid, "Schmitt|Melani|Stuttgart")
WhileNot @Clicked(btn1)
WaitInput
If @Clicked(btn2)
DruckeGrid(Grid)
EndIf
EndWhile
End
Alles anzeigen
Gruß Thomas
Irgendwie bekomme ich nicht viel Information zu sehen und das, wo immer gerne AHTs Tools teste. Wo habe ich ein Problem oder etwas nicht verstanden.
Gruß
Thomas [Blockierte Grafik: http://s21.postimg.org/4fw9407tv/Screen1.jpg] [Blockierte Grafik: http://s21.postimg.org/lw47axaxv/Screen2.jpg]
Irgendwie kann ich in der Hilfe kein
finden.
Kenne "Static" nur als "Control". Verwende aber lieber ein "Dialog"
WindowStyle 26 | 512
Window 800,600
WindowTitle "Arbeitsfenster"
cls
Var ELEMENT1&=Control("DIALOG","",$54001100,200,100,200,300,%hwnd,0,%hinstance,$0)
var choicebox1% = Create("ChoiceBox", ELEMENT1&, 0, 30, 30, 120, 200)
@AddString(choicebox1%,"Noch nicht gemahnte Rechnungen")
@AddString(choicebox1%,"I Mahnung")
@AddString(choicebox1%,"II Mahnung")
@AddString(choicebox1%,"III Mahnung")
@AddString(choicebox1%,"Inkasso")
var Auswahl%=CreateText(%hwnd,"",10,10,400,22)
while 1
waitinput
case %key=2:BREAK
case clicked(choicebox1%): settext Auswahl%,gettext$(choicebox1%)
wend
Alles anzeigen
Gruß Thomas
Versuche es einmal mit:
DEF PathQuoteSpaces(1) ! "SHLWAPI.DLL","PathQuoteSpacesA"
proc QuoteSpaces
'setzt Pfad in Anführungszeichen
parameters p_Pfad$
Declare p_Result#,p_result$
Dim p_Result#,263
string p_result#,0 = p_pfad$
PathQuoteSpaces(p_result#)
p_result$ = string$(p_result#,0)
Dispose p_result#
return p_result$
endproc
Alles anzeigen
in Anführungszeichen gesetzt, natürlich nur wenn es für die EXE vorgesehen ist, wie folgt probiert?
Manchmal geht auch chr$(44).
Gruß Thomas
Gibt viele Beispiele, bestimmt auch hier. Ich verwende meist:
' Fensterlage
Def Clienttoscreen(2) !"USER32","ClientToScreen"
Declare C2sstrc#
Def @G21x(0) @Long(C2sstrc#,0)
Def @G21y(0) @Long(C2sstrc#,4)
Proc G_Lage
Parameters Hdl&
Dim C2sstrc#,8
@Clienttoscreen(Hdl&,C2sstrc#)
x%=@G21x()
y%=@G21y()
Dispose C2sstrc#
EndProc
Alles anzeigen
Gruß Thomas
Möglicherweise sind die Formate nicht zulässig. Vielleicht auf eine GIF mit entsprechender Zeitvorgabe für die Betrachtung verwenden. Beispiel:
[Blockierte Grafik: http://s24.postimg.org/wjlpo7a0x/Test_A.jpg]
Gruß Thomas
Volkmar, den Kopf nicht hängen lassen. Geht bei mir unter XP SP2 wie geplant.
Gruß Thomas
Zum Thema Färben gab es auch hier schon einiges, auch von Andreas, wie z.B. dieser Code:
'######################
'Header-Dateien
'######################
$H Windows.ph
$H Messages.ph
'######################
Windowstyle 543
Declare Ende&,Ende1&,Win02&,Farbe$
Farbe$=RGB(135,225,160)
CLS Farbe$
'Der Brush wird von Windows benutzt um den Dialoghintergrund zu zeichnen
Var Dialogpinsel& = ~Createsolidbrush(Farbe$)
Var Button& = CREATE("BUTTON",%hwnd,"Dialog öffnen",10,10,150,25)
WindowTitle "Test..."
Whilenot Ende&
Waitinput
case %Key=2:Ende&=1
If Clicked(Button&)
Ende1& = 0
win02&=CREATE("Dialog",%hwnd,"Dialog",(%MaxX/2-300),(%MaxY/2-250),600,500)
'einmal die Farbe geben
Startpaint win02&
cls Farbe$
Endpaint
'Subclassing einschalten
SubClass win02&,1
Whilenot Ende1&
WAITINPUT
If %Key = 2
Ende1& = 1
endif
Endwhile
DestroyWindow(win02&)
Setfocus(%Hwnd)
Endif
Endwhile
DeleteObject Dialogpinsel&
End
SubClassProc
If SubClassMessage(win02&,~WM_CTLCOLORDLG)
Set("WinProc", 0)
'~WM_CTLCOLORDLG erwartet als Rückgabewert einen Brush für den Hintergrund
Return Dialogpinsel&
EndIf
EndProc
Alles anzeigen
Gruß Thomas
Mal eine Frage zum AVAST, das mir eine Warnmeldung ausgibt mit der ich nichts anfagen kann.
Ursache ist mein Programm, das auf C: liegt und mit:
c:\Dokumente und Einstellungen\User\Startmenü\Programme\Autostart\icopanel-4-x12.exe.lnk
gestartet wird. Es wird von AVAST nicht angemeckert (Screen.png).
Wenn ich jedoch den CCleaner (Screen1.jpg) anwende wird es als nicht vertrauenswürdig eingestuft.
Wo kann ich da Einstellungen oder andere Maßnahmen vornehmen damit die Meldung nicht mehr erscheint. Vielleicht hat ja jemand einen Vorschlag/Rat.
Gruß Thomas
[Blockierte Grafik: http://s22.postimg.org/qwbuilgjx/Screen.jpg]
[Blockierte Grafik: http://s12.postimg.org/peop60e21/Screen1.jpg]
PS: Wenn gewünscht stelle ich bei File-Upload die EXE ein.
Ich bleibe so lange wie möglich bei XP. Der vielleicht erforderliche Hard- und Softwareersatz ist mir das Mehr an Sicherheit von WIN7 nicht Wert umzusteigen.
Wenn man eure Sicherheitstips liest, kann man ohne zusätzlichen Schutz (Beste=kostenpflichtig) WIN 7 auch nicht verwenden.
Wenn ich dann noch drei alte Hauptposten, immer noch ausreichende Software, Photoshop7, Acrobat 5 und den Drucker,
[Blockierte Grafik: http://s7.postimg.org/nfve27wqv/Screen.jpg]
für den es vermutlich keinen Treiber gibt, ersetzen muß, fallen einige hundert EUROS an.
Sollte mir das das Wert sein?
Gruß Thomas
Frank, Danke. Ist nur für den Fall, der aber nicht anzunehmen ist, wenn es nicht über PN geht.
@Jörg, Danke für den Hinweis. Ist nachgebessert.
Im Moment suche ich noch einen Code, der den Menüpunkt zurück gibt, wenn die Maus über dem Button steht.
Einen Älteren hatte ich schon gefunden, aber noch nicht abgearbeitet. XProfan
Gruß Thomas
Hier der bei mir, auf XP ab XProfan X2 laufende aktuelle Code, den ich immer mal wieder erweitere oder anpasse.
Die Größe ist veränderbar, damit auch mehrreihig oder senkrecht ausrichtbar.
Der Text für den Tooltip und eigenes Bild einstellbar.
$H windows.ph
$H messages.ph
$H commctrl.ph
Def w32_ExtractAssociatedIcon(3) !"SHELL32","ExtractAssociatedIconA"
Def DragAcceptFiles(2) !"SHELL32","DragAcceptFiles"
Def DragFinish(1) !"SHELL32","DragFinish"
Def DragQueryFile(4) !"SHELL32","DragQueryFileA"
Declare PF#
Dim PF#,461
Def ShellNotify(2) !"SHELL32","Shell_NotifyIconA"
Def &FO_DELETE $3
Def &FOF_NOCONFIRMATION $10
Def SHFileOperation(1) !"Shell32.DLL","SHFileOperationA"
Declare shfileopstruct#
STRUCT SHFILEOPSTRUCT = hwnd&,wFunc&,pFrom&,pTo&,fFlags&,fAnyOperationsAborted&,hNameMappings&,lpszProgressTitle&
'--------------------- Variablen ----------------------------
Declare NotifyIconData#, Icon&, tIcon$
'--------------------- Struktur -----------------------------
Struct NotifyIconData = cbSize&, \
hWnd&, \
uID&, \
uFlags&, \
uCallBackMessage&, \
hIcon&, \
szTip$(64)
'---------------------------------------------LvSetIcon
declare Lv1#
struct Lv1=Mask&,Item&,SubItem&,State&,StateMask&,Text&,TextMax&,Image&
dim Lv1#,Lv1
proc LvSetIcon
Lv1#.Item&=&(2)
Lv1#.SubItem&=&(3)
Lv1#.Mask&=~LVIF_IMAGE
Lv1#.Image&=%(4)
sendmessage(&(1),~LVM_SETITEM,0,Lv1#)
endproc
Declare Hx%,Hy%,TbX%,TbY%,Tm%,Az%,xx%,yy%,Top%
Declare H&,Dy&,dlg&,IL&,ILLv&,Tb&,Lv&,x&,y&,Q&,Z&,Cu&,DM&,Bk&,Fo&,eN&,eNT&,eI&,eIT&
Declare Sav&,Loe&,Bi&
Declare Prg$,a$,b$,c$,cfg$,Zi$[]
Prg$=GetDir$("@")'$ProgDir'
' für die *.exe bitte $ProgDir nehmen!!!
Fo& = @Create("Font","Arial",16,0,0,0,0)
a$=$AppDataDir
b$="\\icobares"
cfg$=a$+b$+b$+".cfg"
casenot FileExists(a$+b$) : MkDir a$+b$
IfNot FileExists(cfg$)
WRITEINI cfg$,"BAR","N"="0"
WRITEINI cfg$,"BAR","TBX"="1"
EndIf
Hx%=val(ReadIni$(cfg$,"BAR","HX"))
Hy%=val(ReadIni$(cfg$,"BAR","HY"))
Az%=val(ReadIni$(cfg$,"BAR","N"))
TbX%=val(ReadIni$(cfg$,"BAR","TBX"))
Top%=val(ReadIni$(cfg$,"BAR","TOP"))
Windowstyle 1112+4
window 0,0
H&=%hwnd
UseFont "Arial",16,0,0,0,0
SetDialogFont 1
Bk&=Create("Button", H& ,"<",0,0,0,0)
Tm%=0
WindowStyle 32+16+8+4
dlg&=@Create("Window",H&,"Sortieren per Drag&Drop",0,0,700,330)
ShowWindow(dlg&,0)
a$="eigener Name;0;120;eigenes Icon;0;120;Ziel;0;120;Pfad;0;300"
Lv&= Create("GridBox",dlg& ,a$, 0, 16, 0, 660, Height(dlg&)-80)
Setfont Lv&,Fo&
eNT& = Create("Text", dlg& ,"eigener Name",18,Height(dlg&)-60,80,20)
eIT& = Create("Text", dlg& ,"eigenes Icon",18,Height(dlg&)-30,80,20)
eN& = Create("Edit", dlg& ,"",110,Height(dlg&)-60,210,20)
eI& = Create("Edit", dlg& ,"",110,Height(dlg&)-30,210,20)
Sav& = @Create("Button", dlg& ,"Speichern",340,Height(dlg&)-60,80,20)
Loe& = @Create("Button", dlg& ,"Löschen",430,Height(dlg&)-60,80,20)
@Create("Tooltip", %hWnd , Loe& ,"Ausgewählte Verknüpfung löschen")
Bi& = @Create("Button", dlg& ,"Auswählen",340,Height(dlg&)-30,80,20)
@Create("Tooltip", %hWnd , Bi& ,"Eigenes Bild wählen")
WhileLoop Az%
a$=ReadIni$(cfg$,"BAR",str$(&loop))
b$=translate$(substr$(a$,4,"|")+substr$(a$,3,"|"),"\","\\")
Case FileExists(b$) : AddString(Lv&,a$)
Case DirExists(b$) : AddString(Lv&,a$)
EndWhile
Az%=GetCount(Lv&)
BAR
Messagebox("Neue Verknüpfung mit Drag&Drop\n\nSchieben mit gehaltener Maustaste links"+ \
"\n\nMenü = rechte Maustaste","Tip",32)
DragAcceptFiles(H&,1)
UserMessages 16,~WM_DROPFILES
settext Bk&,"<"
While 1
Az%=GetCount(Lv&)
Waitinput
case %UMessage =~WM_DROPFILES:DROP
yy%=%MenuItem
If IsKey(17) | (%MousePressed=1)
UseCursor 5
SendMessage(H&,$112,$F012,0)
UseCursor 0
HX%=%WinLeft
HY%=%WinTop
ElseIf Getfocus(Bk&)
If Tm%=0
Tm%=1
SetWindowPos H&=Hx%,Hy% - 26,(46*TbY%);0
Settext Bk&,">"
Else
BAR
EndIf
setfocus(H&)
ElseIf (%MousePressed=2)
CreateMenu
AppendMenu 106,"immer Top"
Separator
AppendMenu 107,"Minimieren"
Separator
AppendMenu 108,"Bearbeiten"
Separator
AppendMenu 109,"Ende"
CheckMenu 106,abs(Top%)
TrackMenu %MouseX,%MouseY
If MenuItem(106)
SetWindowPos H&=Hx%,Hy% - (TbX%*47)+22,(46*TbY%);-2
If Top%=0
dec Top%
Else
inc Top%
EndIf
SetWindowPos H&=Hx%,Hy% - (TbX%*47)+22,(46*TbY%);Top%
ElseIf @MenuItem(107)
ShowWindow(H&,0)
MINIMIEREN
BAR
EndIf
case MenuItem(108):SORT
case MenuItem(109):BREAK
setfocus(H&)
ElseIf (yy%>2000)
ShellExec(Zi$[yy%-2000],"OPEN",1)
ElseIf %key=4
TbX%=Abs(Round( ((Width(H&)-22)/46),0))
Case Tbx%<1:TbX%=1
BAR
Endif
EndWhile
WRITEINI cfg$,"BAR","N"=str$(Az%)
WRITEINI cfg$,"BAR","TBX"=str$(TbX%)
WRITEINI cfg$,"BAR","HX"=str$(HX%)
WRITEINI cfg$,"BAR","HY"=str$(HY%)
WRITEINI cfg$,"BAR","TOP"=str$(TOP%)
WhileLoop Az%
WRITEINI cfg$,"BAR",Str$(&loop)=GetString$(Lv&,&loop-1)
Endwhile
DeleteObject IL&
DeleteObject ILLv&
DeleteObject Fo&
Dispose PF#
Dispose shfileopstruct#
Dispose Lv1#
End
Proc DROP
Declare Bild&,shfi#
x&=&WParam
DragQueryFile(x&,$FFFFFFFF,PF#,461);
DragQueryFile(x&,0,PF#,261)
a$=String$(PF#,0)
DragFinish(x&)
Case substr$(upper$(a$),-1,".")="LNK": a$=Link(a$)
b$=substr$(a$,-1,"\")
c$=Translate$(a$,b$,"")
AddString(Lv&,b$+"| |"+b$+"|"+c$)
inc Az%
BAR
EndProc
Proc BAR
Tm%=0
Settext Bk&,"<"
Declare xy!
DeleteObject IL&
DeleteObject ILLv&
DestroyWindow(Tb&)
DestroyWindow(Dy&)
TbY%=0
WhileLoop 1,Az%,TbX%
inc TbY%
EndWhile
case Tby%=0 : TbY%=1
Clear Zi$[]
IL&=Create("ImageList", 32, 32)
ILLv&=Create("ImageList", 24, 24)
sendmessage(Lv&,~LVM_SETIMAGELIST,~LVSIL_SMALL,ILLv&)
SetWindowPos H&=Hx%,Hy% - (TbX%*47)+22,(46*TbY%);-2
SetWindowPos Bk&=0,0 - 20,Height(H&)
Dy&=Control("DIALOG","",$54000000,22,0,Width(H&),Height(H&),H&,0,%hinstance)
Tb&=Create("TOOLBAR", Dy&, IL&, 0, 32, 2000, 1)
xx%=1
Declare x#
Dim x#,255
WhileLoop Az%
Zi$[&loop]=trim$(GetText$(Lv&,&loop-1,3))+trim$(GetText$(Lv&,&loop-1,2))
' eigenes Icon und noch vorhanden?
yy%=0
If FileExists($AppDataDir+"\\icobar\\"+GetText$(Lv&,&loop-1, 1))
yy%=1
If substr$(GetText$(Lv&,&loop-1, 1),-1,"ico")
x&=Create("hIcon",$AppDataDir+"\\icobar\\"+GetText$(Lv&,&loop-1, 1))
ImageList("AddIcon", IL&,x&)
ImageList("AddIcon", ILLv&,x&)
Else
x&=Create("hsizedPic",-1,$AppDataDir+"\\icobar\\"+GetText$(Lv&,&loop-1, 1),32,32,0)
ImageList("Add", IL&,x&)
x&=Create("hsizedPic",-1,$AppDataDir+"\\icobar\\"+GetText$(Lv&,&loop-1, 1),24,24,0)
ImageList("Add", ILLv&,x&)
EndIf
EndIf
If yy%=0
If upper$(substr$(GetText$(Lv&,&loop-1, 2),-1,"."))<>"EXE"
String x#,0=Zi$[&loop]
y&=1
x&=w32_ExtractAssociatedIcon(%hinstance,x#,Addr(y&))
Else
x&=Create("hIcon",Zi$[&loop],0)
EndIf
ImageList("AddIcon", IL&,x&)
ImageList("AddIcon", ILLv&,x&)
EndIf
Toolbar("AddButton",Tb&,&loop-1,2000+xx%,GetText$(Lv&,&loop-1, 0))
Toolbar("Separator",Tb&)
LvSetIcon(Lv&,&loop-1,0,&loop-1)
inc xx%
EndWhile
Dispose x#
SetWindowPos H&=Hx%,Hy% - (TbX%*47)+22,(46*TbY%);val(Top%)
EndProc
Proc LINK
Parameters Pa$
Declare Po&,Si&
Assign #15,Pa$
Openrw #15
Si&=GetFileSize(#15)+256
Declare x#
Dim x#,Si&
BlockRead(#15,x#,0,Si&)
Closerw #15
Po&=MemPos(x#,MemPos(x#,0,":\\")+1,":\\") + MemPos(x#,0,":\\")
Pa$=String$(x#,Po&)
Dispose x#
Return Pa$
EndProc
Proc SORT
subclass H&,1
subclass Dlg&,1
ShowWindow(dlg&,1)
declare a#, BiFile$,bmp&
struct HIT=x&,y&,Flags&,Item&,SubItem&
dim a#,HIT
WhileNot %umessage=16
Waitinput
xx%=GetCurSel(Lv&)
If %key=4
SetWindowPos Lv&=16, 0 - Width(dlg&)-40,Height(dlg&)-70;0
SetWindowPos eNT& = 18,(Height(dlg&)-60)
SetWindowPos eIT& = 18,(Height(dlg&)-30)
SetWindowPos eN& = 110,(Height(dlg&)-60)
SetWindowPos eI& = 110,(Height(dlg&)-30)
SetWindowPos Bi& = 340,(Height(dlg&)-30)
SetWindowPos Sav& = 340,(Height(dlg&)-60)
SetWindowPos Loe& = 430,(Height(dlg&)-60)
setfocus(Lv&)
EndIf
while getfocus(eN&)
Waitinput
wend
If getfocus(Sav&) AND (xx% > -1)
case trim$(gettext$(eN&))="" : SetText eN&, gettext$(Lv&,xx%,2)
SetText Lv&, xx%, 0, gettext$(eN&)
SetText Lv&, xx%, 1, gettext$(eI&)
ElseIf getfocus(Loe&) AND (xx% > -1)
DeleteString(Lv&,xx%)
dec Az%
~InvalidateRect(Lv&, 0, 0)
~UpdateWindow(Lv&)
setcursel Lv&,0
ElseIf getfocus(Lv&)
If xx% > -1
settext eN&,gettext$(Lv&,GetCurSel(Lv&),0)
settext eI&,gettext$(Lv&,GetCurSel(Lv&),1)
Else
settext eN&,""
settext eI&,""
EndIf
ElseIf getfocus(Bi&)
chdir "C:\"
BiFile$=LoadFile$(dlg&, "ÖFFNE","Bilder|*.bmp;*.png;*.jpg;*.ico")
chdir Prg$
If (Trim$(BiFile$)<>"")
If upper$(substr$(BiFile$,-1,"."))="ICO"
CaseNot FileExists($AppDataDir+"\\icobar\\"+substr$(BiFile$,-1,"\")): \
Copy BiFile$ > $AppDataDir+"\\icobar\\"+substr$(BiFile$,-1,"\")
settext eI&,substr$(BiFile$,-1,"\")
Else
bmp&=Create("hsizedPic",-1,BiFile$,32,32,0)
CaseNot FileExists($AppDataDir+"\\icobar\\"+substr$(BiFile$,-1,"\")): \
SavePic $AppDataDir+"\\icobar\\"+substr$(BiFile$,-1,"\"),bmp&
settext eI&,substr$(BiFile$,-1,"\")
EndIf
EndIf
setfocus(Lv&)
EndIf
EndWhile
subclass Dlg&,0
subclass H&,0
ShowWindow(dlg&,0)
BAR
EndProc
proc LvDragDrop
parameters Quelle&
declare Ziel&,Text$
long a#,0=~LVIR_SELECTBOUNDS
var DragIco&=sendmessage(Lv&,~LVM_CREATEDRAGIMAGE,Quelle&,a#)
~ClientToScreen(Lv&,a#)
var xa%=long(a#,0)
var ya%=long(a#,4)
~GetCursorPos(a#)
var xb%=long(a#,0)
var yb%=long(a#,4)
~ImageList_BeginDrag(DragIco&,0,xb%-xa%,yb%-ya%)
~ImageList_DragEnter(0,0,0)
~ImageList_DragMove(xb%,yb%)
~SetCapture(Lv&)
while 1
getmessage
case %message=~WM_LBUTTONUP:break'--Maustaste wurde losgelassen
~GetCursorPos(a#)
xb%=long(a#,0)
yb%=long(a#,4)
~ImageList_DragMove(xb%,yb%)
~ScreenToClient(Lv&,a#)
Ziel&=sendmessage(Lv&,~LVM_HITTEST,0,a#)
case a#.Flags&=~LVHT_ABOVE:sendmessage(Lv&,~WM_VSCROLL,0,0)
case a#.Flags&=~LVHT_BELOW:sendmessage(Lv&,~WM_VSCROLL,1,0)
endwhile
~ImageList_EndDrag()
~ReleaseCapture()
if Ziel&>-1
Text$=getstring$(Lv&,Quelle&)
LvSetIcon(Lv&,Quelle&,0,99)
deletestring(Lv&,Quelle&)
case Quelle&>Ziel&:Ziel&=Ziel&+1
insertstring(Lv&,Ziel&,Text$)
LvSetIcon(Lv&,Ziel&,0,Quelle&)
BAR
~InvalidateRect(Lv&, 0, 0)
~UpdateWindow(Lv&)
setcursel Lv&,Ziel&
else
setcursel Lv&,Quelle&
endif
endproc
Proc MINIMIEREN
Declare tIcon&, on%
tIcon& = Create("hIcon", "Stein" )
Dim NotifyIconData#, NotifyIconData
With NotifyIconData#
.cbSize& = @SizeOf(NotifyIconData#)
.hWnd& = H&
.uID& = 80
.uFlags& = $7
.uCallBackMessage& = $1100
.hIcon& = tIcon&
.szTip$ = "icobar"
EndWith
on% = ShellNotify($0,NotifyIconData#)
Dispose NotifyIconData#
UserMessages $1100
While 1
WaitInput
If %UMessage
If &UlParam = 513 '$0203: wm_LButtonDblClk
BREAK
EndIf
EndIf
EndWhile
UserMessages -$1100
Case on% <> 0 : IconOff
DeleteObject tIcon&
EndProc
Proc IconOff
Dim NotifyIconData#, NotifyIconData
With NotifyIconData#
.cbSize& = @SizeOf(NotifyIconData#)
.hWnd& = H&
.uID& = 80
.uFlags& = $0
EndWith
ShellNotify($2,NotifyIconData#)
Dispose NotifyIconData#
on% = 0
EndProc
subclassproc
if subclassmessage(H&,~WM_KEYDOWN)
if (&swparam>32)*((&swparam<41))
setfocus(Lv&)
sendkey(Lv&,&swparam)
endif
elseif subclassmessage(Dlg&,~WM_NOTIFY)
if long(&slparam,0)=Lv&
if long(&slparam,8)=~LVN_BEGINDRAG
LvDragDrop(long(&slparam,12))
elseif long(&slparam,8)=~LVN_ITEMCHANGED
endif
endif
endif
endproc
Alles anzeigen
Gruß Thomas
PS: wenn eine EXE gewünscht wird bitte per PN melden, oder Frank ist so gut und hängt sie hier an.
Menü bei Rechtsklick mußte ich behalten. Alte Gewohnheit.:-)
$H windows.ph
$H messages.ph
$H commctrl.ph
Def w32_ExtractAssociatedIcon(3) !"SHELL32","ExtractAssociatedIconA"
Def DragAcceptFiles(2) !"SHELL32","DragAcceptFiles"
Def DragFinish(1) !"SHELL32","DragFinish"
Def DragQueryFile(4) !"SHELL32","DragQueryFileA"
Declare PF#
Dim PF#,461
Declare Integer Hx,Hy,Az,xx,yy
Declare LONG H,Dy,dlg,IL,Tb,Lv,x,y,Q,Z,Cu,DM,Bk
Declare STRING a,b,c,cfg,Zi[]
a=$AppDataDir
b="\\icobar"
cfg=a+b+b+".cfg"
casenot FileExists(a+b) : MkDir a+b
casenot FileExists(cfg):WRITEINI cfg,"BAR","N"="0"
Hx=0
Hy=0
Az=val(ReadIni$(cfg,"BAR","N"))
Windowstyle 1112
window 0,0
H=%hwnd
UseFont "Arial",16,0,0,0,0
SetDialogFont 1
Bk=Create("Button", H ,">",0,0,20,38)
Create("Tooltip",H,Bk,"Menü")
dlg=@Create("Dialog",H,"Sort per Drag",0,0,700,300)
ShowWindow(dlg,0)
Lv=Create("ListBox",dlg,0,16,0,660,260)
WhileLoop Az
Zi[&loop]=ReadIni$(cfg,"BAR",str$(&loop))
Case FileExists(Zi[&loop]):AddString(Lv,Zi[&loop])
EndWhile
BAR
Messagebox("Zufügen mit Drag&Drop\n\nSchieben mit Strg+Maus","Tip",32)
DragAcceptFiles(H,1)
UserMessages 16,~WM_DROPFILES
While 1
Az=GetCount(Lv)
Waitinput
case %UMessage =~WM_DROPFILES:DROP
yy=%MenuItem
If IsKey(17) | (%MousePressed=1)
UseCursor 5
SendMessage(H,$112,$F012,0)
UseCursor 0
HX=%WinLeft
HY=%WinTop
ElseIf Getfocus(Bk) | (%MousePressed=2)
CreateMenu
SubPopUp "Löschen"
xx=201
WhileLoop Az
AppendMenu xx, GetString$(Lv,&loop-1)
inc xx
EndWhile
EndSub
AppendMenu 108,"Sortieren"
AppendMenu 107,"min"
AppendMenu 106,"max"
Separator
AppendMenu 109,"Ende"
TrackMenu %MouseX,%MouseY
yy=%MenuItem
If yy>200
DeleteString(Lv,yy-201)
dec Az
BAR
EndIf
case MenuItem(106):SetWindowPos H=Hx,Hy -(Az*47)+22,38;0
case MenuItem(107):SetWindowPos H=Hx,Hy - 21,38;0
case MenuItem(108):SORT
case MenuItem(109):BREAK
ElseIf (yy>2000)
ShellExec(Zi[yy-2000],"OPEN",1)
Endif
EndWhile
Dispose PF#
WRITEINI cfg,"BAR","N"=str$(Az)
WhileLoop Az
WRITEINI cfg,"BAR",Str$(&loop)=GetString$(Lv,&loop-1)
Endwhile
DeleteObject IL
End
Proc DROP
Declare Bild&,shfi#
x=&WParam
DragQueryFile(x,$FFFFFFFF,PF#,461);
DragQueryFile(x,0,PF#,261)
a=String$(PF#,0)
DragFinish(x)
Case substr$(upper$(a),-1,".")="LNK": a=Link(a)
AddString(Lv,a)
inc Az
BAR
EndProc
Proc BAR
DeleteObject IL
DestroyWindow(Tb)
DestroyWindow(Dy)
Clear Zi[]
IL=Create("ImageList", 32, 32)
SetWindowPos H=Hx,Hy - (Az*47)+22,38;0
Dy=Control("DIALOG","",$54000000,22,0,Width(H),38,H,0,%hinstance)
Tb=Create("TOOLBAR", Dy, IL, 0, 32, 2000, 1)
xx=1
Declare x#
Dim x#,255
WhileLoop Az
Zi[&loop]=GetString$(Lv,&loop-1)
If substr$(upper$(Zi[&loop]),-1,".")<>"EXE"
String x#,0=Zi[&loop]
y=1
x=w32_ExtractAssociatedIcon(%hinstance,x#,Addr(y))
Else
x=Create("hIcon",Zi[&loop],0)
EndIf
ImageList("AddIcon", IL,x)
Toolbar("AddButton",Tb,&loop-1,2000+xx,substr$(Zi[&loop],-1,"\"))
Toolbar("Separator",Tb)
inc xx
EndWhile
Dispose x#
EndProc
Proc LINK
Parameters Pa$
Declare Po&,Si&
Assign #15,Pa$
Openrw #15
Si&=GetFileSize(#15)+256
Declare x#
Dim x#,Si&
BlockRead(#15,x#,0,Si&)
Closerw #15
Po&=MemPos(x#,MemPos(x#,0,":\\")+1,":\\") + MemPos(x#,0,":\\")
Pa$=String$(x#,Po&)
Dispose x#
Return Pa$
EndProc
Proc SORT
subclass Dlg,1
subclass H,1
ShowWindow(dlg,1)
Cu=~LoadCursorA(~GetModuleHandle("Shell32"),1003)
DM=~RegisterWindowMessage("commctrl_DragListMsg")
~MakeDragList(Lv)
WhileNot %umessage=16
waitinput
endwhile
subclass Dlg,0
subclass H,0
ShowWindow(dlg,0)
BAR
EndProc
subclassproc
if subclassmessage(H,~WM_KEYDOWN)
x=&swparam
if (x>32)*((x<41))
setfocus(Lv)
sendkey(Lv,x)
endif
elseif subclassmessage(Dlg,DM)
Z=~LBItemFromPt(Lv,long(&slparam,8),long(&slparam,12),1)
if long(&slparam,0)=~DL_BEGINDRAG
Q=Z
set("winproc",0)
return 1
elseif long(&slparam,0)=~DL_DRAGGING
~SetCursor(Cu)
~DrawInsert(Dlg,Lv,Z+1)
elseif long(&slparam,0)=~DL_DROPPED
if Z>-1
a=getstring$(Lv,Q)
deletestring(Lv,Q)
case Q>Z:Z=Z+1
insertstring(Lv,Z,a)
setcursel Lv,Z
endif
~DrawInsert(Dlg,Lv,-1)
endif
elseif subclassmessage(Dlg,~WM_COMMAND)
endif
endproc
Alles anzeigen
Gruß Thomas
Kleine Anpassung im Menü vorgenommen.
[Blockierte Grafik: http://s21.postimg.org/ac9w35rk3/Screen.jpg]
$H windows.ph
$H messages.ph
$H commctrl.ph
Def w32_ExtractAssociatedIcon(3) !"SHELL32","ExtractAssociatedIconA"
Def DragAcceptFiles(2) !"SHELL32","DragAcceptFiles"
Def DragFinish(1) !"SHELL32","DragFinish"
Def DragQueryFile(4) !"SHELL32","DragQueryFileA"
Declare PF#
Dim PF#,461
Declare Integer Hx,Hy,Az,xx,yy
Declare LONG H,Dy,dlg,IL,Tb,Lv,x,y,Q,Z,Cu,DM,Bk
Declare STRING a,b,c,cfg,Zi[]
a=$AppDataDir
b="\\icobar"
cfg=a+b+b+".cfg"
casenot FileExists(a+b) : MkDir a+b
casenot FileExists(cfg):WRITEINI cfg,"BAR","N"="0"
Hx=0
Hy=0
Az=int(val(ReadIni$(cfg,"BAR","N")))
Windowstyle 1112
window 0,0
H=%hwnd
UseFont "Arial",16,0,0,0,0
SetDialogFont 1
Bk=Create("Button", H ,"M",0,0,20,38)
Create("Tooltip",H,Bk,"Menü")
dlg=@Create("Dialog",H," ",0,0,700,300)
ShowWindow(dlg,0)
Lv=Create("ListBox",dlg,0,16,0,660,260)
WhileLoop Az
Zi[&loop]=ReadIni$(cfg,"BAR",str$(&loop))
Case FileExists(Zi[&loop]):AddString(Lv,Zi[&loop])
EndWhile
BAR
Messagebox("Zufügen mit Drag&Drop\n\nSchieben mit Strg+Maus","Tip",32)
DragAcceptFiles(H,1)
UserMessages 16,~WM_DROPFILES
While 1
Az=GetCount(Lv)
Waitinput
case %UMessage =~WM_DROPFILES:DROP
yy=%MenuItem
If IsKey(17) AND (%MousePressed=1)
UseCursor 5
SendMessage(H,$112,$F012,0)
UseCursor 0
HX=%WinLeft
HY=%WinTop
ElseIf Getfocus(Bk)
CreateMenu
SubPopUp "Löschen"
xx=201
WhileLoop Az
AppendMenu xx, GetString$(Lv,&loop-1)
inc xx
EndWhile
EndSub
AppendMenu 108,"Sortieren"
AppendMenu 107,"min"
AppendMenu 106,"max"
Separator
AppendMenu 109,"Ende"
TrackMenu %MouseX,%MouseY
yy=%MenuItem
If yy>200
DeleteString(Lv,yy-201)
dec Az
BAR
EndIf
case MenuItem(106):SetWindowPos H=Hx,Hy -(Az*47)+22,38;0
case MenuItem(107):SetWindowPos H=Hx,Hy - 21,38;0
case MenuItem(108):SORT
case MenuItem(109):BREAK
ElseIf (yy>2000)
ShellExec(Zi[yy-2000],"OPEN",1)
Endif
EndWhile
Dispose PF#
WRITEINI cfg,"BAR","N"=str$(Az)
WhileLoop Az
WRITEINI cfg,"BAR",Str$(&loop)=GetString$(Lv,&loop-1)
Endwhile
DeleteObject IL
End
Proc DROP
Declare Bild&,shfi#
x=&WParam
DragQueryFile(x,$FFFFFFFF,PF#,461);
DragQueryFile(x,0,PF#,261)
a=String$(PF#,0)
DragFinish(x)
Case substr$(upper$(a),-1,".")="LNK": a=Link(a)
AddString(Lv,a)
inc Az
BAR
EndProc
Proc BAR
DeleteObject IL
DestroyWindow(Tb)
DestroyWindow(Dy)
Clear Zi[]
IL=Create("ImageList", 32, 32)
SetWindowPos H=Hx,Hy - (Az*47)+22,38;0
Dy=Control("DIALOG","",$54000000,22,0,Width(H),38,H,0,%hinstance)
Tb=Create("TOOLBAR", Dy, IL, 0, 32, 2000, 1)
xx=1
Declare x#
Dim x#,255
WhileLoop Az
Zi[&loop]=GetString$(Lv,&loop-1)
If substr$(upper$(Zi[&loop]),-1,".")<>"EXE"
String x#,0=Zi[&loop]
y=1
x=w32_ExtractAssociatedIcon(%hinstance,x#,Addr(y))
Else
x=Create("hIcon",Zi[&loop],0)
EndIf
ImageList("AddIcon", IL,x)
Toolbar("AddButton",Tb,&loop-1,2000+xx,substr$(Zi[&loop],-1,"\"))
Toolbar("Separator",Tb)
inc xx
EndWhile
Dispose x#
EndProc
Proc LINK
Parameters Pa$
Declare Po&,Si&
Assign #15,Pa$
Openrw #15
Si&=GetFileSize(#15)+256
Declare x#
Dim x#,Si&
BlockRead(#15,x#,0,Si&)
Closerw #15
Po&=MemPos(x#,MemPos(x#,0,":\\") + 1,":\\") + MemPos(x#,0,":\\")
Pa$=String$(x#,Po&)
Dispose x#
Return Pa$
EndProc
Proc SORT
subclass Dlg,1
subclass H,1
ShowWindow(dlg,1)
Cu=~LoadCursorA(~GetModuleHandle("Shell32"),1003)
DM=~RegisterWindowMessage("commctrl_DragListMsg")
~MakeDragList(Lv)
WhileNot %umessage=16
waitinput
endwhile
subclass Dlg,0
subclass H,0
ShowWindow(dlg,0)
BAR
EndProc
subclassproc
if subclassmessage(H,~WM_KEYDOWN)
if (&swparam>32)*((&swparam<41))
setfocus(Lv)
sendkey(Lv,&swparam)
endif
elseif subclassmessage(Dlg,DM)
Z=~LBItemFromPt(Lv,long(&slparam,8),long(&slparam,12),1)
if long(&slparam,0)=~DL_BEGINDRAG
Q=Z
set("winproc",0)
return 1
elseif long(&slparam,0)=~DL_DRAGGING
~SetCursor(Cu)
~DrawInsert(Dlg,Lv,Z+1)
elseif long(&slparam,0)=~DL_DROPPED
if Z>-1
a=getstring$(Lv,Q)
deletestring(Lv,Q)
case Q>Z:Z=Z+1
insertstring(Lv,Z,a)
setcursel Lv,Z
endif
~DrawInsert(Dlg,Lv,-1)
endif
elseif subclassmessage(Dlg,~WM_COMMAND)
endif
endproc
Alles anzeigen
Gruß Thomas
Wenn es zulässig ist, dass über die Spaltenbutton das LV sortiert werden darf, kannst du dir ja die Spalte merken und dann bei der Suche in Spalte verwenden.
Gruß Thomas
Das kann man doch in einem Abwasch machen:
y%=4 -> Spalte
SortManual(listview&,y%,1)
dann bei der Eingabe:
SearchText(listview&,y&,GetLines(listview&),y%,addr(text$),2+4,addr(x&))
Gruß Thomas
Ich war falsch davor. Natürlich SearchText(H,SZ,EZ,SS,S,F,V) nehmen.
Flags :
2 = Der Suchtext wird ausschließlich nur in Spalte SS gesucht (Textsuche für nur eine
Spalte)
4 = Der Suchtext muß am Anfangs eines Worts stehen, damit er gefunden wird.
Also 2+4
SS ist die indizierte Spalte.
Gruß Thomas