Desktop Functions: Smart Device Functions:
|
Search Results for "TEST" in [All]odbc321: SQLBindCol
//Set the environment attribute SQL_ATTR_ODBC_VERSION to the latest version of ODBC driver wininet
' 1MB in size should be enough for this test user32
CDS_TEST = 0x00000002,
CDS_TEST = &H2
CDS_TEST = 0x00000002,
CDS_TEST = &H2 5: CreateMenu Test
rk = root.CreateSubKey("POPUPTEST\\shellex\\ContextMenuHandlers\\BatchResults");
root.DeleteSubKey("POPUPTEST\\shellex\\ContextMenuHandlers\\BatchResults");
/// <param name="hInstance">Handle to the instance of the module to be associated with the window.</param> <param name="lpParam">Pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created window by this function before it returns.
/// <para>If an application calls CreateWindow to create a MDI client window, lpParam should point to a CLIENTCREATESTRUCT structure. If an MDI client window calls CreateWindow to create an MDI child window, lpParam should point to a MDICREATESTRUCT structure. lpParam may be NULL if no additional data is needed.</para></param>
''' <param name="hInstance">Handle to the instance of the module to be associated with the window.</param> <param name="lpParam">Pointer to a value to be passed to the window through the CREATESTRUCT structure (lpCreateParams member) pointed to by the lParam param of the WM_CREATE message. This message is sent to the created window by this function before it returns.
''' <para>If an application calls CreateWindow to create a MDI client window, lpParam should point to a CLIENTCREATESTRUCT structure. If an MDI client window calls CreateWindow to create an MDI child window, lpParam should point to a MDICREATESTRUCT structure. lpParam may be NULL if no additional data is needed.</para></param>
static extern IntPtr DdeCreateStringHandle(uint idInst, string psz, DdeCreateStringHandleA and DdeCreateStringHandleW respectively. [DllImport("user32.dll", EntryPoint="DdeCreateStringHandleA")] IntPtr serviceHandle = DdeCreateStringHandle(instanceId, "MT4", CP_WINANSI);
//Create a project called ClipBoardTest, a form called Form1 and add two buttons (button1, button2) and two listboxes (listbox1, listbox2).
namespace ClipBoardTest
'Tested with VisualStudio 2010, Windows 7 x64 11: GetClassLong Testing the size of the IntPtr is the easiest way to determine if the platform is 64-bit. 12: GetClassLongPtr Testing the size of the IntPtr is the easiest way to determine if the platform is 64-bit.
//Create a project called ClipBoardTest, a form called Form1 and add two buttons (button1, button2) and two listboxes (listbox1, listbox2).
namespace ClipBoardTest 14: GetCursor Tested on Unity Engine. Sould be works on other .Net Framework/IDE:
public class GetCursorPosTest : MonoBehaviour 15: GetGUIThreadInfo
// Tested on Win7 64 bit. 16: GetKeyboardState
public static bool IsKeyPressed( VirtualKeyStates testKey )
short result = GetKeyState( testKey ); 17: GetKeyState The following two constants are used in combination with the returned value to test the current state: This Sample use this API to create a new textbox to support overwrite mode, testing the state of insert key. 18: GetLastInputInfo Test it with: sleep 15; ./a.exe Moving the mouse or pressing the keyboard during the test will alter the result, as expected! 19: GetSystemMetrics Documentation tested on Microsoft Visual Studio 2005 20: IsWindow
/// <param name="hWnd">C++ ( hWnd [in]. Type: HWND )<br />A handle to the window to be tested.</param> 21: keybd_event I'm using this to create automated UI testing for a custom Textbox control. After a lot of trial and error the following code worked well for me. 22: SendInput
[testing.windows]::SetForegroundWindow( @( Get-Process notepad |? { $_.id -in @( get-wmiobject win32_process -filter "name='notepad.exe'" |% { if ( $_.getowner().user -eq $env:username ) { $_.processid } } ) } )[0].MainWindowHandle)
$_inputList = New-Object 'Collections.Generic.List[Testing.Windows3+INPUT]'
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_S } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_S ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::MENU } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_E } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::MENU ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_E ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::CONTROL } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_F } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::CONTROL ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_F ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
Start-Sleep 2 ; [Testing.Windows3]::SendInput($_inputArray.count, $_inputArray, [Runtime.InteropServices.marshal]::SizeOf($_inputArray[0])) 23: SetClassLong Testing the size of the IntPtr is the easiest way to determine if the platform is 64-bit. 24: SetClassLongPtr Testing the size of the IntPtr is the easiest way to determine if the platform is 64-bit. This is especially useful for test automation to make sure the Application Under Test (AUT) retains focus before manipulating it. This may be called several times in an automated test script, so it is best to create a method similar to the example below.
// test code here...
// more test code... 26: SetMenu It's very important to specify 'ref' on the MENUITEMINFO otherwise on Windows 7 32-bit user32.dll will crash with the error text 0a9e372d3b4ad19135b953a78882e789. However, Windows 8.1 64 bit it works with or without the 'ref' keyword. Tested both using NET40. 27: SetWinEventHook const uint EVENT_OBJECT_TEXTSELECTIONCHANGED = 0x8014; // hwnd ID idChild is item w? test selection change 28: ToUnicode
bool bKeyStateStatus = GetKeyboardState(bKeyState);
if (!bKeyStateStatus) 29: ToUnicodeEx
bool bKeyStateStatus = GetKeyboardState(bKeyState);
if (!bKeyStateStatus) 30: VkKeyScan
string testChars = "Aéש";
foreach(char test in testChars)
Console.Write(test);
if(keyboard.GetKey(test, out key)) 31: VkKeyScanEx
string testChars = "Aéש";
foreach(char test in testChars)
Console.Write(test);
if(keyboard.GetKey(test, out key)) ntdll
static void ObjectManagerTest() using System.IO; // for test main (FileStream) only using System.Text; // for test main (Encoding) only using System.Threading; // for test main (Thread.Sleep) only using System.Diagnostics; // for test main (Trace.Write[Line]) only
#region test main
// create a test file:
string path2file = "test.fle";
string contents = "contents of test.fle";
// wait a little (1.5 sec) and modify test file attributes:
// run the test:
//path2file=test.fle
#endregion test main
public void Test() 35: RtlInitializeSid Tested on Win8.1 x64 by @gsuberland, but not thoroughly.
public void Test() advapi32
//This snippet is tested on WinXP and Vista, only needed in Vista when using SetTimeZoneInformation 38: ControlService
IntPtr serv = Tools.OpenService(con, "ServiceTest", (uint)SERVICE_ACCESS.SERVICE_ALL_ACCESS);
public class TestService : ServiceBase
ServiceBase.Run (new TestService());
public TestService()
this.ServiceName = "TestService";
private string ConvertSidBytesToString(byte[] sidBytes) 40: CreateService
Dim serviceName As String = "AAATestService"
Dim displayName As String = "AAATestDisplayName" 41: CredRead
string strTarget = "TestCred";
// Don't forget to test for ERROR_MORE_DATA before proceeding (removed for brevity)
// Don't forget to test for ERROR_MORE_DATA before proceeding (removed for brevity) 43: EqualSid 44: GetSecurityInfo namespace GetSecurityInfoTest
fileStream = File.Open(@"C:\Test\Test.txt", FileMode.Open); namespace test
namespace test 47: LookupAccountSid
namespace test 48: ReadEventLog
static extern Boolean ReadEventLog(IntPtr hEventLog, EVT_READ_FLAGS dwReadFlags, UInt32 dwRecordOffset, IntPtr lpBuffer, UInt32 nNumberOfBytesToRead, out UInt32 pnBytesRead, out UInt32 pnMinNumberOfBytesNeeded);
UInt32 dwBytesToRead = 524287;//max buffer size
pBuff = Marshal.AllocHGlobal((int) dwBytesToRead);
if (!ReadEventLog(hEventLog, EVT_READ_FLAGS.EVENTLOG_SEQUENTIAL_READ | EVT_READ_FLAGS.EVENTLOG_BACKWARDS_READ, dwRecordNumber, pBuff, dwBytesToRead, out dwBytesRead, out dwMinBytes))
dwBytesToRead = dwMinBytes;
if (!ReadEventLog(hEventLog, EVT_READ_FLAGS.EVENTLOG_SEQUENTIAL_READ | EVT_READ_FLAGS.EVENTLOG_BACKWARDS_READ, dwRecordNumber, pBuff, dwBytesToRead, out dwBytesRead, out dwMinBytes)) 49: RegOpenKey When I tested this API code in a tight loop, to get a value, and using the traditional RegistryKey.Close() on the returned subkey, I found that it leaked RegistryHandles. 50: RegQueryValue
'In fact, you could probably even set the output as intPtr already but I didn't test it. 51: RegQueryValueEx
'In fact, you could probably even set the output as intPtr already but I didn't test it. After some overview, and minor deliberation, I've flushed out a full port of the above manifestations, finding not only the best of both the other contributions, but also a little of my own designs for personal use. I needed this design for SQL Server, as utilizing Ad-Hoc queries across network lines the Server inherently treats "C:\" as the local drive on the Server, so for a query on a client system that needs to be translated to "\\MyComputer\C$" in order to be functional. I apologize as well for my little extension, but with my enjoyment of C style assignment and comparison in one step, I created that for my own use, and did not wish to alter my class in order to post it here, so I included it. I also noticed that the Marshal.PtrToStringAnsi() did not work for me, while PtrToStringAuto did, so I am currently unaware how I might test for which is the best to use for any given situation, but I figure anyone can make that minor alteration if necessary on their own. icmp53: IcmpSendEcho
// != 0 can still be dest unreachable, test status further down too Constants54: CB_
CB_DELETESTRING = 0x0144,
public const int CB_DELETESTRING = 0x0144;
CB_DELETESTRING = &H144
Public Const CB_DELETESTRING As Integer = &H144 None. Test. 56: IsGUIThread The IsGUIThread function tests whether the calling thread is already a graphical user interface (GUI) thread. It can also optionally convert the thread to a GUI thread. 57: ShellAPI
public const int PRINTACTION_TESTPAGE = 4; 58: ShellAPI
public const int PRINTACTION_TESTPAGE = 4; 59: SND testttttttt 60: TCM_ public const UInt32 TCM_HITTEST = (TCM_FIRST + 13);
// (int)SNDMSG((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO FAR*)(pinfo))
Private Const TCM_HITTEST As UInt32 = (TCM_FIRST + 13)
' (int)SNDMSG((hwndTC), TCM_HITTEST, 0, (LPARAM)(TC_HITTESTINFO FAR*)(pinfo)) Cut off search results after 60. Please refine your search. |