windows

"Bring to front" for Windows XP command shell

Is there a command I can put into a Windows XP .bat file to bring the command shell to the front? ...

Is __declspec(dllexport) needed in cpp files

Probably a simple question but I only have Linux to test this code on where __declspec(dllexport) is not needed. In the current code __declspec(dllexport) is in front of all files in the .h file but just in front of like 50% of the functions in the cpp file so I am wondering if they are really needed in the cpp file at all ? ...

How to create an auto startup c++ program

I am creating a program in c++, which I want to be able to have the option to have users let it auto start in windows. So when a user starts his computer, windows will auto start this program. I have read stuff about modifying the registry or putting it in the startup folder, but what would be the best "clean" way to do this? ...

Native looking GUI framework for Mac and Windows

I am currently searching for a GUI framework that looks and works native under Mac and Windows. Further I dont want to use C++ but e.g. C#, Java, Ruby or Python. Thx a lot. ...

Setting Print Queue Priority in Windows

I have some code that sends a text file to a printer as follows: File.Copy(outputFile, "\\" & printServer & "\" & printer) Is there a way I can specify the priority of the print job before it's sent to the printer? ...

How to write socket communication program using win32

New guy want to learn about socket programming in win32. I know bit of MFC but thats not good point to start as it just hides the internal details form programmer. ...

Detect script start up from command prompt or "double click" on Windows

Is is possible to detect if a Python script was started from the command prompt or by a user "double clicking" a .py file in the file explorer on Windows? ...

Windows Impersonation from C#

How can a C# program running as LocalSystem impersonate the login identity of another user temporarily? Roughly speaking I have a Windows Service that I'd like to run as LocalSystem but at times impersonate user XYZ (when connecting to a db using windows integrated security). Most important of all: Is there a way to do this without kno...

How to export and import environment variables in windows(e.g. XP)?

I found it is hard to keep my environment variables sync on different machines. I just want to export the settings from one computer and import to other ones. I think it should be possible, but don't know how to do it. Can anyone help me? Thanks. ...

Large application/file load-time

Hello, I'm sure many have noticed that when you have a large application (i.e. something requiring a few MBs of DLLs) it loads much faster the second time than the first time. The same happens if you read a large file in your application. It's read much faster after the first time. What affects this? I suppose this is the hard-drive c...

Detect if running with administrator privileges under Windows XP

I am trying to work out how to detect whether a user is running with admin rights under Windows XP. This is fairly easy to do in Vista/Win7 thanks to the whoami command. Here's a snippet in Ruby for how to do it under Vista: Note, the following link now incorporates the solution suggested by muteW http://gist.github.com/65931 The trou...

What is the win32 API function for private bytes?

What is the win32 API function for private bytes (the ones you can see in perfmon). I'd like to avoid the .NET API ...

InternetCheckConnection always return false

I want to use the wininet function InternetCheckConnection to check whenever the machine is connected to the internet and can access a specific host. The problem is that this function is always returning false, no matter the URL I put on it. MSDN link ...

Get sector location of a file

Based on a file name, or a file handle, is there a Win-API method of determining what physical sector the file starts on? ...

Getting the handle of window in C#

I have the following class declared: public partial class MainWindow : Window And I need to get the actual handle of the window once the window has one. How can I do that and where should I put the query function. What I tried so far was: IntPtr hwnd = new WindowInteropHelper(this).Handle; But the handle I get back is 0, which might...

Best current book on Windows networking (TCP/IP, sockets, packet filtering, firewalls)

Before you jump to TCP/IP Illustrated or UNIX Network Programming, let point out that I am looking for a great book or two that are going to help me on Windows XP and Vista. I'm a C++ developer creating end-user applications (not a device driver writer or hardware guy) and I want to make use of the networking API's to get applications ...

How to identify users which are connected to a windows server via remote desktop

At my workplace, we have lab machines that we use to do our testing. The standard procedure to reserve a machine for testing was to walk around the office to make sure that no one was using the machine. This is highly inefficient and time consuming. At first, I set up a web page where people could reserve the lab machine but nobody...

script to map network drive

I want to be able to connect to a (wifi) network hard drive from my laptop, but only occasionally. If I use the "Map a network drive" command in WinXP explorer, I have to put in the drive's IP address and name, then the router name and its password. Too much to remember! I'm looking for a way of scripting this activity (in any language)...

C# Manage windows events

I would like to delete an event from the Windows event log using C#, can anyone point me in the right direction of how to achieve this? Thanks ...

Correct name for non-COM, non-.NET DLL?

In the Windows world, what is the correct name for a good. old-fashioned C++ DLL with exported functions? Not a COM DLL, not a .NET DLL. The kind of DLL that we used to invoke by calling LoadLibrary() and GetProcAddress()? I've always called them "flat DLLs" because the caller cannot instantiate objects from the DLL, but what is the co...