PocketMatrix forums

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

GapiDisplay.ResumeDisplay bug ????

HI,

I have a full screen application using GapiDrawNet and after a SuspendDisplay function I call the ResumeDisplay.

It's seem like the ResumeDisplay restore the Backbuffer with start Y coordinate after the operative's menubar. Is it a bug or a feature?. Is there a way to prevent it to happen???

Thanks

NTN
Hi,

It's seem like the ResumeDisplay restore the Backbuffer with start Y coordinate after the operative's menubar. Is it a bug or a feature?.


I am not really sure what you mean with this. Most sample applications use Suspend/Resume display without issues...
Tri · 18 Aug 2003, 08:02 UTC — GapiDisplay.ResumeDisplay bug ????
Dear Johan,

The fullscreen application in the beginning has the topleft coordinate (0,0) at the topleft of the screen. After the Suspend/Resume display functions, the coordination (0,0) is now moved downward 20 pixels or so, just after the task bar.

Best regards,

Tri
Tri: Suspend/Resume do no not alter the coordinate in any way. All they do is disallow writing directly to the display. The issue is almost certainly in your code or in the gapidraw.net wrapper since all the c++ sample applications work flawlessly.
Tri · 18 Aug 2003, 11:39 UTC — Suspend/Resume display
Dear Johan,

The code I use to test are included below. You can see the coordinate display on the screen before and after a press on A button.

Best regards,

Tri

////////////////////////////////////////
using System;
using System.Data;
using System.Drawing;
using GapiDrawNet;
using System.Runtime.InteropServices;
using System.Windows.Forms;

using System.IO;
using System.Threading;
using System.Collections;
using System.Diagnostics;


namespace GapiFormTest
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : GapiForm
{
GapiSurface backgroundSurface;
GapiBitmapFont _simpleFont = new GapiBitmapFont();

public Form1(GapiApplication application):base(application)
{
backgroundSurface = new GapiSurface();


}

private string _coordinate = "";
override public void StylusDown(Point p, System.Windows.Forms.MouseEventArgs e)
{
_coordinate = p.X.ToString() + "," + p.Y.ToString();
}
GapiDisplay _gapiDisplay;

override public void KeyDown(System.Windows.Forms.KeyEventArgs e)
{
if ((int)e.KeyCode == this.GDApplication.KeyList.vkA )
{
_gapiDisplay.SuspendDisplay();
OnlineHelp();
_gapiDisplay.ResumeDisplay();
}
else if ((int)e.KeyCode == this.GDApplication.KeyList.vkB)
{

}
}


public override void CreateSurfaces(GapiDisplay gapiDisplay)
{
base.CreateSurfaces(gapiDisplay);
backgroundSurface.CreateSurface("background.bmp");
_simpleFont.CreateFontSimple("simpleFont.png");
_gapiDisplay = gapiDisplay;
}

public override void ProcessNextFrame(bool frameOverflow)
{
BackBuffer.BltFast(0, 0, backgroundSurface, 0);
DrawFrameInfo(BackBuffer,0,_coordinate,GapiUtility.RGB(255,0,0));
base.ProcessNextFrame(frameOverflow);
}

private void DrawFrameInfo(GapiSurface surface, int dwY, string pText, int color)
{

int strWidth = surface.GetTextWidth(pText, _simpleFont);
int strX = surface.Width - strWidth;

GDRect rect = new GDRect(0, dwY-1, strX + strWidth + 3, dwY + 8);

GDFILLRECTFX fillrectfx = new GDFILLRECTFX();
fillrectfx.dwOpacity = 128;

surface.FillRect(ref rect, color, 128);
surface.DrawRect(ref rect,0xff00ff);
surface.DrawText(strX, dwY, pText, _simpleFont, DrawTextOptions.GDDRAWTEXT_LEFT);

}



[DllImport("CoreDll")]
private extern static
int CreateProcess( String imageName,
String cmdLine,
IntPtr lpProcessAttributes,
IntPtr lpThreadAttributes,
Int32 boolInheritHandles,
Int32 dwCreationFlags,
IntPtr lpEnvironment,
IntPtr lpszCurrentDir,
byte [] si,
ProcessInfo pi );

public class ProcessInfo
{
public IntPtr hProcess;
public IntPtr hThread;
public Int32 ProcessId;
public Int32 ThreadId;
}

[DllImport("CoreDll")]
public static extern bool SetForegroundWindow( IntPtr hWnd);

[DllImport("CoreDll")]
public static extern IntPtr GetForegroundWindow();

[DllImport("CoreDll")]
public static extern IntPtr FindWindow( char[] className, char[] WindowsName);


static ProcessInfo _processInfo;
public static bool CreateProcess( String ExeName, String CmdLine, ProcessInfo pi )
{
if ( _processInfo == null )
_processInfo = new ProcessInfo();
byte [] si = new byte[128];
int er = CreateProcess(ExeName, CmdLine, IntPtr.Zero, IntPtr.Zero,
0, 0, IntPtr.Zero, IntPtr.Zero, si, _processInfo);

return true;
}

public bool IsWindowVisible(string WindowName)
{
IntPtr hWnd;
hWnd = FindWindow(null, WindowName.ToCharArray());
IntPtr h2 = GetForegroundWindow();
if (h2 == hWnd)
return true;
return false;
}

private void OnlineHelp()
{
CreateProcess("iexplore.exe", "", _processInfo);
Thread.Sleep(1000);

while (IsWindowVisible("Internet Explorer"))
Thread.Sleep(200);

string strinet = "Internet Explorer";
IntPtr hWndInet = FindWindow(null,strinet.ToCharArray());
Microsoft.WindowsCE.Forms.Message msg = new Microsoft.WindowsCE.Forms.Message();
msg.HWnd = hWndInet;
msg.Msg = 0x0010; //WM_CLOSE;
Microsoft.WindowsCE.Forms.MessageWindow.SendMessage(ref msg);
}


}
}