|
Hello
I think this will be considered more with mobile development also. This will depend on the type of phone you are connecting -eg. SmartPhone, Symbian, etc...- as each plateform has its own commands.
Concerning the windows part all you have to do is make a program that will interface with the mobile using either usb port, bluetooth, or any other mean of data transport.
Regards
|
|
|
|
|
I found a project in c# to print the current active windows in MDI form, which wraps System.Drawing.Printing types. When i select 4 pages per sheet for printing, While printing its printing only 2 pages per sheet. Can anybody tell me which type of System.Drawing.Printing namespace need to be looked into for this type of bug, given the printing types are wrapped.
BSK
|
|
|
|
|
It sounds more like the images doesn't fit on the page. Have you checked that the page size in the printer settings correspond to the paper size that you are using?
---
b { font-weight: normal; }
|
|
|
|
|
Yes, I even changed the size of the pages to relatively small , so that it can fit. But it seems something wrong with classes wrapped
|
|
|
|
|
Hi
i load an image on label control.but with tab key ,label is not selected .
How can i make this control selected with tab key
|
|
|
|
|
I hate to be the bearer of bad news, but you can't select Label boxes with the tab key. Labels are not designed to get the focus, if you want your image to get the focus, you'll have to put it in another type of control.
WhiteWizard
aka Gandalf
|
|
|
|
|
Hi
how can i use key press event in c#
|
|
|
|
|
Hi
You can add for each component of the form a key_Down Event for example :
the form is called xxx
private: System::Void xxx_KeyDown(System::Object * sender, System::Windows::Forms::KeyEventArgs * e)
{
if(e->get_KeyCode() == 27 ) { // If the key ESC
... // Traitement
}
if (e.KeyChar == (char)Keys.Return) { // ENTER Key
... // Traitement
}
}
|
|
|
|
|
thank u sir
But i do not want write seperate keypress event for each control of form
. i want only a single for all control
|
|
|
|
|
Create a generic handler like so:
private void KeyPress(object sender, KeyEventArgs e)
{
} Then assign all the event handlers to this method, i.e. in the Properties window select the Events tab, if you select the KeyPress event then a combobox should appear, select the KeyPress method and that event handler will be bound to the above function. Repeat for all the controls you want bound.
Just Google it.
Failing that try phoning
|
|
|
|
|
Set KeyPreview property of your form true and register to the KeyPress event of your form.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
How can i convert any date and time into this representation:
ddMMyyy hhMMss
I need this so i can save a file with a name of the current date and time.
I tried a few things with TimeSpan. Im not getting through
Can anyone help me with this?
Thanks in advance
|
|
|
|
|
DateTime now = DateTime.Now;
string now = now.ToString("ddMMyyy HHmmss");
You can use any DateTime object you created. This one here uses the current date and time ("Now")
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
Thank you Greeeg!
That worked!
|
|
|
|
|
I know this problem was solved, but I would highly recommend using yyyyMMdd so the files will be in chronological order.
|
|
|
|
|
Does Windows explorer (among others) sort them in that order? Good to know.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi
i load an image on label control.but with tab control ,control is not selected .
How can i make this control selected with tab control
|
|
|
|
|
Hello, I need to do some gui automation work with Java from C#.
I apologize, there are two ways:
1/ throught .net 3.0 System.Windows.Automation,
It seems to be incompatible with Java.
2/ throught Java Access Bridge throught interop with functions in WindowsAccessBridge.dll
However, all called functions /isJavaWindow, getAccessibleContextAt, getAccessibleContextFromHWND, getAccessibleContextWithFocus/ are not working for me.
Does anybody have any examples ?
Gagy
|
|
|
|
|
Hi Greg,
Please use below code
using System.Runtime.InteropServices;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
namespace JabApiLib.JavaAccessBridge
{
public static class JabHelpers
{
public class AccessibleTreeItem
{
public String name; // the AccessibleName of the object
public String description; // the AccessibleDescription of the object
public String role; // localized AccesibleRole string
public String role_en_US; // AccesibleRole string in the en_US locale
public String states; // localized AccesibleStateSet string (comma separated)
public String states_en_US; // AccesibleStateSet string in the en_US locale (comma separated)
public Int32 indexInParent; // index of object in parent
public Int32 childrenCount; // # of children, if any
public Int32 x; // screen coords in pixel
public Int32 y; // "
public Int32 width; // pixel width of object
public Int32 height; // pixel height of object
public Boolean accessibleComponent; // flags for various additional
public Boolean accessibleAction; // Java Accessibility interfaces
public Boolean accessibleSelection; // FALSE if this object doesn't
public Boolean accessibleText; // implement the additional interface
public Boolean accessibleInterfaces;
public string textValue;
public string m_msgStr;
public List<accessibletreeitem> children;
public AccessibleTreeItem()
{
children = new List<accessibletreeitem>();
}
public AccessibleTreeItem(AccessibleContextInfo accessibleContextInfo)
: this()
{
this.name = accessibleContextInfo.name; // the AccessibleName of the object
this.description = accessibleContextInfo.description; // the AccessibleDescription of the object
this.role = accessibleContextInfo.role; // localized AccesibleRole string
this.role_en_US = accessibleContextInfo.role_en_US; // AccesibleRole string in the en_US locale
this.states = accessibleContextInfo.states; // localized AccesibleStateSet string (comma separated)
this.states_en_US = accessibleContextInfo.states_en_US; // AccesibleStateSet string in the en_US locale (comma separated)
this.indexInParent = accessibleContextInfo.indexInParent; // index of object in parent
this.childrenCount = accessibleContextInfo.childrenCount; // # of children, if any
this.x = accessibleContextInfo.x; // screen coords in pixel
this.y = accessibleContextInfo.y; // "
this.width = accessibleContextInfo.width; // pixel width of object
this.height = accessibleContextInfo.height; // pixel height of object
this.accessibleComponent = accessibleContextInfo.accessibleComponent; // flags for various additional
this.accessibleAction = accessibleContextInfo.accessibleAction; // Java Accessibility interfaces
this.accessibleSelection = accessibleContextInfo.accessibleSelection; // FALSE if this object doesn't
this.accessibleText = accessibleContextInfo.accessibleText; // implement the additional interface
this.accessibleInterfaces = accessibleContextInfo.accessibleInterfaces;
}
public Rectangle Bounds
{
get
{
return new Rectangle(this.x, this.y, this.width, this.height);
}
}
public Int32 SquarePixels
{
get { return this.x * this.y; }
}
}
internal class ItemComparer : IComparer<accessibletreeitem>
{
#region IComparer<ireader> Members
public int Compare(AccessibleTreeItem x, AccessibleTreeItem y)
{
if (x.SquarePixels < y.SquarePixels)
{
return 1;
}
else if (x.SquarePixels > y.SquarePixels)
{
return -1;
}
else
{
return 0;
}
}
#endregion
}
private static List<accessibletreeitem> screenContents = new List<accessibletreeitem>();
public static string screenContentsString = string.Empty;
public static int g_vmId;
public static IntPtr g_acPtr;
public static AccessibleTreeItem GetComponentTree(IntPtr hWnd, out Int32 vmID)
{
screenContents.Clear();
screenContentsString = string.Empty;
AccessibleTreeItem accessibleTreeItem = new AccessibleTreeItem();
vmID = 0;
//String temp = "2B0586";
//hWnd = Marshal.StringToHGlobalAuto(temp);
//bool result = JabApi.initializeAccessBridge();
IntPtr versionInfo;
IntPtr acPtr1 = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleContextInfo()));
bool result1 = JabApi.getVersionInfo(34, acPtr1);
if (JabApi.isJavaWindow(hWnd) == 1)
{
MessageBox.Show("Java Handle found");
JabApi.MouseClickedDelegate mcd = new JabApi.MouseClickedDelegate(HandleMouseClicked);
JabApi.setMouseClickedFP(mcd);
JabApi.FocusLostDelegate mcd1 = new JabApi.FocusLostDelegate(FocusLostDelegateEvent);
JabApi.setFocusLostFP(mcd1);
JabApi.FocusGainedDelegate mcd2 = new JabApi.FocusGainedDelegate(FocusGainedDelegateEvent);
JabApi.setFocusGainedFP(mcd2);
JabApi.PopupMenuWillBecomeInvisibleDelegate mcd3 = new JabApi.PopupMenuWillBecomeInvisibleDelegate(PopupMenuWillBecomeInvisibleDelegateEvent);
JabApi.setPopupMenuWillBecomeInvisibleFP(mcd3);
JabApi.PopupMenuWillBecomeVisibleDelegate mcd4 = new JabApi.PopupMenuWillBecomeVisibleDelegate(PopupMenuWillBecomeVisibleDelegateEvent);
JabApi.setPopupMenuWillBecomeVisibleFP(mcd4);
JabApi.PropertyActiveDescendentChangeDelegate mcd5 = new JabApi.PropertyActiveDescendentChangeDelegate(PropertyActiveDescendentChangeDelegateEvent);
JabApi.setPropertyActiveDescendentChangeFP(mcd5);
JabApi.PropertySelectionChangeDelegate mcd6 = new JabApi.PropertySelectionChangeDelegate(PropertySelectionChangeDelegateEvent);
JabApi.setPropertySelectionChangeFP(mcd6);
JabApi.PropertyStateChangeDelegate mcd7 = new JabApi.PropertyStateChangeDelegate(PropertyStateChangeDelegateEvent);
JabApi.setPropertyStateChangeFP(mcd7);
JabApi.PropertyTableModelChangeDelegate md8 = new JabApi.PropertyTableModelChangeDelegate(PropertyTableModelChangeDelegateEvent);
JabApi.setPropertyTableModelChangeFP(md8);
JabApi.PropertyValueChangeDelegate md9 = new JabApi.PropertyValueChangeDelegate(PropertyValueChangeDelegateEvent);
JabApi.setPropertyValueChangeFP(md9);
unsafe
{
IntPtr acPtr;
try
{
MessageBox.Show("calling getAccessibleContextFromHWND");
if (JabApi.getAccessibleContextFromHWND(hWnd, out vmID, out acPtr))
{
g_vmId = vmID;
g_acPtr = acPtr;
AccessibleContextInfo ac = new AccessibleContextInfo();
accessibleTreeItem = GetAccessibleContextInfo(vmID, acPtr, out ac, null, 0, string.Empty); // RECURSION SEED
MessageBox.Show("getAccessibleContextFromHWND");
return accessibleTreeItem;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
else
{
MessageBox.Show("No Java Handle");
//m_msgStr = "Window handle is not for Java";
//Debug.Print(m_msgStr);
}
return null;
}
public static AccessibleContextInfo GetAccessibleContextInfo(Int32 vmID, IntPtr ac)
{
AccessibleContextInfo aci = new AccessibleContextInfo(); //This will be the info that we return.
// Allocate global memory space for the size of AccessibleContextInfo and store the address in acPtr
IntPtr acPtr = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleContextInfo()));
try
{
//Convert the pointer to an actual object.
Marshal.StructureToPtr(new AccessibleContextInfo(), acPtr, true);
//getAccessibleContextInfo() returns true or false, depending on whether it succeeds.
if (JabApi.getAccessibleContextInfo(vmID, ac, acPtr))
{
aci = (AccessibleContextInfo)Marshal.PtrToStructure(acPtr, typeof(AccessibleContextInfo));
//Check that the info isn't null, and then return.
if (!ReferenceEquals(aci, null))
{
return aci;
}
}
}
catch
{
return new AccessibleContextInfo();
}
return new AccessibleContextInfo();
}
public static String Venkatesh(IntPtr hWnd, string stringToSearchAndClick)
{
int vmId;
IntPtr acPtr1;
AccessibleTreeItem accessibleTreeItem;
if (JabApi.getAccessibleContextFromHWND(hWnd, out vmId, out acPtr1))
{
AccessibleContextInfo ac = new AccessibleContextInfo();
accessibleTreeItem = GetItemsFromWindow(vmId, acPtr1, out ac, null, 0, string.Empty, stringToSearchAndClick); // RECURSION SEED
MessageBox.Show("getAccessibleContextFromHWND");
}
//AccessibleContextInfo ac = new AccessibleContextInfo();
//MessageBox.Show("Searching for " + text);
//GetItemsFromWindow(g_vmId, g_acPtr, out ac, null, 0, string.Empty); // RECURSION SEED
return "";
}
public static AccessibleTextItemsInfo GetAccessibleTextInfo(Int32 vmID, IntPtr ac)
{
//Reserve memory
IntPtr ati = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleTextItemsInfo()));
//Call DLL.
JabApi.getAccessibleTextItems(vmID, ac, ati, 0);
//Creat object
AccessibleTextItemsInfo atInfo = (AccessibleTextItemsInfo)Marshal.PtrToStructure(ati, typeof(AccessibleTextItemsInfo));
//Free memory
if (ati != IntPtr.Zero)
{
Marshal.FreeHGlobal(ati);
}
return atInfo;
}
private static AccessibleTreeItem GetItemsFromWindow(Int32 vmID, IntPtr currentPtr, out AccessibleContextInfo currentContext, AccessibleTreeItem parentItem, int level, string lineage, string stringToSearchAndClick)
{
IntPtr acPtr = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleContextInfo()));
try
{
//MessageBox.Show("In GetAccessibleContextInfo");
Marshal.StructureToPtr(new AccessibleContextInfo(), acPtr, true);
if (JabApi.getAccessibleContextInfo(vmID, currentPtr, acPtr))
{
currentContext = (AccessibleContextInfo)Marshal.PtrToStructure(acPtr, typeof(AccessibleContextInfo));
if (!ReferenceEquals(currentContext, null))
{
AccessibleTreeItem newItem = BuildAccessibleTree(currentContext, parentItem);
if (!ReferenceEquals(newItem, null))
{
string treeInfo = Repeat("\t", level) + currentContext.name;
//Checks to see if current object has any text items.
unsafe
{
if (currentContext.name == stringToSearchAndClick)
{
IntPtr actions;
Int32 failure1;
AccessibleActionsToDo actions_to_do;
int temp2 = Marshal.SizeOf(new AccessibleActions());
IntPtr accessible_action_ptr = Marshal.AllocHGlobal(temp2);
JabApi.getAccessibleActions(vmID, currentPtr, accessible_action_ptr);
AccessibleActions actions1 = (AccessibleActions)Marshal.PtrToStructure(accessible_action_ptr, typeof(AccessibleActions));
actions_to_do.actionsCount = actions1.actionsCount;
actions_to_do.actions = actions1.actionInfo;
int temp3 = Marshal.SizeOf(new AccessibleActionsToDo());
IntPtr accessible_action_ptr1 = Marshal.AllocHGlobal(temp3);
JabApi.MouseClickedDelegate mcd1 = new JabApi.MouseClickedDelegate(HandleMouseClicked);
int fp = 0;
Marshal.StructureToPtr(actions_to_do, accessible_action_ptr1, false);
JabApi.doAccessibleActions(vmID, currentPtr, accessible_action_ptr1, &failure1);
IntPtr Window_Handle = JabApi.getHWNDFromAccessibleContext(vmID, currentPtr);
}
if (currentContext.role == "table")
{
IntPtr tableInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleTableInfo()));
Marshal.StructureToPtr(new AccessibleTableInfo(), tableInfoPtr, true);
if (JabApi.getAccessibleTableInfo(vmID, currentPtr, tableInfoPtr) == false)
{
MessageBox.Show("Failed...");
//appendToBuffer(buffer, bufsize, "\r\nERROR: GetAccessibleContextInfo failed ", bufsize);
}
else
{
AccessibleTableInfo tableInfo;
tableInfo = (AccessibleTableInfo)Marshal.PtrToStructure(tableInfoPtr, typeof(AccessibleTableInfo));
for (int i = 0; i < tableInfo.rowCount; i++)
{
for (int j = 0; j < tableInfo.columnCount; j++)
{
IntPtr tableCellInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleTableCellInfo()));
Marshal.StructureToPtr(new AccessibleTableCellInfo(), tableCellInfoPtr, true);
if (JabApi.getAccessibleTableCellInfo(vmID, tableInfo.accessibleTable, i, j, tableCellInfoPtr) == false)
{
MessageBox.Show("Failed...");
}
else
{
JabApi.setPropertyValueChangeFP(PropertyValueChangeDelegateEvent);
AccessibleTableCellInfo tableCellInfo;
tableCellInfo = (AccessibleTableCellInfo)Marshal.PtrToStructure(tableCellInfoPtr, typeof(AccessibleTableCellInfo));
IntPtr cellACInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleContextInfo()));
Marshal.StructureToPtr(new AccessibleContextInfo(), cellACInfoPtr, true);
if (JabApi.getAccessibleContextInfo(vmID, tableCellInfo.accessibleContext, cellACInfoPtr) == false)
{
MessageBox.Show("Failed");
}
AccessibleContextInfo cellACInfo;
cellACInfo = (AccessibleContextInfo)Marshal.PtrToStructure(cellACInfoPtr, typeof(AccessibleContextInfo));
bool retVal = false;
if (cellACInfo.name == "234")
{
PropertyTableModelChangePackage fp = new PropertyTableModelChangePackage();
fp.vmID = vmID;
fp.AccessibleContextSource = tableCellInfo.accessibleContext;
fp.oldValue = "";
fp.oldValue = "";
JabApi.setPropertyTableModelChangeFP(fp);
retVal = JabApi.setTextContents(vmID, tableCellInfo.accessibleContext, "99999");
MessageBox.Show(cellACInfo.name);
}
}
}
}
}
}
}
screenContentsString += treeInfo + Environment.NewLine;
Debug.Print(treeInfo);
//Start collecting children
int nextLevel = level + 1;
for (int i = 0; i < currentContext.childrenCount; i++)
{
string lineageInfo = Repeat("\t", level) + level.ToString() + " Child " + i.ToString() + " Lineage = {" + lineage + "}";
screenContentsString += lineageInfo + Environment.NewLine;
Debug.Print(lineageInfo);
string currentlineage;
if (lineage == string.Empty)
currentlineage = i.ToString();
else
currentlineage = lineage + ", " + i.ToString();
if (currentContext.role_en_US != "unknown" && currentContext.states_en_US.Contains("visible")) // Note the optomization here, I found this get me to an acceptable speed
{
AccessibleContextInfo childContext = new AccessibleContextInfo();
IntPtr childPtr = JabApi.getAccessibleChildFromContext(vmID, currentPtr, i);
GetItemsFromWindow(vmID, childPtr, out childContext, newItem, nextLevel, currentlineage, stringToSearchAndClick);
//TODO: Not sure when or where to release the java objects, the JVM will leak memory until released
//JabApi.releaseJavaObject(vmID, childPtr);
}
}
}
return newItem;
}
}
else
{
currentContext = new AccessibleContextInfo();
}
}
finally
{
if (acPtr != IntPtr.Zero)
Marshal.FreeHGlobal(acPtr);
//TODO: Not sure when or where to release the java objects, the JVM will leak memory until released
//JabApi.releaseJavaObject(vmID, currentPtr);
}
return null;
}
private static AccessibleTreeItem GetAccessibleContextInfo(Int32 vmID, IntPtr currentPtr, out AccessibleContextInfo currentContext, AccessibleTreeItem parentItem, int level, string lineage)
{
unsafe
{
// Allocate global memory space for the size of AccessibleContextInfo and store the address in acPtr
IntPtr acPtr = Marshal.AllocHGlobal(Marshal.SizeOf(new AccessibleContextInfo()));
try
{
//MessageBox.Show("In GetAccessibleContextInfo");
Marshal.StructureToPtr(new AccessibleContextInfo(), acPtr, true);
if (JabApi.getAccessibleContextInfo(vmID, currentPtr, acPtr))
{
currentContext = (AccessibleContextInfo)Marshal.PtrToStructure(acPtr, typeof(AccessibleContextInfo));
if (!ReferenceEquals(currentContext, null))
{
AccessibleTreeItem newItem = BuildAccessibleTree(currentContext, parentItem);
if (!ReferenceEquals(newItem, null))
{
//Checks to see if current object has any text items.
if (currentContext.accessibleText == true)
{
AccessibleTextItemsInfo textItem;
//Gets text items.
textItem = GetAccessibleTextInfo(vmID, currentPtr);
newItem.textValue = textItem.sentence;
string treeInfo = Repeat("\t", level) + currentContext.name + " = \"" + textItem.sentence + "\"";
screenContentsString += treeInfo + Environment.NewLine;
Debug.Print(treeInfo);
}
else
{
string treeInfo = Repeat("\t", level) + currentContext.name + " : " + currentContext.role;
if (currentContext.name.Contains("14.20.22"))
{
MessageBox.Show(currentContext.name + " : " + currentContext.role);
JabApi.setTextContents(vmID, currentPtr, "12.0.0");
}
if (currentContext.role == "text")
{
Debug.Print(treeInfo);
}
if (currentContext.role == "combo box")
{
IntPtr actions;
Int32 failure = 512 ;
AccessibleActionsToDo actions_to_do;
int temp2 = Marshal.SizeOf(new AccessibleActions());
IntPtr accessible_action_ptr = Marshal.AllocHGlobal(temp2);
JabApi.getAccessibleActions(vmID, currentPtr, accessible_action_ptr);
AccessibleActions actions1 = (AccessibleActions)Marshal.PtrToStructure(accessible_action_ptr, typeof(AccessibleActions));
actions_to_do.actionsCount = actions1.actionsCount;
actions_to_do.actions = actions1.actionInfo;
int temp3 = Marshal.SizeOf(new AccessibleActionsToDo());
IntPtr accessible_action_ptr1 = Marshal.AllocHGlobal(temp3);
JabApi.MouseClickedDelegate mcd1 = new JabApi.MouseClickedDelegate(HandleMouseClicked);
int fp = 0;
JabApi.setMouseClickedFP(null);
Marshal.StructureToPtr(actions_to_do, accessible_action_ptr1, false);
JabApi.doAccessibleActions(vmID, currentPtr, accessible_action_ptr1, &failure);
IntPtr Window_Handle = JabApi.getHWNDFromAccessibleContext(vmID, currentPtr);
}
screenContentsString += treeInfo + Environment.NewLine;
Debug.Print(treeInfo);
}
//Start collecting children
int nextLevel = level + 1;
for (int i = 0; i < currentContext.childrenCount; i++)
{
string lineageInfo = Repeat("\t", level) + level.ToString() + " Child " + i.ToString() + " Lineage = {" + lineage + "}";
screenContentsString += lineageInfo + Environment.NewLine;
Debug.Print(lineageInfo);
string currentlineage;
if (lineage == string.Empty)
currentlineage = i.ToString();
else
currentlineage = lineage + ", " + i.ToString();
if (currentContext.role_en_US != "unknown" && currentContext.states_en_US.Contains("visible")) // Note the optomization here, I found this get me to an acceptable speed
{
AccessibleContextInfo childContext = new AccessibleContextInfo();
IntPtr childPtr = JabApi.getAccessibleChildFromContext(vmID, currentPtr, i);
GetAccessibleContextInfo(vmID, childPtr, out childContext, newItem, nextLevel, currentlineage);
//TODO: Not sure when or where to release the java objects, the JVM will leak memory until released
//JabApi.releaseJavaObject(vmID, childPtr);
}
}
}
return newItem;
}
}
else
{
currentContext = new AccessibleContextInfo();
}
}
finally
{
if (acPtr != IntPtr.Zero)
Marshal.FreeHGlobal(acPtr);
//TODO: Not sure when or where to release the java objects, the JVM will leak memory until released
//JabApi.releaseJavaObject(vmID, currentPtr);
}
}
return null;
}
public static string Repeat(string s, int count)
{
var _s = new System.Text.StringBuilder().Insert(0, s, count).ToString();
return _s;
}
private static AccessibleTreeItem BuildAccessibleTree(AccessibleContextInfo acInfo, AccessibleTreeItem parentItem)
{
if (!ReferenceEquals(acInfo, null))
{
AccessibleTreeItem item = new AccessibleTreeItem(acInfo);
if (!ReferenceEquals(parentItem, null))
{
screenContents.Add(item);
parentItem.children.Add(item);
}
return item;
}
return null;
}
static void HandleMouseClicked(System.Int32 vmID, IntPtr jevent, IntPtr ac)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void FocusLostDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void FocusGainedDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void PopupMenuWillBecomeInvisibleDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void PopupMenuWillBecomeVisibleDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void PropertyActiveDescendentChangeDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac,
IntPtr oldActiveDescendent, IntPtr newActiveDescendent)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void PropertySelectionChangeDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void PropertyStateChangeDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac,
[MarshalAs(UnmanagedType.LPWStr)] string oldState, [MarshalAs(UnmanagedType.LPWStr)] string newState)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void PropertyTableModelChangeDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac, IntPtr oldValue, IntPtr newValue)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
static void PropertyValueChangeDelegateEvent(System.Int32 vmID, IntPtr jevent, IntPtr ac,
[MarshalAs(UnmanagedType.LPWStr)] string oldValue, [MarshalAs(UnmanagedType.LPWStr)] string newValue)
{
JabApi.releaseJavaObject(vmID, ac);
JabApi.releaseJavaObject(vmID, jevent);
}
}
}
|
|
|
|
|
Hi ,
How to click a button using Java Access Bridge with WindowsAccessBridge.dll (C#.net). Please share me complete code for below two classes.
1)AccessibleActionsToDo
2)AccessibleActions
AccessibleActionsToDo actions_to_do;
int temp2 = Marshal.SizeOf(new AccessibleActions());
IntPtr accessible_action_ptr = Marshal.AllocHGlobal(temp2);
JabApi.getAccessibleActions(vmID, currentPtr, accessible_action_ptr);
AccessibleActions actions1 = (AccessibleActions)Marshal.PtrToStructure(accessible_action_ptr, typeof(AccessibleActions));
actions_to_do.actionsCount = actions1.actionsCount;
actions_to_do.actions = actions1.actionInfo;
int temp3 = Marshal.SizeOf(new AccessibleActionsToDo());
IntPtr accessible_action_ptr1 = Marshal.AllocHGlobal(temp3);
JabApi.MouseClickedDelegate mcd1 = new JabApi.MouseClickedDelegate(HandleMouseClicked);
int fp = 0;
JabApi.setMouseClickedFP(null);
Marshal.StructureToPtr(actions_to_do, accessible_action_ptr1, false);
JabApi.doAccessibleActions(vmID, currentPtr, accessible_action_ptr1, &failure);
IntPtr Window_Handle = JabApi.getHWNDFromAccessibleContext(vmID, currentPtr);
|
|
|
|
|
Hi,
Iam new to c# can anyone help me to find the no of occurance of a string eg("C") in a set of string eg("Couch") without any loops.
thank you,
Regards
Praveen
|
|
|
|
|
You could split the string on the substring you're looking for, then see how many items are in your array. A regex would also work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Both methods outlined by CG would work, I'd go for the Regex one as it's more powerful and infintely more configurable should your requirements change.
If you need any help with Regexs this[^] site is very good, if that doesn't help then just ask.
Just Google it.
Failing that try phoning
|
|
|
|
|
Use String.Split to find the number of character count.
for example :
"infintely".Split("i".ToCharArray()); returns an array of count 3.
so number of i in "infintely" is 2.
Ashish
|
|
|
|
|
Wasn't that meant to be for the OP?
Just Google it.
Failing that try phoning
|
|
|
|
|