;########################## ;WindowsDialoge ;########################## ;Andreas Miethe * Juni 2002 ;########################## Global HInstance.l Procedure IsNT() os.OSVERSIONINFO os\dwOSVersionInfoSize = SizeOf(OSVERSIONINFO) GetVersionEx_(@os) If os\dwPlatformId = #VER_PLATFORM_WIN32_NT Retval = 1 Else Retval = 0 EndIf ProcedureReturn Retval EndProcedure Procedure PickIconEx(x.l,y.l) Library = OpenLibrary(0,"shell32") Funktion = GetProcAddress_(Library,62);Funktionsadresse ermitteln Buffer$ = Space(128) GetSystemDirectory_(@Buffer$,128);Systemordner ermitteln IconFile$ = Buffer$+"\shell32.dll";IconFile anhaengen IconIndex = -1 ;wenn NT If IsNT() ; Unter NT WideStrings benutzen FileLen = Len(Iconfile$) BufferLen = Len(IconFile$) * 2 *Pointer = AllocateMemory(256) CopyMemoryString(IconFile$,@*Pointer);Filename in Memory MultiByteToWideChar_(1,1,@IconFile$,FileLen,*Pointer,BufferLen) CallFunctionFast(Funktion,WindowID(0),*Pointer,@MaxFile,@IconIndex) WideCharToMultiByte_(0,0,*Pointer,BufferLen,@IconFile$,FileLen,0,0) Else CallFunctionFast(Funktion,Dummy,IconFile$,@MaxFile,@IconIndex) EndIf ;Icon ins Fenster zeichnen Icon = ExtractIcon_(HInstance,IconFile$,IconIndex) StartDrawing(WindowOutput(0)) DrawIcon_(GetDC_(WindowID(0)),x,y,Icon) StopDrawing() FreeMemory(*Pointer) DestroyWindow_(Dummy) EndProcedure Procedure Runfile() Library = OpenLibrary(0,"Shell32.dll") Funktion = GetProcAddress_(Library,61) Icon = ExtractIcon_(HInstance,"Windlg.exe",0) Dummy = OpenWindow(1, 0, GetSystemMetrics_(#SM_CYSCREEN), 0, 0, "",#PB_Window_Invisible) CallFunctionFast(Funktion,dummy,Icon,0,0,0,0) CloseLibrary(0) DestroyWindow_(Dummy) EndProcedure HWND = OpenWindow(0, 10, 10, 640, 480,"PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget) If HWND HInstance = GetModuleHandle_(0) If CreateGadgetList(WindowID(0)) ButtonGadget(1001, 10,140, 80,24,"PickIcon") ButtonGadget(1004, 10,170, 80,24,"RunFile") EndIf Repeat EventID.l = WaitWindowEvent() If EventID = #PB_Event_Gadget If EventGadget() = 1001 PickIconEx(10,40) ElseIf EventGadget() = 1004 RunFile() EndIf ElseIf EventID = #PB_Event_CloseWindow Quit = 1 EndIf Until Quit =1 EndIf End ; IDE Options = PureBasic v4.01 (Windows - x86) ; CursorPosition = 75 ; FirstLine = 47 ; Folding = - ; UseIcon = K:\Pure-Basic\NOTE03.ICO ; Executable = K:\Pure-Basic\Windlg.exe ; DisableDebugger