This site is no longer active and is available for archival purposes only. Registration and login is disabled.

GapiDisplay.ResumeDisplay bug ????


GapiDisplay.ResumeDisplay bug ????

Postby Tri » Aug 15, 2003 @ 2:40pm

Tri
 


Postby Johan » Aug 15, 2003 @ 3:15pm

Johan Sanneblad, M.Sc, Ph.D
GapiDraw Systems Architect
[]
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


GapiDisplay.ResumeDisplay bug ????

Postby Tri » Aug 18, 2003 @ 9:02am

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
 


Postby Johan » Aug 18, 2003 @ 9:21am

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.
Johan Sanneblad, M.Sc, Ph.D
GapiDraw Systems Architect
[]
User avatar
Johan
pm Member
 
Posts: 1843
Joined: Jan 12, 2002 @ 12:38pm
Location: Sweden


Suspend/Resume display

Postby Tri » Aug 18, 2003 @ 12:39pm

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);
}


}
}
Tri
 


Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron