winapi

Sending name/value pairs using HttpOpenRequest and HttpSendRequest

I am using HttpOpenRequest to send data of the form /path?data=xyzzy. However xyzzy can be very large, 100s of k at times, and on certain machines HttpOpenRequest fails with error 122 (ERROR_INSUFFICIENT_BUFFER) According to Microsoft kb 208427 the Maximum URL length is 2,083 characters in Internet Explorer but it also states 'However...

Is it possible to block ExitWindows or ExitWindowsEx?

I'm using a corporate workstation, and my IT department keeps using programs to restart my PC without my permission. I've asked them to stop, but they don't how how - typical. Anyway, I figured there must be a way of preventing (malicious?) programs like these from restarting my PC... So how about preventing ExitWindows or ExitWindowsEx...

comint-previous-matching-input in emacsw32 is not interactive

I have been using emacsw32 for a year or so, and I never even realized that meta+r is supposed to be interactive and show hits right away! This works in the unpatched emacsw32 client (which is also much newer, btw). Wondering if anyone knows why this is? Is it the patching breaking it or is it the older emacs? Its not very old though, s...

How to make clone or extended mode

Hi friends, I am having multiple monitors(virtual+real) and by default I wanted to put it in clone/dual mode from my program. Can some one suggest how do I achieve this? I am very new to this world:) sorry for this basic question.... even any doc or any link will be highly appreciable. /sarbojit ...

Get notifications of new threads / deleted threads under Windows

When you create a DLL you can get notifications about new threads / exiting threads in the DllMain function (DLL_THREAD_ATTACH/DLL_THREAD_DETACH). Is there a way to get these or equivalent notifications from Windows within an (non managed) Executable? ...

Win32 - Fullscreen popup menu temperamental activation

Using C++ in VS2008, I'm at the beginnings of a DirectX program which can so far display a token image and flip between fullscreen and windowed mode with no problems. It has a menu bar, which is invisible as expected in fullscreen mode. The ALT key could still activate this menu in fullscreen, but it was very clumsy since its items wer...

How do I get the URL of the visible tab in Firefox/IE/Chrome?

No, this is not a send me teh codez request. I am writing a small utility for my own amusement. In this regard, I need the utility to read the URL from the visible/active tab on any of the three browsers (Firefox, IE, Chrome) that are currently open, and then go off and do something with that URL. I am assuming I'll need to PInvoke for...

Using WM_SHOWWINDOW to Show a Window instead of ShowWindow()

Hi, I’m trying to use the SendMessage function of a hotkey utility (or NirCMD, etc.) to get a hidden window to pop up. I can for example get windows to close by sending 0x0010 (WM_CLOSE), but when I try sending 0x0018 (WM_SHOWWINDOW) with a wParam of 1 and an lParam of 0, nothing happens. I’ve looked around, and the few places where so...

Not receiving WM_NCHitTest on title bar

I noticed that the message WM_NCHitTest isn't sent to a form when the cursor is inside the caption bar (not on the border). I tried to intercept it using either procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; or procedure WndProc(var Message: TMessage); override; According to MSDN I was expecting to receive...

c++ vectors causing break in my game

my works like this i shot airplanes and if the shot toughed an airplane it change there positions(airplane and the shot) than it will delete them. if i toughed an airplane the airplane position gets changed. than it gets deleted than my health reduces. well that works well expect that it breaks when i have about 2-4 airplanes left and i ...

EM_GETLINE error C++ Get last Line from Textbox

Hello ! I'm having a minor problem with EM_GETLINE. I have a textbox I want to extract the text from. The box keeps updating all the time (it's a log file thet keeps updating, last message at the bottom). All I want is that very last line. My code: HWND hwnd = (HWND)0x00020A72; TCHAR param[1000]; char display[1000]; LONG lR...

How to draw glowing text on StatusStrip with DrawThemeTextEx?

Hi, I'm trying to draw aero-styled glowing text in a .NET StatusStrip with a DrawThemeTextEx class I found. This is my current code which I use as a renderer for the StatusStrip: Class GlassStatusRenderer Inherits System.Windows.Forms.ToolStripProfessionalRenderer Protected Overrides Sub OnRenderToolStripBackground(ByVal e As System.Wi...

[C++] Uniquely identify PC based on software/hardware

For a requirement to generate per-PC license keys, I need some code which will return a stable and (near) unique key on any PC. It doesn't have to be guaranteed unique, but close. It does need to be reasonably stable though, so that a given PC always generates the same result unless the hardware is substantially changed. This is for a W...

how to open new console window using Ansi C?

hello every body i am beginner in Anci c programming here is the description for my program my program first asks user to press any key then a new console is opened and the user inputs any number he want then the console is closed and the number he typed is printed in the parent console ,i hope this clear and thanks for reply so i wa...

Setting background color of Win32 dialog button (not owner-drawn)

Is it possible to set the background color of a dialog button in Win32 without using an owner-drawn button? The following paints the background of every dialog item except the buttons (not owner-drawn): case WM_CTLCOLOREDIT: case WM_CTLCOLORSTATIC: case WM_CTLCOLORBTN: HDC hdcStatic = (HDC)wParam; SetBkColor(hdcStatic, bgEditC...

Win API Interlocked operations for 32-bit int type

If we have: __int32 some_var = 0; What is the best (if any) way to call InterlockedExchange, InterlockedIncrement and other interlocked functions which require LONG* for some_var ? Since, there is guarantee that LONG is 32 bit on any Windows, it's probably safe just to pass (long*) some_var. However, it seems to me quite ugly and I c...

Slow shared memory performance when moved to 64-bit OS

I am having an issue with a 32-bit legacy app running on 64-bit windows. The app in question uses CreateFileMapping to create shared memory. When this is run on 64-bit Windows any attempt to access this shared memory from another process takes about 1 second. The shared memory is created using page protection flags: flProtect = PAGE_REA...

RegisterClass failed: class already exits

When I create a child window for the second time, if (!::RegisterClass(&hwClass)) { throw std::runtime_error("RegisterClass failed!"); } It throws an exception that the class already exists. but the child window class was deleted when the child window was destroyed at: WM_DESTROY: { delete this; //destroy child class } It w...

Can a child thread of parent GUI dialog thread create a child window?

Can you create a child window from a secondary child thread or it must be created from GUI thread? Assuming the life time of child thread is until the end of program. ...

C++ game trainer process monitoring

I am going to open game process from my trainer app and write some values to memory. I have no problems with opening a process and writing a value to memory. But I can't realize how to monitor the game process availability. For example I opened a running process, user closed it and opened again. How can I track this in my code? OpenProce...