winapi

How to ask Windows to open an external file based on file association?

Using Win32-specific APIs, is there an easy way to start an external application to open a file simply by passing in the path/name of the file? For example, say I have a file called C:\tmp\image.jpg. Is there a single API that I can call to tell Windows to open the application associated with .jpg files? Without having to do a bunch o...

VB 6.0 system tray application doesn't close gracefully when Windows shuts down

Hi I'm using the following code within a VB 6.0 application to allow give the application a system tray icon: Option Explicit 'user defined type required by Shell_NotifyIcon API call Public Type NOTIFYICONDATA cbSize As Long hwnd As Long uId As Long uFlags As Long uCallBackMessage As Long hIcon As Long szTip As St...

Using Win32 API in Qt OSE project

It is a messy question, hopefully you can figure out what I want :) What is the best way to use Win32 functionality in a Qt Open Source Edition project? Currently I have included the necessary Windows SDK libraries and include directories to qmake project file by hand. It works fine on a small scale, but its inconvenient and cumbersome...

Deallocation doesn't free mem. in Windows/C++ Application

Hi, My Windows/C++ application allocates ~1Gb of data in memory with the new operator and processes this data. The data is deleted after processing. I noticed that if I run the processing again without exiting the application, the second call to "new" operator to allocate ~1gb of data fails. I would expect Windows to deliver back the ...

setting the lineend styles for Canvas.LineTo

Is there any way to set the style for the lineends for the TCanvas.LineTo method? It seems to default to rounded ends, which looks very bad for several lines in a row of different colours when Pen.Width is set to a large value (e.g. 9). It looks like this (rounded ends): ********........****** **********........****** **********.........

Detecting multiple logged on users via win32

Using the standard win32 api, what's the best way to detect more than one user is logged on? I have an upgrade to our software product that can't be run when more than one user is logged in. (I know this is something to be avoided because of its annoyance factor, but the product is very complicated. You'll have to trust me when I say ...

P/Invoke to correct version of Win32 DLL?

I've got some P/Invoke code that invokes DBGHELP.DLL. I'll add the signatures to pinvoke.net later. The version of DBGHELP.DLL that ships with Windows 2003 is too old, and my code requires the version of DBGHELP.DLL that shipped with "Debugging Tools for Windows" version 6.9. How do I do one of the following? Ensure that DllImport re...

DLGTEMPLATE to CWnd-derived control

Is it possible to take a DLGTEMPLATE and use it as a CWnd-derived control for placing in any other CWnd? I have a dialog template that I want to use on one of my CDockablePanes ...

Reenable (windows)keys after another program has disabled it

Quake3 has disabled the alt and windows keys. Is there any way to reenable them even while quake3 is running? I need those keys even while i have the game open. They way i think it works is that the game registers a hotkey using RegisterHotKey and then set the handled property to true every time the key is pressed. So if you use UnRegis...

WinInet: timeout management in FTP put

Hi All, My program puts a file into a remote host using HTTP. For some unavoidable reasons, the remote hosts needs some time to acknowledge the final packet of the data transmission. More time than the default timeout, which according to my experience is around 30 seconds. Therefore I wanted to increase the timeout to 5 minutes, usin...

Is there a Windows API hook for "this application wants attention"?

In Windows XP, when a program wants the user's attention, it'll flash its taskbar button orange. Anyone with an IM program is probably familiar with this behavior. But when I'm playing a fullscreen-mode game, I don't see that, and messages go unanswered. Now I'm writing a game engine of my own, and I'd like to be kind to my users. Is...

Secondary Message Loop vs Separate Input Thread

I am talking about a Windows desktop application. I am looking to write a function such as SelectObject (for example) which blocks the caller till the user clicks on an object in the application's client area. Once the user has selected an object, the function returns a pointer to it. One way to do this is to run a small message loop an...

Create modified HFONT from HFONT

I using the Win32 API and C/C++. I have a HFONT and want to use it to create a new HFONT. The new font should use the exact same font metrics except that it should be bold. Something like: HFONT CreateBoldFont(HFONT hFont) { LOGFONT lf; GetLogicalFont(hFont, &lf); lf.lfWeight = FW_BOLD; return CreateFontIndirect(&lf); } ...

What API call would I use to change brightness of laptop (.NET)?

I have Windows Server 2008 installed on a Sony laptop and the brightness control doesn't work. I'd like to write a program to allow me to change it. Currently what I have to do is open the Power control panel, click advanced settings, and fight through so many UAC boxes that anybody watching me must think I'm completely crazy. I just w...

Is char* supported on Chinese / Japanese machines?

Hi, I am trying to create a DLL for authentication using Java and JNI. To create the DLL, I have created a Win32 application whose Character Set and Runtime Library information are Multi-Byte String and Multi-threaded (/MT) respectively. I have tested the DLL on WinXP with valid and invalid user credentials. Both work fine. I need t...

How can I get BerkeleyDB for ActivePerl 5.10?

I'm trying to find out where a BerkeleyDB PPM is for ActivePerl 5.10. Anyone have a clue where to find this, or how to build it? I had found a lead here. They claim BerkeleyDB 0.33 had built ok for Perl 5.10. They provide a link to the PPM, but not to the supporting zip file. So I got around it, manually getting the ppm and the zip and ...

Building both DLL and static libs from the same project

I have a number of native C++ libraries (Win32, without MFC) compiling under Visual Studio 2005, and used in a number of solutions. I'd like to be able to choose to compile and link them as either static libraries or DLLs, depending on the needs of the particular solution in which I'm using them. What's the best way to do this? I've...

What does CreateFile("CONIN$" ..) do?

I was hacking away the source code for plink to make it compatible with unison. If you don't know, unison is a file synchronization tool, it runs an "ssh" command to connect to a remote server, but there's no ssh.exe for windows; there's plink, which is very close but not close enough (it doesn't behave like unison expects it to), so pe...

How to grab parent process standard output?

I'm writing an utility (http://reg2run.sf.net) which in case execution without arguments works as windows application (shows OpenFileDialog, etc), otherwise - as console application. So, in first case I don't want to show a console window, that's why project is Windows Application. But in second - I need to show it, and it's created wit...

Win32: IProgressDialog will not disappear until you mouse over it.

i'm using the Win32 progress dialog. The damnest thing is that when i call: progressDialog.StopProgressDialog(); it doesn't disappear. It stays on screen until the user moves her mouse over it - then it suddenly disappers. The call to StopProgressDialog returns right away (i.e. it's not a synchronous call). i can prove this by doing...