Thanks, Wes. I was able to resolve the problem by installing Visual Studio 2012 Express and recommended components, removing the offending line from the Microsoft.Cpp.Platform.targets file (double-clicked error message), and compiling as Release.
Jim Fell
Posts
-
USBView Compile Error -
USBView Compile ErrorI just downloaded the USBView sample application... http://code.msdn.microsoft.com/windowshardware/USBView-sample-application-e3241039 ...and I'm getting a cryptic error when compiling with Visual Studio 2010.
1>------ Rebuild All started: Project: usbview, Configuration: Win8 Debug Win32 ------
1>Build started 10/5/2012 11:58:11 AM.
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(518,5):
error MSB8008: Specified platform toolset
(WindowsApplicationForDrivers8.0) is not installed or invalid. Please
make sure that a supported PlatformToolset value is selected.
1>
1>Build FAILED.
1> 1>Time Elapsed 00:00:00.16
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========Any thoughts or ideas to resolve this would be appreciated. I'm using Windows 7, 32-bit. Thanks.
-
VS 2008, or VS2010As far as the widely used languages (C/C++/C#/VB) are concerned, they're pretty similar. In the short term you'd probably be fine with either. However, in the long term, unless you actually want to get caught in the we-no-longer-support-this-obsolete-product undertow, go with VS2010, and keep your nose above water a bit longer.
-
I need words of wisdomMove your office out of Nigeria and work directly in the States. That way you can cut out the middle man and keep the extra $$ for yourself.
-
Nudity Detection with JavaScript and HTMLCanvasPatrick Wied recently posted this page featuring his project to implement a software nudity scanner. http://www.patrick-wied.at/static/nudejs/[^] This is really quite impressive. Applications for something like this might include parental controls for third-party apps or browser plugins, or even enhancing the safe-search option for image search engines.
-
Using WMI to Query for Currently Attached USB DeviceI am writing an application wherein I need to scan the computer to see if either of two different USB devices are attached. The first device appears as a HID, and the second device appears as a virtual COM port. Which WMI classes should I be checking to see if each device is attached? I am using this for the HID:
m\_bstrScope = SysAllocString( \_T("root\\\\CIMV2") ); m\_bstrQuery = SysAllocString( \_T("SELECT PNPDeviceID FROM Win32\_PnPEntity") );
...and this for the virtual COM port device:
m\_bstrScope = SysAllocString( \_T("root\\\\CIMV2") ); m\_bstrQuery = SysAllocString( \_T("SELECT DeviceID,PNPDeviceID FROM Win32\_SerialPort") );
This pseudo code shows how my scanning algorithm works:
if ( ScanForDevice1() ) // HID attached { /\* Success \*/ } else if ( ScanForDevice2() ) // Virtual COM port device attached { /\* Success \*/ } else { /\* Fail \*/ }
This seems to work, except when I change which device is connected between running the application. If device 1 is found, the scan for device 2 is aborted; the scan for device 2 only occurs if device 1 is not found. What happens is this:
- The application is run with both devices attached to the system. Device 1 is found, as expected. The application exits.
- Device 1 is unplugged from the system.
- The application is run with only device 2 attached to the system. Oddly, device 1 is found, even though it is not attached. The application exits.
- Both devices are unplugged from the system.
- The application is run with no devices attached. No devices are found, as expected. The application exits.
- Only device 2 is plugged back into the system.
- The application is run with only device 2 attached. The application finds device 2, as expected.
My best guess is that I am querying the wrong class(es). Which classes should my application be checking? Or, is there something else that I should be doing? Thanks.
-
Using a Message-Only Window to Receive Device Change Notification Messages [modified]Thanks, Luc. I tried specifying a location with the same lackluster results:
// BOOL bCreated = this->CreateEx( 0, cstrWndClassName,
// L"CMessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0 );
BOOL bCreated = this->CreateEx( 0, cstrWndClassName,
L"CMessageOnlyWindow", -1000, -1000, 100, 100, 0, HWND_MESSAGE, 0 ); -
Using a Message-Only Window to Receive Device Change Notification Messages [modified]I'm trying to get write a message-only window to receive device change notification messages for a USB device. I am using MFC, C++, and Visual Studio 2008. Everything compiles, and it runs without crashing or locking up, but the event handler is never triggered. The device of interest is installed on Windows as a virtual COM port. My main application instantiates the class described below then waits for a character input from the keyboard polling using a while loop. It is during this wait time that I remove and insert my USB device expecting the event to get fired.
class CMessageOnlyWindow : public CWnd
{
DECLARE_DYNAMIC(CMessageOnlyWindow)
private:
DEV_BROADCAST_DEVICEINTERFACE * _pDevIF; // The notification filter.
HDEVNOTIFY _hNotifyDev; // The device notification handle.
public:
CMessageOnlyWindow();
virtual ~CMessageOnlyWindow();
protected:
afx_msg BOOL OnDeviceChange( UINT nEventType, DWORD dwData );
private:
void RegisterNotification( void );
void UnregisterNotification( void );
protected:
DECLARE_MESSAGE_MAP() // Must be last.
};For simplicity, I've removed all the cleanup and error-handling:
DEFINE_GUID(GUID_INTERFACE_CP210x, 0x993f7832, 0x6e2d, 0x4a0f, \
0xb2, 0x72, 0xe2, 0xc7, 0x8e, 0x74, 0xf9, 0x3e);IMPLEMENT_DYNAMIC(CMessageOnlyWindow, CWnd)
CMessageOnlyWindow::CMessageOnlyWindow()
{
CString cstrWndClassName = ::AfxRegisterWndClass( NULL );
BOOL bCreated = this->CreateEx( 0, cstrWndClassName,
L"CMessageOnlyWindow", 0, 0, 0, 0, 0, HWND_MESSAGE, 0 );
this->RegisterNotification();
}CMessageOnlyWindow::~CMessageOnlyWindow() {}
BEGIN_MESSAGE_MAP(CMessageOnlyWindow, CWnd)
ON_WM_DEVICECHANGE()
END_MESSAGE_MAP()afx_msg BOOL CMessageOnlyWindow::OnDeviceChange( UINT nEventType, DWORD dwData )
{
switch ( nEventType ) // <-- Never gets here.
{
case DBT_DEVICEARRIVAL:
break;case DBT\_DEVICEREMOVECOMPLETE: break; default: break; } return TRUE;
}
void CMessageOnlyWindow::RegisterNotification(void)
{
_pDevIF = (DEV_BROADCAST_DEVICEINTERFACE *)malloc( sizeof(DEV_BROADCAST_DEVICEINTERFACE) );
memset( _pDevIF, 0, sizeof(DEV_BROADCAST_DEVICEINTERFACE) );
_pDevIF->dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
_pDevIF->dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
_pDevIF->dbcc_classguid = GUID_INTERFACE_CP210x;
_hNotifyDev = Regi -
Need Help with MySQL Query for Matching ItemsThanks, Luc. If I understand correctly, I should be doing something like this (untested of course):
$userId = mysql_real_escape_string( $_SESSION['user_id'] );
$userPassProvided = mysql_real_escape_string( $_POST['oldPassword'] );
$query = "SELECT user_id, AES_DECRYPT(user_pass, '".$db_aes_key."' ) AS user_pass ";
$query .= "FROM users_tbl WHERE MATCH( user_id, user_pass ) ";
$query .= "AGAINST( '".$userId."', AES_ENCRYPT( '".$userPassProvided."', '".$db_aes_key."' ) IN BOOLEAN MODE ) LIMIT 1";
$result = mysql_query( $query, $mysql_db );Yes, I do want an exact match. This is going to be used in a User Control Panel on my website when the user wants to change their password.
-
Need Help with MySQL Query for Matching ItemsHello. I'm having a little trouble getting this query to work:
$userId = mysql_real_escape_string( $_SESSION['user_id'] );
$userPassProvided = mysql_real_escape_string( $_POST['oldPassword'] );
$query = "SELECT user_id, AES_DECRYPT( user_pass, '".$db_aes_key."' ) AS user_pass ";
$query .= "FROM users_tbl WHERE MATCH( user_id, user_pass ) ";
$query .= "AGAINST( '".$userId."', '".$userPassProvided."' IN BOOLEAN MODE ) LIMIT 1";
$result = mysql_query( $query, $mysql_db );What I would like to do is query users_tbl for the record wherein user_id and user_pass are the same as $userId and $userPassProvided, respectively. Can someone please tell me what is wrong with my query? Thanks. :)
-
Enumerated Type Not Comparing CorrectlyI found the problem. As usual, it turned out to be really simple. My INVALID_ITEM item was positioned at the beginning of the enumeration. When I moved it to the end, after MAX_ENUM_ITEMS, things lined up and started working.
-
Enumerated Type Not Comparing CorrectlyIt's used for quickly indexing into an array, rather than having to use processor time to search for an element.
-
Enumerated Type Not Comparing CorrectlyYou're right. Good catch! The enumerated type enum_items_t has a total of 920 items, including MAX_ENUM_ITEMS. I was thinking in terms of offset, or what n would be as the loop repeats. Unfortunately, outputting constants information with embedded programming can be a little tricky, especially when you're stuck using a ***** compiler/IDE. I'll see what I can do, though. Thanks.
-
Enumerated Type Not Comparing CorrectlyHello. I'm writing some C code for an embedded application, and I've run into a problem wherein a compare against an enumerated value is not being executed correctly. Take the following code snippet, for example:
typedef unsigned int UINT16;
typedef enum enum_items_tag
{
ITEM_1,
ITEM_2,
ITEM_3,/* ... */
ITEM_918,
MAX_ENUM_ITEMS
} enum_items_t;UINT16 n;
for ( n = 0; n < MAX_ENUM_ITEMS; n++ )
{
// Do something
}The code executes as expected, until n is incremented to equal MAX_ENUM_ITEMS, at which time the compare fails, and execution continues within the loop (when it should have exited). I've done things like this in the past without any problems. I've tried re-typing n as enum_items_t (i.e. declaring n as "enum_items_t n"), as well as type casting MAX_ENUM_ITEMS as UINT16. The only other thing I can think of at this point is that maybe there is an issue with the number of items there are in my enumerated type (919). Does anyone know if there are such constraints on enumerated types? I'm using a GCC based compiler. Or, if you have any other ideas, it would be much appreciated. Thanks.
-
[Message Deleted][Message Deleted]
-
C++ Get File SizeThanks! This was a huge help! :)
-
C++ Get File SizeWell, yes, but GetFileSize requires a variable of type HANDLE to be passed to it. I have a FILE variable instantiated, but how do I go from one to the other?
-
C++ Get File SizeHello. I'm writing a program using M$ Visual C++. Is there a simple API for getting the file size? Something like GetFileSize? :) I'm trying to read out bytes from a binary file, and I think it's prematurely reading out an EOF character. So, I need to query the filesize from the OS. Thanks.