winapi

Return value from execScript(IHTMLWindow2)

hi, What is the best way to get the return value from IHTMLWindow2::execScript? I found this link, http://social.msdn.microsoft.com/Forums/en/ieextensiondevelopment/thread/712db8ec-0ceb-4efa-afe3-590dc6bbb7bf, I haven't tried this, is this the right way? Regards Manoj ...

windows API: how expensive is it to call an API function?

Do calling an API function considered an expensive operation? (when comparing it to a function call which is part of my application) I understand that some API functions cause a leap to kernel mode but is it true for all of them? More specific: how expensive will it be to call GetThreadId function? ...

Programatically fire windows 7 touch and gesture events

Please let me know the answers to the following: Is it possible to programmatically fire the touch and gesture events of Windows 7? Is there any API? Is it possible to fire the event from a computer without touch screen? I am looking for something implemented or implementable in C# if possible. Any help will be much appreciated. Th...

Drawing lines in win32/GDI with a custom pen style?

I have a need to do some drawing using win32/GDI (Native, not .NET), and I've run into the following problem: I need to draw lines that are "styled." For example, in the attached image, the line marked "A" is a straight line as far as my application data is concerned, it just needs to be drawn with the additional zigzag as a style. Of c...

How can I remove a Windows directory without following junction points?

I have a Perl script that needs to delete a directory with all its contents. Sometimes this directory contains a junction point into another directory. If I rmtree() naively, the rmtree() call will also delete all the files inside the target folder of the junction. I'm looking for a way to not do that, and instead just remove the junctio...

Cleaning up after calling GetSystemMenu()

I'm using Florian's wrapper class to call GetSystemMenu() to add a custom menu item to the system menu for an application. I'm just curious as to whether there is any cleanup required for the handle returned by calling GetSystemMenu or the additional menu items. I don't see any mention of needing to call CloseHandle() or similar, so my ...

Get the issuing CA for a given certificate

Hi All, I have a variable of type PCCERT_CONTEXT which contains a certificate (this is actually the certificate of the digital signer of a given executable file.) I need to get the certificate or at least the name of the issuing CA. I've tried using CertOpenStore and WTHelperCertFindIssuerCertificate, but have had no success. I would ap...

How can I get the handle to a Canvas/PictureBox?

I am developing an application which uses the Math Input Panel that comes with Windows 7. The input panel allows users to draw math (using a pen or mouse device) and after recognizing the symbols it sends back MathML(xml). However, I need to get the image of the recognized math as well. I am able to get a window handle for the input pa...

How to draw something to the screen and have the underlying ui interactive

I seeking solution for Windows first. I need to add visual effects to screen image without breaking the interactivity of all and every controls, that are on this screen. The solution can be straightforward: 1. take a screenshot 2. show this screenshot in a separate window, above other windows 3. apply the effect to image, being shown ...

Message queuing solutions?

(Edited to try to explain better) We have an agent, written in C++ for Win32. It needs to periodically post information to a server. It must support disconnected operation. That is: the client doesn't always have a connection to the server. Note: This is for communication between an agent running on desktop PCs, to communicate with a s...

Closing the window delays if a mouse hook is set

If I set a low level mouse hook, WH_MOUSE_LL, when I click the [x] (Close) button the window delays ~500ms and then it disappears. Do you know what causes the delay? And, is there a way to fix it? (the window and the hook are created with direct calls to win32 api in C++) ...

MFC: Floating toolbar window not visible (WS_EX_TOOLWINDOW)

In a typical MFC C++ dialog, I want to dynamically create a floating ListBox (or other standard control) over the dialog, possible extending past the dialog's boundaries - so it can't be a simple child or it'll be clipped. Looking at something similar that works, I tried to achieve it but the window never appears when shown. In my .h f...

Checking if a file exists on a 64 bit Vista machine with a 32 bit program

So, I have a 32 bit program which needs to check if files exist. However, the locations (which can come from both shortcuts and the registry) often make use of Environment Strings. I use the ExpandEnvironmentStrings api to expand them, then check if the file exists. However, because it is a 32-bit application (note environmental strin...

Is there a posix SIGTERM alternative on Windows? - (A gentle kill for console application)

I have a console deamon that is runned by a GUI application. When the GUI application is terminated I'd like to stop the deamon as well. How can I do it in a gentle way on windows? On Linux I would just use SIGTERM is there a similar mechanism on windows for console applications? To provide a bit more details: the deamon app is writte...

How to verify that my orgainization signed a trusted windows binary ?

This is a followup question to question 1072540, 'WinVerifyTrust to check for a specific signature?'. I want to write a C++ function Lets call it 'TrustedByUs' of the form: bool TrustedByUs(std::string pathToBinary, std::string pathToPublicKey) The idea is that we give this function a path to a binary .dll or .exe file that has been ...

How to get current country name on Windows 95, NT 3.51

I want to get current country code for oldest Windows systems. I was using GetLocaleInfo() with LOCALE_ICOUNTRY flag, but then I've realized it returns wrong results (the same values for different countries), so I've tried LOCALE_SISO3166CTRYNAME which returns country code in ISO3166 standard 2 letters code (eg. 'US') http://www.iso.or...

How can I tell if another process has the active foreground window? (Win32 API vb.net)

The user32.dll provides functions to get the process id from a process executable name, and I can also obtain the active or foreground window that the user is working. Can I determine what windows the targeted process has opened? Otherwise, can I find out what details about the process that opened the foreground/active window? My code ...

Windows Peer to Peer Global_ Group without third party ipv6 tunnel

I have been trying to develop a peer to peer application that uses Micosoft's Peer to Peer Group library. Basing my work on the Creating a Group Chat Application acrticle on msdn. This works fine for local groups and will also work for global groups if I have a thrid party tunnel adapter installed such as the gogo6 client. However fro...

Identify a reboot

Is there any "Boot session ID" or (reliable) "Boot timestamp"? For an installation I need to detect that a scheduled reboot took place indeed. I guess I could do a dummy MoveFileEx() with MOVEFILE_DELAY_UNTIL_REBOOT, but i did hope for something easier. (We have to install a 3rd party package that sometimes behaves erratically after ...

Strange crash with WTSOpenServer on Windows 7 (Only in Delphi 2009/2010)

I am troubleshooting a problem with existing code that always worked fine (it's the Terminal Server unit from the Jedi Windows Security Library). After some investigation the problem part has been brought down to a call to WTSOpenServer: while true do begin hServer := WTSOpenServer(PChar('server')); WTSCloseServer(hServe...