PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

OpenDisplay fails with GDERR_UNSUPPORTEDMODE

I'm rather exasperated with this problem. For PC builds I have no problem, but I cannot call OpenDisplay with success on an actual PPC. I am trying to use my own code instead of CGapiApplication.

CGapiApplication works fine in the Plasma demo. I am creating the window in the exact same way using the same wndclass. I've tried both MFC windows and a regular window created with CreateWindowEx exactly as is done in CGapiApplication. I've stepped through the plasma code and am using the exact same parameters to SetDisplayMode and OpenDisplay.

This is exactly how those routines are called in the Plasma demo:

Code:

rc=g_display.SetDisplayMode(1 /* == GDDISPMODE_NORMAL*/);
rc=g_display.OpenDisplay(2 /* == GDDISPLAY_FULLSCREEN*/, hWnd, 320, 240, 0, 0, 0, 60);


Yet that fails in my other app.

What specific conditions will cause OpenDisplay to fail with GDERR_UNSUPPORTEDMODE? The header file says "Unsupported display resolution or incompatible device", but I assume there are other conditions that can fail and return the same error. Obviously the device is supported (iPaq 3630) because it works with the other demos. I've tried just about every possible combination of SetDisplayMode and OpenDisplay with no success.

Dan East
Try swapping the 240 and 320?
I've tried that.

Dan East
Some ideas:
(1) Check that the thread calling OpenDisplay() is the same that created the window
(2) Check so that the window really is the top parent window

The PPC doesn't care for the rest of the flags...
I call open display immediately after I create the window in the same routine.

The window is created in the same manner as in CGapiApplication. GetParent(hWnd) returns NULL.

Code:

WNDCLASS wc;
::ZeroMemory(&wc;, sizeof(wc));

// Register the Window Class
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = m_hInstance;
wc.hIcon = NULL;
wc.hCursor = 0;
wc.hbrBackground = 0;
wc.lpszMenuName = NULL;
wc.lpszClassName = _T("testclass");

::RegisterClass(&wc;);

hWnd=CreateWindowEx(WS_EX_TOPMOST, _T("testclass"), _T("Test Project"), WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, m_hInstance, NULL);

::SetFocus(hWnd);
::ShowWindow(hWnd, SW_SHOW);
::UpdateWindow(hWnd);
::SetForegroundWindow(hWnd);

ToggleFullscreen(hWnd, true);

CGapiDisplay display;

int rc;
rc=display.SetDisplayMode(1);
rc=display.OpenDisplay(2, hWnd, 0, 0, 0, 0, 0, 0);


hWnd is not NULL.

OpenDisplay returns 0xc8660110

I'm going to create an empty project and try it there.

Dan East
Okay. It works fine in a standard Win32 app, but not an MFC app. I created two fresh minimal projects to test with.

I used AfxGetMainWnd()->GetSafeHwnd() for the hwnd to OpenDisplay (which is the same as m_hWnd in the main frame window).

It fails in MFC even if you create a window using Win32 API and not derived from CWnd. Does version 2.01 work with MFC?

Dan East
Hi Dan,

Look at the included "MFC" sample. It was created by:

(1) Creating a new application without doc-view
(2) Removing the view class
(3) Adding event handlers to the frame window class
(4) Adding a new thread (since the message pump is hidden within MFC - ProcessNextFrame needs to be separated)

The MFC sample uses MFC and works with GapiDraw 2.01. Perhaps you are not using the CFrameWindow class?

//Johan
After some additional mental anguish I discovered the problem. First I converted my app to plain Win32, yet the same problem occured. So I knew that MFC wasn't the issue.

It turns out that I was still statically linking to gx.lib. It appears GapiDraw does not work if the application links to gx.lib.

Dan East
Thanks for the info, I didn't know that.. I'll add it to the "known issues" list at gapidraw.com. Glad to hear the issue got resolved!