GetOpenFileName
Übersicht

![]() |
LunatixBetreff: GetOpenFileName |
![]() Antworten mit Zitat ![]() |
---|---|---|
Eine funktion um einen Browser zu öffnen ![]() Die Endungen müssen im Format "Datei Type~0*.ext;*.ext2~0Datei Type 2~0*.ext~0~0" angegeben werden. Am Ende muss immer ein doppeltes "~0~0" stehen. Code: [AUSKLAPPEN] SuperStrict
Framework brl.system Import brl.basic Extern "win32" Function getopenfilename:Int(lpofn:Byte Ptr) = "GetOpenFileNameA@4" End Extern Const OFN_ALLOWMULTISELECT :Int = 512 Const OFN_CREATEPROMPT :Int = $2000 Const OFN_ENABLEHOOK :Int = 32 Const OFN_ENABLESIZING :Int = $800000 Const OFN_ENABLETEMPLATE :Int = 64 Const OFN_ENABLETEMPLATEHANDLE :Int = 128 Const OFN_EXPLORER :Int = $80000 Const OFN_EXTENSIONDIFFERENT :Int = $400 Const OFN_FILEMUSTEXIST :Int = $1000 Const OFN_HIDEREADONLY :Int = 4 Const OFN_LONGNAMES :Int = $200000 Const OFN_NOCHANGEDIR :Int = 8 Const OFN_NODEREFERENCELINKS :Int = $100000 Const OFN_NOLONGNAMES :Int = $40000 Const OFN_NONETWORKBUTTON :Int = $20000 Const OFN_NOREADONLYRETURN :Int = $8000 Const OFN_NOTESTFILECREATE :Int = $10000 Const OFN_NOVALIDATE :Int = 256 Const OFN_OVERWRITEPROMPT :Int = 2 Const OFN_PATHMUSTEXIST :Int = $800 Const OFN_READONLY :Int = 1 Const OFN_SHAREAWARE :Int = $4000 Const OFN_SHOWHELP :Int = 16 Const OFN_SHAREFALLTHROUGH :Int = 2 Const OFN_SHARENOWARN :Int = 1 Const OFN_SHAREWARN :Int = 0 Type OPENFILENAME Field lStructSize:Int Field hWndOwner:Int Field hInstance:Int Field lpStrFilter:Byte Ptr Field lpStrCustomfilter:Byte Ptr Field nMaxCustFilter:Int Field nFilterIndex:Int Field lpstrFile:Byte Ptr Field nMaxFile:Int Field lpstrFileTitle:Byte Ptr Field nMaxFileTitle:Int Field lpstrInitialDir:Byte Ptr Field lpstrTitle:Byte Ptr Field flags:Int Field nFileOffset:Int Field nFileExtension:Int Field lpstrDefExt:Byte Ptr Field lCustData:Int Field lpfnHook:Byte Ptr Field lpTemplateName:Byte Ptr End Type getopenfile("Test","D:\Dokumente und Einstellungen\Junkprogger\Desktop","All Files~0*.*~0~0",OFN_ALLOWMULTISELECT|OFN_LONGNAMES|OFN_EXPLORER) For local i:int = 0 until array.length Print array[i] Next Function getOpenFile:String[](lpstrTitle:String,lpstrInitialDir:String,lpstrFilter:String,flags:Int=0) Local lpofn:OPENFILENAME = New OPENFILENAME lpofn.lStructSize = 76 lpofn.hWndOwner = 0 lpofn.hInstance = 0 lpofn.lpstrFilter = lpstrFilter.toCString() lpofn.lpstrCustomFilter = Null lpofn.nMaxCustFilter = 0 lpofn.nFilterIndex = 0 lpofn.lpstrFile = New Byte[4096] lpofn.nMaxFile = 4096 lpofn.lpstrFileTitle = New Byte[4096] lpofn.nMaxFileTitle = 4096 lpofn.lpstrInitialDir = (lpstrInitialDir+"~0").toCString() lpofn.lpstrTitle = lpstrTitle.toCString() lpofn.flags = flags lpofn.nFileOffset = 0 lpofn.nFileExtension = 0 lpofn.lpstrDefExt = Null lpofn.lCustData = 0 lpofn.lpfnHook = Null lpofn.lpTemplateName = "~0".toCString() getopenfilename(lpofn) Local count:Int,array:String[],pos:Int For Local i:Int = 0 Until 4096 If lpofn.lpstrFile[i] = 0 If i<4095 If lpofn.lpstrFile[i+1] = 0 Exit Else count:+1 EndIf EndIf EndIf Next array = New String[count+1] For Local i:Int = 0 Until 4096 If lpofn.lpstrFile[i] = 0 If i<4095 If lpofn.lpstrFile[i+1] = 0 Exit Else pos:+1 EndIf EndIf Else array[pos]:+Chr(lpofn.lpstrFile[i]) EndIf Next lpofn.lpstrFile=Null lpofn.lpstrFileTitle=Null MemFree lpofn.lpstrFilter MemFree lpofn.lpstrInitialDir MemFree lpofn.lpstrTitle MemFree lpofn.lpTemplateName lpofn = Null Return array End Function |
||
[size=9]Pro|gram|mier|er: Ein Organismus, der Koffein in Software umwandelt.
Geben Sie eine beliebige 11-stellige Primzahl ein, um fortzusetzen... |
![]() |
BtbN |
![]() Antworten mit Zitat ![]() |
---|---|---|
RequestFile? | ||
![]() |
BlitzcoderNewsposter |
![]() Antworten mit Zitat ![]() |
---|---|---|
Habs jetzt nicht getestet, aber es kann sein, dass Requestfile nur mit der MaxGUI geht. Kann aber auch in einem anderen Modul sein | ||
P4 3 Ghz@3,55Ghz|GF 6600GT 256MB|Samsung 80GB | 2x Samsung 160GB|2048MB DDR-400 RAM|6 Mbit Flatrate | Logitech G15 | Samsung 225BW-TFT | Ubuntu Gutsy Linux | Windows Vista | Desktop | Blog | CollIDE | Worklog
________________ |°°°°°°°°°°°°°°||'""|""\__,_ |______________ ||__ |__|__ |) |(@) |(@)"""**|(@)(@)****|(@) |
![]() |
FOODy |
![]() Antworten mit Zitat ![]() |
---|---|---|
@RequestFile:
Ist im BRL.System Module. @Requester: Jo ganz nett mit der Mehrfachauswahl. Gruß, FOODy |
||
BlitzMax + MaxGUI, 64-bit Arch Linux: Intel Core² E8500 | 8 GB Ram | GeForce GTX 460 · 1024 MB |
![]() |
Lunatix |
![]() Antworten mit Zitat ![]() |
---|---|---|
1. Requestfile ist in brl.system
2. Requestfile ist standard müll, ist wie ich finde nicht zu gebrauchen, da es keine flaghs annimmt 3. Mein "GetOpenFile" lässt sich einstellen und gibt auch mehrere Dateien zurück. alle OFN_XXX flags lassen sich einsetzen. Man kann sich kurze namen (TEST~1.txt) oder lange (test 1.txt) namen zurückgeben lassen. Es ist einfach ein stück Code was sicher viele Anfänger/Benutzer mit wenig/garkeiner WinApi erfahrung gut gebrauchen können. |
||
[size=9]Pro|gram|mier|er: Ein Organismus, der Koffein in Software umwandelt.
Geben Sie eine beliebige 11-stellige Primzahl ein, um fortzusetzen... |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group