File: wgl-CustomCCode.c

package info (click to toggle)
libjogl-java 1.1.1-1
  • links: PTS, VCS
  • area: non-free
  • in suites: lenny
  • size: 9,916 kB
  • ctags: 24,946
  • sloc: java: 87,017; ansic: 12,156; xml: 1,625; cpp: 302; objc: 91; sh: 35; makefile: 21
file content (48 lines) | stat: -rw-r--r-- 1,465 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>

#define JOGL_DUMMY_WINDOW_NAME "__jogl_dummy_window"

LRESULT CALLBACK DummyWndProc( HWND   hWnd, UINT   uMsg, WPARAM wParam, LPARAM lParam) {
  return DefWindowProc(hWnd,uMsg,wParam,lParam);
}

ATOM oglClass = 0;

HWND CreateDummyWindow( int x, int y, int width, int height ) {
  HINSTANCE hInstance;
  DWORD     dwExStyle;
  DWORD     dwStyle;
  HWND      hWnd;

  hInstance = GetModuleHandle(NULL);
  if( !oglClass ) {
    WNDCLASS  wc;
    ZeroMemory( &wc, sizeof( wc ) );
    wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
    wc.lpfnWndProc = (WNDPROC) DummyWndProc;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hInstance = hInstance;
    wc.hIcon = NULL;
    wc.hCursor = NULL;
    wc.hbrBackground = NULL;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = JOGL_DUMMY_WINDOW_NAME;
    if( !(oglClass = RegisterClass( &wc )) ) {
      printf( "RegisterClass Failed: %d\n", GetLastError() );
      return( 0 );
    }
  }
  
  dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
  dwStyle = WS_OVERLAPPEDWINDOW;
  if( !(hWnd=CreateWindowEx( dwExStyle,
                             JOGL_DUMMY_WINDOW_NAME,
                             JOGL_DUMMY_WINDOW_NAME,
                             dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
                             x, y, width, height,
                             NULL, NULL, hInstance, NULL ) ) ) {
    return( 0 );
  }
  return( hWnd );
}