windows-vista

How to check if a file can be created inside given directory on MS XP/Vista?

只愿长相守 提交于 2019-11-30 21:25:09
I have a code that creates file(s) in user-specified directory. User can point to a directory in which he can't create files, but he can rename it. I have created directory for test purposes, let's call it C:\foo . I have following permissions to C:\foo : Traversing directory/Execute file Removing subfolders and files Removing Read permissions Change permissions Take ownership I don't have any of the following permissions to C:\foo : Full Control File creation Folder creation I have tried following approaches, so far: os.access('C:\foo', os.W_OK) == True st = os.stat('C:\foo') mode = st[stat

Vista Speech Recognition in Delphi

不打扰是莪最后的温柔 提交于 2019-11-30 21:08:43
I would like to be able to dictate into my Delphi application using Microsoft Vista's speech recognition. However when attempting to dictate into a TMemo, it simply does not work. I noticed that Firefox 3.0 has the same issue and after they contacted Microsoft about the problem, they told them that they need to implement the Text Services Framework for their application. I am wondering if there is any way to implement this in Delphi so that I can dictate into a TMemo or a TRichEdit. Searching Google for a solution didn't return any relevant results. Where would I start in finding a solution?

Eventlog listener - Applications and Services

♀尐吖头ヾ 提交于 2019-11-30 20:57:13
Is there a way to watch events of "applications and services" when they are generated (in C#)? I've figured out that I can not use WMI for it. Any other ideas? You can subscribe to EventLog.EntryWritten Event Occurs when an entry is written to an event log on the local computer. From MSDN: .... EventLog myNewLog = new EventLog(); myNewLog.Log = "MyCustomLog"; myNewLog.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten); myNewLog.EnableRaisingEvents = true; } public static void MyOnEntryWritten(object source, EntryWrittenEventArgs e){ } Did your try it wit the EventLog.EntryWritten

programmatically run cmd.exe as administrator in vista, C#

跟風遠走 提交于 2019-11-30 20:51:49
I have a visual studio setup and deployment project. I've added a .cmd script in it. The script would need administrator privileges to run. When user clicks on the setup.exe, UAC prompts the user for Admin permissions. So I assumed that all processes created and called within setup.exe will run in admin capacity. So I made the setup call my console application which contains the following code. ProcessStartInfo p1 = new ProcessStartInfo(); p1.UseShellExecute = true; p1.Verb = "runas"; p1.FileName = "cmd.exe"; Process.Start(p1); So it should've worked as it's run under administrator space. I

Won't Let Me Install Gem in Ruby Prompt

為{幸葍}努か 提交于 2019-11-30 20:33:42
问题 Windows Vista, Ruby v. 3.3.5 C:\>gem install rmagick Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. C:/Ruby19/bin/ruby.exe extconf.rb checking for Ruby version >= 1.8.5... yes Invalid drive specification. Unable to get ImageMagick version *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You

Managing apps volume in Windows 7

依然范特西╮ 提交于 2019-11-30 20:29:08
How can I retrieve the list of application audio sessions (like in Windows volume mixer) and change volume of one application (for example, Mozilla) manually (C++, Delphi)? Skype do something the same when you start talking (decreases the volume of other applications). Thanks in advance! To enumerate the Audio sessions you must use the IAudioSessionManager2 interface and call the GetSessionEnumerator method, this will return a IAudioSessionEnumerator interface , from here you must invoke the GetSession method to return a IAudioSessionControl interface wich provides all the functions to

GetThreadId on pre-vista systems?

天大地大妈咪最大 提交于 2019-11-30 20:09:50
Apperantly, GetThreadId is a Vista API. How can I get a thread's id on pre vista systems? Reed Copsey There are a few options: When you call CreateThread , you get the handle back. You can call GetCurrentThreadId to get the current thread's ID. You can use Thread32First / Thread32Next to enumerate threads. If you can somehow make the thread in question call GetCurrentThreadId and store it somewhere, you could read the result. If the thread in question enters an alertable wait state frequently, you could send it an APC with QueueUserAPC ; the APC handler can then call GetCurrentThreadId and

BDE initialization failure (error $2501) on Vista

有些话、适合烂在心里 提交于 2019-11-30 19:45:44
I have a small datasnap server written in Delphi 2007 that accesses the BDE. It works fine on Windows 2000 and XP but from time to time (actually quite regularly) on Vista I get the error message: An error occurred while attempting to initialize the Borland Database Engine (error $2501) Closing everything down that uses the BDE fixes the error (although you sometimes need to "End Process" the datasnap server to close it). This is becoming rather annoying as more and more of our clients are running Vista for their "server". Does anyone have any suggestions? You haven't mentioned if you've tried

How do I get battery information in windows?

二次信任 提交于 2019-11-30 19:29:24
I have two laptops here. One is running Vista, the other Windows 7. I need to get the specifications on the batteries in both, how do I go about that? The reason I'm asking is that I'd like to know if they're lithium ion or something else. Supposedly other types of batteries may have adversely affected charge capacities if left plugged in for too long. You could use WMI and the Win32_Battery class. It has a property called Chemistry that has this information. UPDATE: Actually, there is also Win32_PortableBattery , which would be more appropriate for a laptop battery. They both inherit from the

Is there an API for vista to detect if the desktop is running full screen?

久未见 提交于 2019-11-30 16:20:07
e.g, Is the user playing a movie full screen, or looking at powerpoint in full screen mode? I could have sworn I saw a IsFullScreenInteractive API before, but can't find it now Here's how I've solved this problem: using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Runtime.InteropServices; namespace Test { class Program { static void Main(string[] args) { Console.WriteLine(IsForegroundWwindowFullScreen()); } [DllImport("user32.dll")] static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll")] static extern int GetSystemMetrics(int