winapi

MinGW doesn't seem to link against user32

OK. I've been trying to make a program I've been writing in Java be able to find out if the Windows desktop is locked by using JNI. I've succeed in getting JNI working, but the C code I was using at first wasn't returning the correct answer. I got some new code (from here on SO), changed it a little, but I'm having link errors. When li...

finding why a DLL is being loaded

I have a winxp process which has all sorts of dlls and static libs. One of our libs is calling ms debug dlls, I have a suspicion which one it is but want to prove it in a tool like Process Explorer. How can I get a tree of my process, to see exactly who is loading what modules? ...

Writing to user documents folder C++

Hi everyone, I'm trying to write some info to the user's documents folder (eg. C:\Documents and Settings\[userName]), but I can't seem to find out how to grab the path programmatically. Is there any way to do this? C++, not using .NET. Thanks! ...

simulate dialog exit

How would one use SendMessage() or PostMessage() function to close an application, given that the appropriate window handle is retrieved? Thanks in advance. ...

tutorials about WinAPI unicode?

Hi, I'm wondering if you guys are aware of any article of some sort that shows how to make code fully unicode? Reason I ask is because I'm dealing with winapi right now and it seems that everything's supposed to be unicode like L"blabla" .. Functions that I've encountered won't work properly by simply using the standard string for examp...

How to verify if a window of another program is minimized?

How can I do this? I've tried IsWindowVisible() but that doesn't seem to do the job. ...

Is there a way to verify that the current window of another program is totally visible?

Is there any function, or I'll have to iterate through all windows that are in front of mine and detect if they overlap my window? Thanks ...

Problem in using WaitForSingleObject on 64bit OS

Hi! I am using WaitForSingleObject from (kernel32.dll) in my program. It is working fine on 32bit Windows XP, but when I use it on 64bit WindowsXP, it is not working. The problem is that it doesn't wait for the process and control moves forward. Does anyone have any idea on why? Is there any replacement for that method in WinXP 6...

Atl71.dll denpendency still exists even Static link to ATL is selected

I already spent whole day to trouble shoot this problem, but no luck yet. In my project, I set the Use of ATL property to Static Link to ATL on the General property page and set the Runtime Library property to Multi-threaded (/MT) on the Code Generation property page (C/C++ folder). However DependencyWalker still shows Atl71.dll dependen...

How to detect what was the PE packer used on the given exe?

Hi, I've found an application which seems to be packed. I opened it with some hex editor and it contains "UPX1" section and "3.00 UPX!" string. Unfortunately I'm not able to decompress it with upx latest, it says "not packed by UPX". Is there a way to find out what other PE compressors/crypters were used? ...

DWORD_PTR, INT_PTR, LONG_PTR, UINT_PTR, ULONG_PTR When, How and Why?

Hello I found that Windows has some new Windows Data Types DWORD_PTR, INT_PTR, LONG_PTR, UINT_PTR, ULONG_PTR can you tell me when, how and why to use them? ...

Printing the value of a float to 2 decimal places

I have a float with the value of e.g 57.400002. I use sprintf_s to display the value on my GUI. sprintf_s(xPosition, 19, "%f", xPositionValue); How can I format the float so it displays as 57.40? ...

How to check what connections a given process has created to the internet

I mean, if you use tools like NetLimiter, they let you know that a given process that connections to IP1, IP2, etc. I am using packet sniffing for my application, but I only need to packet sniff one application, so I'd like to know to what ip addresses that application is connected. Any easy way to do this? I am using a wrapper for WinPC...

Peter Below's Threaded Splash Screen and Modal Dialogs

I'm using Peter Below's PBThreadedSplashForm to display during application startup. It gets updated as various databases are opened during the creation of the data module (just before the main form is created). The problem is that we have a check for the existence of certain things that is done during the creation of the data module. If...

What exactly is the risk when using TerminateProcess?

My Win32 console applicaton uses a third-party library. After it exits WinMain global objects destruction begins and an AV happens somewhere deep inside. I'm really tempted to just write TerminateProcess( GetCurrentProcess(), 0 ); somewhere near the end of WinMain. If I do this the application ends gracefully. But MSDN says that doin...

How can different instances of the same form class use different window class styles?

Hi, I try to use the following technique in order to enable/disable the shadow effect for a window: (The CreateParams is of course overriden. The TToolWindow descends from TForm). procedure TToolWindow.CreateParams(var Params: TCreateParams); var LShadow: boolean; begin inherited; if (Win32Platform = VER_PLATFORM_WIN32_NT) ...

How to Create a Bitmap Programmatically?

I'd like to create programmatically a random X height and Y width bitmap file. The content, for me, is irrelevant. It could be all white, empty. What is important is the dimension. How to do it using Windows API? ...

CListCtrl WM_TIMER event ids 42 and 43?

I have a CListCtrl derived class that provides subitem editing by creating a CEdit starting at the correct offset of the subitem. Sometimes the subitem is only partially visible so I scroll the CListCtrl to the offset location to gain more space for the CEdit. Now something very weird happens: On Windows Vista and Windows 7 the CListCtr...

win32 : Get the state of an event object.

I'm creating 3 events with the following function: HANDLE WINAPI CreateEvent(...); I'm waiting on all (bWaitAll is set to TRUE) event objects or a timeout with: DWORD WINAPI WaitForMultipleObjects(...); The return value is: WAIT_TIMEOUT Is there an easy way to check each event to find the one(s) that was(where) not set? As an e...

GetHostByAddr() win32

Hi All, I am giving an IP Address : 64.78.58.91 and i would like to retrieve the hostname using GetHostByAddr() win32 API. Instead of returning www.ripcode.com it returns intermedia.net I would expect to get www.ripcode.com Can you suggest a Different API which could solve this problem. Thanks in Advance Best Regards, Suren ...