winapi

Extract cursor image in Java

I was wondering if there is a way to extract an Image object from a Cursor object in Java. A use for this would be for instance : Image img = extractCursorImage(Cursor.getDefaultCursor()); Which you then can draw on a toolbar button (that's the purpose I want it for). ...

Whats a better way to write this function. Its gets a remote file and copys it localy, in php.

So yea, im working on a windows system and while this works locally, know it will break on other peoples servers. Whats a cross platform way to do the same as this function fetch($get,$put){ file_put_contents($put,file_get_contents($get)); } ...

How can I set a foreground window if SetForegroundWindow and ShowWindowAsync doesn't work ?

It a is a c# winform app. I've set ShowInTaskbar prop to false because I don't want the program to appear in taskbar, but like this SetForegroundWindow or ShowWindowAsync don't work. ...

About the MSDN Documentation on NOTIFYICONDATA's cbSize member

I am reading the NOTIFYICONDATA documentation in MSDN. It says the NOTIFYICONDATA structure has a cbSize member should be set to the size of the structure, but NOTIFYICONDATA structure's size has different size in every Shell32.dll, so you should get the Shell32.dll version before setting cbSize. The following quotes from MSDN: If i...

How to install a utility manager application that it can run on the secure desktop?

I tried to write a Utility Manager application, and I am trying to test it on WinXP SP3. I added it to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Accessibility\Utility Manager, and it works well when loading the utility manager when I am logged in. However, when I try to load it from Utility Manager at startup befo...

How to list available video modes using C#?

I've found nice examples using C++ (http://www.codeproject.com/KB/tips/resswitch.aspx), but not in C#. Can someone help, please? Edit: The exact function that list the video modes is: BOOL CVideoModes::GetAvailableVideoModes(CAvailableVideoModes& modes) { modes.SetSize(0, 5); int i=0; DEVMODE dm; while (EnumDisplaySettings(NU...

Windows pointer bitmap not being correctly updated

So, I'm writing a text editor, using MDI. I have a frame window, child windows and each child window has a text-area window. Now, my problem is the pointer. It's not setting itself to the correct bitmap. So for example, if I move the pointer to the border, it correctly turns into the left-right drag icon. That's all good and well - ...

Using layered windows to create smooth window borders

We are developing a skinned app with various rounded edges on most of its windows. I am using window regions to define non-rectangular shapes, but nearly everyone objects to the jagged aliasing this causes, because pixels can only be either fully opaque or fully transparent. I've come up with a solution to this using layered windows, b...

What is the best way to get all Windows startup processes using Windows API?

I know there are startup folders and certain registry keys I need to look into. But how to do that using Windows API? I'm interested to know for Windows XP and Vista. Thanks for your time. ...

How to attach a winforms dialog to an existing toolbar/menubar (compiled C++ app)?

To attach a winforms dialog on Microsoft Wordpad toolbar/menubar? ...

Programatically determining file "size on disk" in advance

I need to know how big a given in-memory buffer will be as an on-disk (usb stick) file before I write it. I know that unless the size falls on the block size boundary, its likely to get rounded up, e.g. a 1 byte file takes up 4096 bytes on-disk. I'm currently doing this using GetDiskFreeSpace() to work out the disk block size, then using...

Avoid Re-initialization of Critical Section

Exact Duplicate Initialize Critical Section only once for a process I have a dll that creates a global critical section, initializes and use it. Now a third party application is using / loading the dll more than once which leads to a heap corruption. The appverifier warns me with a --> VERIFIER STOP 00000211: pid 0x1470: Critic...

Problem clearing Listview Header image on Vista

I'm having a problem on Vista with the Listview control, in particular setting custom icons on the header. Normally under XP or any of the previous version of Windows, if I added an icon (in C++), I could do so with the following: HeaderItem.mask = HDI_FORMAT | HDI_IMAGE; Header_GetItem(HeaderHWND, Column, &HeaderItem); TurnOn(Hea...

Win32 Overlapped I/O - Completion routines or WaitForMultipleObjects ?

I'm wondering which approach is faster and why ? While writing a Win32 server I have read a lot about the Completion Ports and the Overlapped I/O, but I have not read anything to suggest which set of API's yields the best results in the server. Should I use completion routines, or should I use the WaitForMultipleObjects API and why ? ...

In Delphi, how can you check if an IInterface reference implements a derived but not explicitly-supported interface?

If I have the following interfaces and a class that implements them - IBase = Interface ['{82F1F81A-A408-448B-A194-DCED9A7E4FF7}'] End; IDerived = Interface(IBase) ['{A0313EBE-C50D-4857-B324-8C0670C8252A}'] End; TImplementation = Class(TInterfacedObject, IDerived) End; The following code prints 'Bad!' - Procedure Test; Var A : ...

COM API - could not pass "NULL" for a pointer argument

I have a COM API foo, the IDL looks like: foo([in] unsigned long ulSize, [in, size_is(ulSize)] unsigned char* pData) when I consume this function with foo(0,NULL); I get an error - NULL argument passed. Is there a way to workaround this? ...

Reading/Writing machine code

I am not well acquainted to the compiler magic. The act of transforming human-readable code (or the not really readable Assembly instructions) into machine code is, for me, rocket science combined with sorcery. I will narrow down the subject of this question to Win32 executables (.exe). When I open these files up in a specialised viewer...

Is there an API event for when person changes clock on Windows?

I was wondering if there's some sort of system event that gets fired every time a user changes the time in Windows. I know there's a way to enable this in Windows' EventLog, but I was looking for a way to respond to this event programatically (like using the Windows API). ...

Determine if device is connected/disconnected to RS232 port without opening the port

I"m working on a C++ Win32 application for which I'm trying to essentially "auto detect" if a device has been plugged into one of the RS232 ports and then if it has been disconnected. The checking for a connected device is easy enough because my use case allows me to assume that this particular thread will be the first to try to initiat...

Value of a variable using WinDbg

Question: How to display the value of a C++ iterator using WinDbg, illustrated below: for (vector<string>::iterator i = args.begin(); i != args.end(); i++) //omitted //for instance: } else if (*i == "-i") {//attempting to display the value of *i ++i; if (!::PathFileExistsA(i->c_str())) { Note: Using ?? evaluate C++ expression ...