Skip to content

Commit

Permalink
wmdc_connect utility (beta)
Browse files Browse the repository at this point in the history
  • Loading branch information
timashev committed Jan 20, 2012
1 parent d024fb0 commit c3d60e3
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,5 @@ platform/shared/qt/rhodes/RhoSimulatorVersion.h
platform/shared/qt/rhodes/resources/Info.plist
platform/wm/tools/Debug/*
platform/wm/tools/Release/*
platform/wm/tools/wmdc_connect/Debug/*
platform/wm/tools/wmdc_connect/Release/*
31 changes: 25 additions & 6 deletions platform/wm/tools/wmdc_connect/stdafx.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
// stdafx.cpp : source file that includes just the standard includes
// wmdc_connect.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
/*------------------------------------------------------------------------
* (The MIT License)
*
* Copyright (c) 2008-2011 Rhomobile, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* http://rhomobile.com
*------------------------------------------------------------------------*/

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
35 changes: 27 additions & 8 deletions platform/wm/tools/wmdc_connect/stdafx.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
/*------------------------------------------------------------------------
* (The MIT License)
*
* Copyright (c) 2008-2011 Rhomobile, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* http://rhomobile.com
*------------------------------------------------------------------------*/

#pragma once

#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif

#include <stdio.h>
#include <tchar.h>
#include <windows.h>

// TODO: reference additional headers your program requires here
55 changes: 47 additions & 8 deletions platform/wm/tools/wmdc_connect/wmdc_connect.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,73 @@
// wmdc_connect.cpp : Defines the entry point for the console application.
//
/*------------------------------------------------------------------------
* (The MIT License)
*
* Copyright (c) 2008-2011 Rhomobile, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* http://rhomobile.com
*------------------------------------------------------------------------*/

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
bool launched = false;
HWND hwnd;

printf("WMDC_connect v1.0 (c) 2012 Rhomobile, Inc.\n");

OSVERSIONINFOW os_version;
GetVersionEx(&os_version);
if (os_version.dwMajorVersion < 6) {
printf("This version of Windows does not use WMDC. Nothing to do.");
return 0;
}

int pass = 0;
do {
hwnd = FindWindow(NULL, L"Windows Mobile Device Center");
if (hwnd == 0) {
if (pass == 0) {
printf("WMDC is not running. Starting WMDC...\n");
system("start %WINDIR%\\WindowsMobile\\wmdc.exe /show");
launched = true;
} else {
printf("Waiting for WMDC...\n");
Sleep(10);
Sleep(1000);
}
}
pass++;
} while ((hwnd == 0) && (pass < 12));

if (hwnd == 0) {
printf("ERROR: Cannot find WMDC window.\n");
return 1;
}

printf("Waiting for WMDC to connect to Device Emulator...\n");
Sleep(200);
printf("WMDC window found.\n");
if (launched) {
printf("Waiting for WMDC to connect to Device Emulator...\n");
Sleep(10000);
}
printf("Pushing Connect button...\n");

printf("Pushing the Connect button...\n");
RECT r;
GetWindowRect(hwnd, &r);
RECT cr;
Expand All @@ -51,4 +91,3 @@ int _tmain(int argc, _TCHAR* argv[])

return 0;
}

Binary file added res/build-tools/wmdc_connect.exe
Binary file not shown.

0 comments on commit c3d60e3

Please sign in to comment.