I'm writing a background application to copy files in a loop to a USB stick with the "Optimize for quick removal" policy set. However, if the stick is removed part way through this process (specifically in the WriteFile() call below, which returns ERROR FILE NOT FOUND) the application hangs, the drive is then permanently inaccessible fro...
I'm building a Delphi component to embed an SDL rendering surface on a VCL form. It works just fine as long as the form is on-screen at the moment that the SDL surface is created. Otherwise, it's not able to create any rendering textures.
I traced into the SDL code and ended up with the following function call, which fails (returns NUL...
I have a basic app written with ATL, using the wizard with VS2008. I have a treeview in the left side of the app. I see how to (painfully) add tree items. Question is how do I show a menu when the mouse is right clicked? How do I trap any click events on each item that could be selected?
...
Hi I'm creating a systabcontrol32 control with the TCS_SINGLELINE style when I resize my window so the tab won't fit an up-down control appears that should allow me to scroll so I can see all the tabs.
The thing is that the up-down buttons don't seem to work unless I add a the WS_HSCROLL property to the tab control witch makes it ugly ...
Given two file path strings with potentially different casing and slashes ('\' vs '/'), is there a quick way (that does not involve writing my own function) to normalize both paths to the same form, or at least to test them for equivalence?
I'm restricted to WinAPI and standard C++. All files are local.
...
Hi all,
Could someone shed some lights upon querying through wmi and win32.client objects?
Anytime i try to query throught win32.client object i get this error:
Error: '' object has no attribute 'UserName'
though, i know (wmic class "Win32_ComputerSystem", wmiexplorer etc.) the certain attribute belongs to the object i'm trying...
import mymodule, ctypes
#import pygame
foo = ctypes.cdll.MyDll.foo
print 'success'
if i uncomment the import pygame this fails with WindowsError: [Errno 182] The operating system cannot load %1. the stack frame is in ctypes python code, trying to load MyDll. win32 error code 182 is ERROR_INVALID_ORDINAL. if the pygame import is no...
//window is an HWND
LPWSTR path = new WCHAR[1024];
DWORD size = 1024;
GetWindowText(window, path, 1024);
HINSTANCE instance = (HINSTANCE)GetWindowLongPtr(window, GWLP_HINSTANCE);
QueryFullProcessImageName(instance, PROCESS_NAME_NATIVE, path, &size);
This code fails on the call to QueryFullProcessImageName(...) with an error code 6 ...
Say I wanted to do an anonymous login, would it be to blank strings.
"" ""
?
...
Is it possible to programmatically set such windows console parameters as its left-top desktop position, console font, fast insert and selection by mouse options, etc. ?
EDIT Unfortunately we can set some console parameters by invoking undocumented Windows API. For example: SetConsoleFont, GetConsoleFontInfo, GetNumberOfConsoleFonts fro...
I need to programatically create a directory that grants "Full Control" to the group "Everyone". If I use
CreateDirectory(path, NULL)
This will, according to the Win32 SDK documentation this will create a directory that inherits from its parent directory. I do not want to inherit the access rights of the parent directory I need to e...
I used to change the Form shape in VB 6.0 using the following code:
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVa...
How do you programmatically resize and move windows with Windows API?
The scenario is: I want to vertically tile two windows (80%/20% width proportions).
...
I have an application that aids people with disabilities. In order to work, it tracks the what window is currently in the foreground. Normally, I use this function to get process executable.
bool GetWindowProcessExe2(HWND hwnd, wxString& process_exe)
//LPTSTR buf, DWORD size)
{
DWORD result = 0;
DWORD pid = 0;
...
What Windows API functions are available to execute command prompt's functionality? For example, I like to execute dir command and want to show the output in GUI without using cmd.exe in Windows.
...
I am deep in the middle of troubleshooting some Windows API messaging problem and I find that Spy++ is not working anymore. It doesn't even work on Notepad. On some occasions, it brings up this message:
---------------------------
Microsoft Spy++
---------------------------
Spy++ has encountered a problem in the message hook. To preven...
How exactly would I make both of my monitors go to sleep, I want to write an application myself because I'd like to add certain functionality, and so far I can't find anything on MSDN relating to making your display go to sleep.
...
I have a modal dialog displayed with the main application window set as owner (as in dialog.ShowDialog(mainAppWindow)) and I would like to temporarily allow the user to interact with the main application window before returning to the modal dialog again.
How can I do this? I am using Windows Forms.
Edit: AutoCAD does this well.
...
I have an application that needs to run both on WinXP and Vista64. My program requires QueryFullProcessImageName() to work on Vista but not on XP.
I try to load QueryFullProcessImageName() (instead of linking statically) via the kernel32.dll so that the same executable can run on both WinXP and Vista. The code that loads it is:
//only ...
On a customer machine (WinXP SP2) to which I have no access, I have a Win32 EXE (unmanaged C++) that crashes on startup. I guess the best way to troubleshoot this is to obtain a (mini-)dump and analyze it later with windbg or similar.
Now, I would normally tell the customer to install Debugging Tools for Windows and run
cscript adplus....