windows

Get USB serial number c++

I'm looking to retrieve the serial number from a USB memory stick on windows in c++. I have found plenty of C# examples, and c++ for linux but none for c++ and windows. Edit C++/CLI is not an option unfortunately. I am looking for the serial number of the device not the file system. OR "Device Instance Path" AKA "InstanceID" ...

Batch For /F Syntax with %time%

How do I accomplish this: for /f "tokens=1-4 delims=: " %%a in ('%time%') do set XTime=%%a.%%b.%%c.%%d I'm trying to get the contents of %time% e.g., 16:25:15.65 into 16.25.15.65. Running the command above gives me: The filename, directory name, or volume label syntax is incorrect. (If it matters I'm on Windows XP) ...

Batch - Echo or Variable Not Working

I have this little batch script: SET @var = "GREG" ECHO %@var% PAUSE When I run it, it prints: H:\Dynamics>SET @var = "GREG" H:\Dynamics>ECHO ECHO is on. H:\Dynamics>PAUSE Press any key to continue . . . Why won't it print the contents of @var? How do I know if @var is even being set? ...

Not drawing a thickframe on a CWnd

I've got an application window in which I'm adding the WS_THICKFRAME style and I have removed the WS_CAPTION style. When the window maximizes, I want to hide the WS_THICKFRAME, but retain the Aero-Snap feature, so I have altered my handler for WS_NCCALCSIZE to return an inflated rect with respect to the size of the window borders. That ...

Problems with Asp.net Mvc 2.0 Web.config.debug/release....System.UnauthorizedAccessException was unhandled by user code

Hi I am trying to use the debug and release versions of the webconfig but it never works. I am trying to do this for a 3rd party library that I am using called combres. http://combres.codeplex.com/ So I first put all the needed web.config code in the web.config. Now I have 2 different .xml files(thats where you put your javascript and...

How do I force a native application to use an older C runtime

Visual Studio 2010 installs version ...4974 of the VC9 runtime whose .pdbs are unavailable. How can I force my GME.exe to use an older VC9 runtime? I've tried putting this into GME.exe.config: <?xml version="1.0"?> <configuration> <windows> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity type="w...

How to kill an alert window in Windows using C#?

Hi, I am using the System.Diagnostics.Process Namespace in C# to start a system process, sometimes this new created process won't start properly, in these cases Windows shows me an alert window giving information about the failed process. I need a way to close (kill) this alert window programatically. I tried the following code but it d...

Same code returns diffrent result on windows7 - 32 bit system

When i run the below code on windows XP - 32 , i get the below result. i have plugged only one usb pen drive On Windows XP - 32 Bit ----------------------- Drive C: ProductId: ST3160215AS ProductRevision: 3.AAD DeviceType: 7, DeviceNumber: 0, PartitionNumber: 1 DevicePath: \\?\ide#diskst3160215as_______________________...

twofaced file problem

I'm reading in my program some files from system32 folder; and one of these files (C:\Windows\System32\gdi32.dll) demonstrates a very strange behavior. When I'm reading it from my program, it shows size of 310'784 bytes; and when I view it's size from Explorer, it shows size of 404'480 bytes. How could that be? ...

I miss one of my drive letter

i get notification when a new device is plugged or unplugged from the system using WM_DEVICECHANGE i can able to get vendor id,product id and corresponding drive letter , when a device is inserted one by one. please refer the code below switch( pHdr->dbch_devicetype ) { case DBT_DEVTYP_DEVICEINTERFACE: pDevInf = ( PDEV_BROAD...

Getting TortoiseSVN/TortoiseGit icon overlays in 32-bit applications on 64-bit Windows

When installing TortoiseHg on Windows x64, I have an option to install both x86 and x64 shell extensions, which is useful, as my favorite Windows Explorer replacement is 32-bit. But there is no such options for TortoiseGit or TortoiseSVN, so working with them requires opening Explorer windows. I know it's possible to install 32 and 64-b...

the diffrence between unsigned long to UINT64

hi everyone is any one knows whats the diffrence between unsigned long to UINT64 i think its the same , but im not sure. the defenition of UINT64 is : typedef unsigned __int64 UINT64 (By Using StdAfx.h) thanks. ...

File Writing issue in c

I am writing the log file in my c application, the method for writing the file is fopen_s(&fMainFile, "c:\\LOG\\Filter.txt", "a"); fprintf(fMainFile, "SomeText"); fclose(fMainFile); I open the handle, after writing I closed it, but this writing crash my application after a while, can any one sort out this problem, that how much dange...

Windows Form App as Scheduled Task

I have run into a case where a Windows Form application is being run regularly via a scheduled task on a Windows Server 2003 box. The GUI is, obviously, not being used to take in any user input, so it is at best pointless. But is it also dangerous? Could it cause anything to go pop on the box? ...

What's the working paradigm of Windows Performance Counter?

I have just finished reading this article about how to create a performance counter and update the counter's value. But I am a little confused about the working paradigm of the Windows Performance Counter. Suppose there're 2 programs A and B, and A want to know B's performance through some performance counters. Which of the following sce...

Executing cmd commands in Windows from PHP Issue

Is it possible to execute cmd commands in Windows OS with PHP exec() function? I tried this: <?php try { echo exec( 'O:\test\pdftk.exe O:\test\outputs\OPP\out.pdf O:\test\outputs\OPP\out2.pdf cat output O:\test\123.pdf' ); } catch (Exception $e) { echo $e->getMessage(); } Basically, I'm trying to merge two pdf file...

How to check whether a folder or a file is hidden=

I want to find out whether a file or a directory is hide. At first I made use of CFile::GetStatus(), however I found this api sometimes will return FALSE. I don't know why, So I wrote the following code, However I found it is not stable. What is wrong with my code? BOOL IsHide(const CString& strPath, BOOL& bIsHide) { if (strPat...

i am having problem with c code?

hello i am using windows and ANSI-c , i have an application that sniffs data from network card then decodes it and sent to and other application via UDP. the problem is my application starts with fine working but after some time its all variables int, float and strings are corrupted i have checked it many times but can't be able to dig o...

What involves to schedule a thread in Windows?

What exactly is happenning when Windows scheduling a thread. What computation resources are involved in process of scheduling itself. More specific - how many CPU cycles can take rescheduling a runnable thread which just finished its timeslice/quantum for another timeslice/quantum (because there are no other threads for example). ...

How can I read from a Windows shared drive in a platform independent way using Java?

How can I read from a Windows shared drive using Java in such a way that the Java code which performs the reading could run equally correctly on any platform? ...