|
Post by Darkjester on Feb 24, 2011 0:31:56 GMT -5
Hello, How can i return basic4gl's window handle i cant seem to find the access point, and secondly how can i typecast an integer param into a void?
|
|
|
Post by chris857 on Mar 2, 2011 13:53:39 GMT -5
I assume you want to get the window handle by way of a dll. The way I do it, I have the following three functions in the .dll code (using the sdk by Tom Mulgrew). The functions Load and Start are already there, but they need this code within them. There are also three global variables, one for the handle, and two others to deal with your window's name. It works with both the IDE and executables.
IB4GLOpenGLWindow *openGLWindow = NULL; HWND B4GLhwnd; int isStandalone;
bool DLLFUNC Plugin::Load(IDLL_Basic4GL_FunctionRegistry ®istry, bool isStandaloneExe) { openGLWindow = (IB4GLOpenGLWindow *)registry.FetchInterface("IB4GLOpenGLWindow", 1, 0); isStandalone = isStandaloneExe;
// any other stuff here
return true; }
bool DLLFUNC Plugin::Start() { // Program is about to start. // Any pre-start init code would go here.
if(Standalone() == -1) B4GLhwnd = FindWindow(NULL, openGLWindow->Title()); else B4GLhwnd = FindWindow(NULL, "Basic4GL");
return true; }
int Standalone() { return (isStandalone ? -1 : 0); }
On the question of typecasting an integer param, I need to know more about what you are trying to do to help you.
|
|
|
Post by DJLinux on Mar 2, 2011 15:00:01 GMT -5
You can use the classname of the window too without to fetch the interface "IB4GLOpenGLWindow" Joshy example in BASIC function Start(THIS_PLUGIN) as integer gCurentWindow=0 Windows(gCurentWindow).hWin=FindWindow("gbOPENGL",NULL) ' ' optional get device and render context and curent pixelformat ' Windows(gCurentWindow).DC = wglGetCurrentDC() Windows(gCurentWindow).RC = wglGetCurrentContext() dim as integer iPixelFormat = GetPixelFormat(Windows(0).DC) DescribePixelFormat(Windows(gCurentWindow).DC,iPixelFormat,SizeOf(PIXELFORMATDESCRIPTOR),@gpfd) wglMakeCurrent(Windows(gCurentWindow).DC,Windows(gCurentWindow).RC) return 1 end function
|
|
|
Post by Darkjester on Mar 3, 2011 0:45:22 GMT -5
thanks for the information chris and djlinux very helpful stuff happy coding -darkjester
|
|