B3D-Fenster in B+ integrieren
Übersicht BlitzBasic FAQ und Tutorials
TheProgrammerBetreff: B3D-Fenster in B+ integrieren |
Fr, Aug 22, 2008 16:52 Antworten mit Zitat |
|
---|---|---|
Hi,
da ich ständig gefragt werde, wie man das B3D-Fenster in ein BlitzPlus-Fenster integrieren kann habe ich mich dazu entschlossen, einen Thread darüber in das Codearchiv zu posten. Also zuerst benötigt man folgende Userlibs: In BlitzPlus user32.decls Code: [AUSKLAPPEN] .lib "user32.dll"
dll_GetActiveWindow%() dll_FindWindow%(class$, fenster$):"FindWindowA" dll_SetParent%(hWndChild,hWndNewParent) dll_GetSystemMetrics% (nIndex%) : "GetSystemMetrics" dll_SetWindowPos% (hwnd%, hWndInsertAfter%, x%, y%, cx%, cy%, wFlags%) : "SetWindowPos" In Blitz3D user32.decls Code: [AUSKLAPPEN] .lib "user32.dll"
dll_GetSystemMetrics% (nIndex%) : "GetSystemMetrics" dll_SetWindowRgn% (hWnd%, hRgn%, bRedraw%) : "SetWindowRgn" gdi32.decls Code: [AUSKLAPPEN] .lib "gdi32.dll"
dll_CreateRectRgn% (X1%, Y1%, X2%, Y2%) : "CreateRectRgn" dll_DeleteObject% (hObject%) : "DeleteObject" Eine "bplus_functions.bb", die in BPlus inkludiert werden muss, sieht folgendermaßen aus: Code: [AUSKLAPPEN] Function Window_SetPos(hwnd, x%, y%)
Local xoff% = dll_GetSystemMetrics(7) Local yoff% = dll_GetSystemMetrics(8) + dll_GetSystemMetrics(4) dll_SetWindowPos(hwnd,0,x-xoff,y-yoff,0,0,5) End Function Function Prepare(posx%,posy%) MainHwnd = dll_GetActiveWindow() ExecFile(B3D_WINDOW$) tmp=MilliSecs() Repeat Until MilliSecs()-tmp > 500 Repeat vwprt = dll_FindWindow("Blitz Runtime Class",TITLE_B3D$) If WaitEvent(1) = $803 Then End Until vwprt <> 0 dll_SetParent(vwprt,mainhwnd) window_setpos(vwprt,posx%,posy%) ActivateWindow window_main End Function Und eine "b3d_functions.bb", die in B3D inkludiert werden muss, sieht folgendermaßen aus: Code: [AUSKLAPPEN] Function Window_Hide()
Local ww% = GraphicsWidth() Local wh% = GraphicsHeight() Local xoff% = dll_GetSystemMetrics(7) Local yoff% = dll_GetSystemMetrics(8) + dll_GetSystemMetrics(4) Local hRgn% = dll_CreateRectRgn(xoff, yoff, ww+xoff, wh+yoff) dll_SetWindowRgn(dll_GetActiveWindow(), hRgn, True) dll_DeleteObject(hRgn) End Function Das B3D- und BPlus-Programm sind nun wie folgt aufgebaut: Blitz3D Code: [AUSKLAPPEN] Include "bb\b3d_functions.bb"
Global TITLE_B3D$ = "AppTitle" Global TITLE_BPLUS$ = "BlitzPlus" AppTitle(TITLE_B3D$) If FindWindow("BlitzMax_Window_Class",TITLE_BPLUS$) = 0 Then RuntimeError "Bitte starten sie das Hauptprogramm!" Graphics3D 800,600,0,2 SetBuffer BackBuffer() Window_Hide() camera = CreateCamera() light = CreateLight() CameraRange camera,0.1,100 RotateEntity light,0,90,0 cube = CreateCube() PositionEntity cube,0,0,4 Repeat TurnEntity cube,0.1,0.1,0.1 RenderWorld Flip 0 Until FindWindow("BlitzMax_Window_Class",TITLE_BPLUS$) = 0 ClearWorld End BlitzPlus Code: [AUSKLAPPEN] Function Window_SetPos(hwnd, x%, y%)
Local xoff% = dll_GetSystemMetrics(7) Local yoff% = dll_GetSystemMetrics(8) + dll_GetSystemMetrics(4) dll_SetWindowPos(hwnd,0,x-xoff,y-yoff,0,0,5) End Function Function Prepare(posx%,posy%) MainHwnd = GetActiveWindow() ExecFile(B3D_WINDOW$) tmp=MilliSecs() Repeat Until MilliSecs()-tmp > 500 Repeat vwprt = FindWindow("Blitz Runtime Class",TITLE_B3D$) If WaitEvent(1) = $803 Then End Until vwprt <> 0 SetParent(vwprt,mainhwnd) window_setpos(vwprt,posx%,posy%) ActivateWindow window_main End Function Jetzt nur noch das B3D-Programm kompilieren und eine exe erstellen und dann kann das BlitzPlus-Programm gestartet werden. Die beiden Programme können nun z.B. über Dateien kommunizieren. Ich hoffe, ich konnte einigen damit weiterhelfen. Mfg TheProgrammer |
||
aktuelles Projekt: The last day of human being |
BladeRunnerModerator |
Fr, Aug 22, 2008 17:53 Antworten mit Zitat |
|
---|---|---|
~VERSCHOBEN~ Dieser Thread passte nicht in das Forum, in dem er ursprünglich gepostet wurde. |
||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
Dreamora |
Fr, Aug 22, 2008 19:12 Antworten mit Zitat |
|
---|---|---|
sehr pässlich, könnte ich durchaus gebrauchen | ||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
Übersicht BlitzBasic FAQ und Tutorials
Powered by phpBB © 2001 - 2006, phpBB Group