winapi

Windows 7 left click on clock popup

When left single click on the clock in the taskbar on Windows 7 (maybe Vista too) a popup opens showing calender and clock(s) (thus not the date and time adjust window). How do I open this window myself (preferred in C#)? I was hoping timedate.cpl would call this, but this opens the date and time adjust window. ...

Difference between SafeProcessHandle and IntPtr for an API call

While working with WinAPI, I decided to implement a call to GetProcessAfinityMask in my C# application. However, I've seen two different signatures for this function. One of them uses SafeProcessHandle for the handle: [DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)] public static extern bool GetProcessAffinityMask(...

C++ Windows Form Application Mysql Connection

I can't seem to figure out how to connect to mysql in my windows form application. I've installed all the proper libraries and have included them, thats not the issue. The issue is I can't find a tutorial on connecting to mysql. I've found some one console applications, tried them, but yet for some reason they do not work. I just need to...

win32api vs Python

What are the Pro's and Con's of using win32api for I/O and other things instead of simply Python, if both have a specific function for it I mean, using PyWin32 vs Win32Api ...

teamplayer and pyhook interacting strangely

I'm using teamplayer, which lets you connect more mice to your computer to be used simultaneously. I'm also using pyHook to capture mouse events, with the following code: import pyHook import pythoncom def onclick(event): # called when mouse events are received print 'MessageName:',event.MessageName print 'Message:',event.Message...

.NET C++ Windows Form Application Connecting To Mysql

nvm, I'll just keep trying or switch over to C# ...

Child Window with Limited Resizing

Hi, I want to create a child window that takes up all the space of the left side of main window, but its minimum width is 128 pixels. I also want it to be resizable, but only on the right edge, and makes sure that the width stays at the minimum of 128. Creating the child window with these styles: WS_EX_STATICEDGE, WS_SIZEBOX|WS_CHILD|WS_...

How do you ignore the "flick" gestures in Windows?

I'm programming a tablet application that responds to drag gestures. It works great, except when you drag too quickly. Windows interprets it as a "flick," displays an icon on the screen, and does not report that it is a normal drag to my application. This happens for all of the cardinal directions. Is there a way I can turn this off so ...

Common Controls interrupting WM_KEYDOWN notifications

I have a window that creates a lot of other common controls such as menus, toolbars with buttons and combo boxes, and a status bar. The problem is that the window never receives a WM_KEYDOWN message whenever I press Enter or Esc, but I need to handle these. Is there any common control that is known to interrupt these keys? ...

DLL loading with hardlink

I am trying to devise a method which helps to load DLL from a common location for various products. This helps the following directory structure to avoid file replication. INNSTALLDIR/Product1/bin INNSTALLDIR/Product2/bin .. INNSTALLDIR/ProductN/bin> Instead of replicating DLLs in each product's bin directory above, I can cre...

How to transform one C# structure to another like in C++?

Assume that we have two C# structures: [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ByteStructure { public byte byte0; public byte byte1; public byte byte2; public byte byte3; public byte byte4; public byte byte5; public byte byte6; ...

How to get an accurate 1ms Timer Tick under WinXP

Hello, I try to call a function every 1 ms. The problem is, I like to do this with windows. So I tried the multimediatimer API. Multimediatimer API Source idTimer = timeSetEvent( 1, 0, TimerProc, 0, TIME_PERIODIC|TIME_CALLBACK_FUNCTION ); My result was that most of the time the 1 ms was ok, but someti...

Problem Reading MBR with DeviceIoControl function

I get error while calling DeviceIoControl Function to read the MBR of a removable device. The error code is 5. That means access denied! I am using windows xp sp2. #include "stdafx.h" #include <windows.h> #include <winioctl.h> #include <stdio.h> BOOL GetMBR(PARTITION_INFORMATION *pdg) { HANDLE hDevice; // handle t...

Why might HttpOpenRequest fail with error 122?

The following code fRequestHandle = HttpOpenRequestA( fConnectHandle, "POST", url.c_str(), NULL, NULL, NULL, INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE, 0); is returning NULL with GetLastError() returning 122. A search suggests th...

Is there a faster way to retrieve System.Environment.UserName?

System.Environment.UserName internally calls [DllImport("advapi32.dll", CharSet=CharSet.Auto)] internal static extern bool GetUserName(StringBuilder lpBuffer, ref int nSize); Each call seems to hit AD, thus network latency and AD query effect speed of execution. Would you know if there is a better way to retrieve this value? Somethi...

Win32: Find what directory the running process EXE is stored in

I can find what directory the process is running in using GetCurrentDirectory(), but what about finding the directory the EXE resides in? ...

How to get a DLL loading process handle

Hi there, I'm trying to get the handle to the process which loaded a dll from the dll. My approach is: in DLL_PROCESS_ATTACH I call EnumWindows(EnumWindowsProc,NULL); my EnumWindowsProc implementation is the following: BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) { if(GetCurrentProcessId() == GetWindowThreadProcessId(hW...

How can I query remembered UNC connections similar to "net use"?

I understand how to retrieve the UNC path for a mapped drive from the registry (HKEY_CURRENT_USER\Network), but I also have a need to retrieve remote connections to network resources that were not mapped. For example, opening the 'Run' dialog and typing <\server0123\share$>. If I type "net use", I would see this mapping, but I have bee...

converting structures in c to pywin32?

i am trying to use TTM_GETTEXT via SendMessage using pywin32. the problem is, the structure of the lparam, which is where the text should be stored, has to be TOOLINFO, which is well documented in MSDN, but has no counterpart in pywin32. is there a way to create the same structure using python and pywin32? Edit: here's the code i came u...

Win32 API 2 child buttons of the main window are not getting the WM_MOUSEMOVE message

I have a window with 2 child buttons on it and I was originally trying to make their text change color when I hover over and out but when I put the MessageBox () in the WM_MOUSEMOVE message I found out that I stop getting message boxes when my cursor is on either of the buttons. MSDN says that WM_MOUSEMOVE is sent to the window that cont...