winapi

Catching WM_LBUTTONDOWN on a label?

For some reason I can't seem to catch the WM_LBUTTONDOWN event on a label ("STATIC" window). When monitoring with Winspector it appears the message always arrives to the parent window. However, according to the docs, the message should be posted to the Window beneath the cursor. Does anyknow have an idea why the message does not arrive...

Ctrl+- (Ctrl+Hyphen-Minus) as ShortCut Key?

It might seem natural to use Ctrl++, Ctrl+-, and Ctrl+0 as shortcuts for an application's zoom in, zoom out, and restore default zoom (typically 100 %) actions. Now, in Delphi, I am able to assign Ctrl++ and Ctrl+0 as shortcuts. The former, though, requires that the plus sign of the main part of the keyboard is used; the plus sign of the...

BackupWrite() and BackupRead() in Win32

My understanding is that these functions can be used to serialize a file for backing up and restoring. I'm unclear what they serialize. For example, do they serialize the file attributes (hidden, readonly, etc)? What about the 8.3 name? I do believe they serialize all the file's streams and security options. But what happens when re...

Causing another application to copy data to clipboard

I'm trying to programmatically make an external WinForms application copy its data to the clipboard, and it's driving me crazy. Since pressing Ctrl-C in the application does the right thing, I've been trying to send ctrl-c using my C# application to the other application. Here is my sequence of commands. I compared the messages using S...

How to simulate Keyboard Events in Code in not active window?

How to simulate Keyboard Events in Code in not active window? How to use SendWait() without SetForegroundWindow()? SendWait example: http://msdn.microsoft.com/en-us/library/ms171548.aspx ...

is there a way to remove FILE_FLAG_DELETE_ON_CLOSE?

in my app I'd like to open a temp file with FILE_FLAG_DELETE_ON_CLOSE. however there are some cases where the temp file needs to be kept and is quite large I'd like to remove the FILE_FLAG_DELETE_ON_CLOSE attribute on an opened handle? is this possible? copying the contents of the file or renaming isnt quite what I want, I'd like to...

window api for smtps

is there any windows api that can send mail using smtp along with attachment. I have heard its not possible,and i have to use other socket methods,if its true how can I do that?? please suggest c++ or c solution only,no c# or java(like system.net.mail etc) ...

C# Windows API Code Pack

I'm using Visual Studio 2010 Express for C# and am having trouble installing the code pack. I downloaded the source from MSDN and don't know what to do with it? I opened the WindowsAPICodePack.sln and attempted to build the project and got: Error 16 The type or namespace name 'ContentPropertyAttribute' could not be found (are you m...

Using WSASend & WSARecv to transfer binary data

I tried the MSDN code edited that, but still the problem is that when I send 271 bytes data, my WSARecv() shows me 542 byte data, which is just duplicate copy. How can I overcome this problem? http://msdn.microsoft.com/en-us/library/ms741688(v=VS.85).aspx http://msdn.microsoft.com/en-us/library/ms742203(v=VS.85).aspx ...

Cannot Convert struct** to const POINT* for argument?

hi everyone im using winapi and i want to do a square in 3d im defining the points to unite them with a function and ive been trying 3 functions but i cant make them work i get the same error in the 3 of em >.< The Error says In member function `void Cube::Show(void)':| cannot convert `const Cube::Show()::POINT3D**' to `const POIN...

How to map Win32 types to C# types when using P/Invoke?

I am trying to do something like this in C#. I found out how to call Win32 methods from C# using P/Invoke from this link. However I met some difficulties in implementing P/Invoke. For example, one of the methods that I would like to access is PdhOpenQuery, signature: PDH_STATUS PdhOpenQuery( __in LPCTSTR szDataSource, __in DWO...

Fully qualified path Vs. Canonical Path.

There is a canonical path concept in Java. And there is a fully-qualified path in WinApi. I know well what canonical path is, but I don't understand fully-qualified path's concepts. For a file or directory, does fully-qulified path exist only one thing? -like canonical path. Are both of them totally same concepts? Edit: One more thin...

WriteFile error #5 "denied access" under win Vista/seven

I googled a lot and I couldn't find any answer to this problem... I have a C++ console application that reads a 1GB SD card that fixes improperly closed files and writes the FAT table accordingly. The SD card is written at the beginning by a firmware in a custom made device. It worked OK up to Xp and stopped working in Win Vista/seven....

LookupAccountSid taking +600 ms per call

I'm using GetTokenInformation with the TokenGroups flags to retrieve all the groups that a particular token is part of. I'm then looping through each of the returned SIDs and using LookupAccountSid to grab the user name and domain. I call LookupAccountSid twice: the first time to grab the size of the name and domain character arrays and ...

Is it possible to avoid static or global variables in dialog functions

If one needs some sort of state in a dialog function, it seems you need some sort of static variable. For example, the hook procedure for GetOpenFileName provides the dialog function with the address of the OPENFILENAME structure on its WM_INITDIALOG call but not on any subsequent calls and the OPENFILENAME structure contains a place fo...

Grid of 30 x 30 buttons

I'm making a grid of 30 x 30 buttons with BS_BITMAP representing some numeric value which can be set by clicking on buttons. so should I go creating 900 buttons on a window and or GDI would help to do something same? Any ideas on setting a row of some column in a grid to some values? would I need a multidimensional array of window handl...

Is there a way to directly query the file system device driver for listing out the files in a directory ?

Hi, I'm currently using FindFirstFile, FindNextFile API to recursively iterate through directories for searching files based on a given criteria. I noticed that "dir /s" command gives better performance than my program. I'm tried checking out the events in process monitor and it looks like cmd.exe/dir command is directly querying the di...

How to find out swap space usage on windows

I want to monitore swap space usage on windows 2003 server. If the usage is over 80% for 10 minutes, an alarm will be generated. There are lot of tools for RAM, but how about swap usage? How do I simulate that condition and do the test? ...

c++ gdi image array

im trying to make an array of images Image something(L"something.png"); instead of that Image something[2]; something[0]=(L"something.png"); any idea ...

Why Does CascadeWindows win32 function throws an AccessViolationException on windows 7

Private Declare Function CascadeWindowsNative Lib "user32" Alias "CascadeWindows" ( _ ByVal hwndParent As Long, _ ByVal wHow As Long, _ ByVal lpRect As Long, _ ByVal cKids As Long, _ ByVal lpkids As Long) As Integer calling: CascadeWindowsNative(Nothing, &H4, 0, 0, 0) ...