winapi

Calling DeviceIoControl from C# with IOCTL_DVD_* Control Codes

I am trying to call DeviceIoControl from C# for IOCTL_DVD_* control codes. Having read a lot of information and trying a number of examples I have not made much progress. What I am trying to eventually do is get a DVD_LAYER_DESCRIPTOR structure about the media currently in the DVD drive. I can call CreateFile successfully on the DVD d...

Are there any benefits of suspending a thread over making it wait?

I was going through a legacy code and found that the code uses SuspendThread Function to suspend the execution of a worker thread. Whenever the worker thread needs to process a request, the calling thread resumes this worker thread. Once the task is done the thread suspends itself. I don’t know why it was done this way. According to me...

is there any SDK provided by microsoft for network application development

Hi all, I am writing a Network program, and i am using NP_ENUM_NETWORK in my win32 application. when i serach in my system i am not able to locate this enum can i know in which header file, i wil get this enum. is there any SDK provided by microsoft for network application development where i can get this enum. with regards Vinayak...

How to create a process in C++ on Windows?

Hi Can anyone tell me how to create a process in VC++? I need to execute regasm.exe testdll /tlb:test.tlb /codebase command in that process. ...

Does the timeBeginPeriod API affect the system clock?

I have a Win32 application, and there are some animiation UI in my application, to make the animiation more smooth, I called timeBeginPeriod to improve the time resolution, but I found the system clock will delay some seconds if my application is running very long time. Does the timeBeginPeriod affect the system clock? ...

VB6 - Move mouse pointer smoothly between two points?

It's been yonks since I've done any VB6... I need to take control of the mouse pointer and move it smoothly between two points. Is the best way to do this a combination of GetCursorPos, SetCursorPos and a timer or two, or is there a better way? Thanks for any help. ...

How to convert Win Mobile 6 project into Win CE 6.0 RC2

I have a Windows Mobile 6 Professional native project that runs ok on Win Mobile devices. Now I need a version that runs on Windows Embedded CE 6.0 RC2. What is the best path for this conversion? Can I just change few project settings / add new platform with configuration manager OR I have to start with new smart device project and impor...

CLSID_CNetworkListManager undeclared identifer - error

Dear All, I am developing an application to get the networks available on the system. Trying to run the same on windows vista. (The below code is based on the link : http://msdn.microsoft.com/en-us/library/ms697388(VS.85).aspx) Below is the Code Snippet: #include "Netlistmgr.h" #include "Objbase.h" INetworkListManager* pNLM = NULL; ...

OpenThread() Returns NULL Win32

I feel like there is an obvious answer to this, but it's been eluding me. I've got some legacy code in C++ here that breaks when it tries to call OpenThread(). I'm running it in Visual C++ 2008 Express Edition. The program first gets the ThreadID of the calling thread, and attempts to open it, like so: ThreadId threadId = IsThreaded...

How do I use GDI to draw text around a circular path?

I need to draw text onto a window HDC along a circular path using C/C++, and I'm getting google-eyed from searching for several hours. Can someone point me to a good reference? ...

How to read "Contributing Artist" metadata in C++?

Windows 7 has a very nifty way of showing "Contributing Artist" metadata in Windows Explorer. In wonder how can I access that metadata from C++? Maybe you even point to some source code? Greatly appreciate in advance. ...

ocamlopt on Windows doesn't produce executable

Here's a simple OCaml program: helloworld.ml print_string "Hello world...\n" ;; I'm using OCaml 3.11.0 (MSVC built), VS 2008, and of course FlexDLL Here's how I compile it (ran from the VS 2008 shell): ocamlopt helloworld.ml -o helloworld No executable created. Is there something wrong? The program compiled and ran on Linux, though...

Windows Service: Do work at specified times (Delphi)

Just checking if there's any best practice when writing a Windows Service. The Service (Single-thread) needs to work at specified time intervals, right now I can only think of: Use sleep(), then check the time in a loop? Use a TTimer? Any advice? ...

Getting the cluster size of a hard drive (through code)

I need to find the cluster size of the users hard drive, through C or C++. The hard drive uses NTFS (though I'd appreciate knowing how it's done on other file systems as well). I guess what I need is some combination of win32 API calls, but I don't know which. For instance, typing "fsutil fsinfo ntfsinfo c:" in the windows console give...

SetForegroundWindow problems when a modal child exists

I am using the Win32 API call SetForegroundWindow to set focus to another application's window. I am then using SendKeys to send keystrokes to that window. This works well apart from when a modal window (such as a File Open dialog) is open. In this scenario I want to set that modal child window as the foreground window. Using my main a...

Accessing Segment Registers MASM

Hello! I'm trying to query the value located in the Process Enviornment Block, pointed to by the FS segment register. Attempting to compile code with the fs:[0] segment included results in an error (error A2108: use of register assumed to ERROR). How do you query the segment registers?! Thanks ...

How to retrieve the time spent in user mode in a win32 process.

I know that GetProcessTimes can be used to retrieve the time a process spent in user mode (as opposed to the time it spent in kernel mode or the time it was suspended). Unfortunately, it seems that the resolution is only 16ms (the same as GetTickCount). Is there a way to retrieve the time with greater precision? ...

Not allow user to manually launch an application

Hi, I need a way to prevent the user of a windows mobile based phone to launch my application exe file directly. I have the following scenario: My windows mobile application has two exe files, one has a shortcut in Applications Menu and the other must be hide for the user. What i want is to not allow the user to manually execute my hid...

Can anyone help me with the Windows API NetApi32?

I am trying to get a list of shares on a specific machine. So I decided to use the Windows API NetApi32.dll. Here is my code snippet: Dim svr As String = Environment.MachineName Dim level As Integer = 2 Dim sharesRead As Integer, totalEntries As Integer, nRet As Integer, hResume As Integer = 0 Dim pBuffer As IntPtr = IntPtr.Zero nRet =...

How to add properties to a file like the Windows Office documents?

How to add properties to a file like the Windows Office? In Windows, is possible to edit fields from a file like Title, Subject, Keywords etc. How to do the same with an arbitrary file from C/C++ without using Office? Do you have any hint about API, DLLs or general tricks? ...