winapi

In threads, WaitForMultipleObjects never returns if set to INFINITE

Let say I have three thread handles HandleList[0] = hThread1; HandleList[1] = hThread2; HandleList[2] = hThread3; /*All the above are of type HANDLE*/ Before closing the application, I want the thread to get its task done. So I want to make app wait till thread completes. So I do, WaitForMultipleObjects(3, HandleList, TRUE, INFINITE...

Browse for folder can't see camera device

In Delphi 2010, I want to allow users to browse and select a folder. The folder is on a device (?) created by a DSLR: The folder is visible in the Windows Explorer as shown above. And, the folder is visible in a TOpenDialog, allowing them to browse into the folder and choose a file. Unfortunately, I have been unable to get either S...

get a text from the error code returns from the GetLastError() function

Hi, I need to get the text of an error code that i got from the GetLastError function. I saw a few examples but i want a function that get the code and return the string. Thank's you all ...

IOCTL_MOUNTMGR_QUERY_POINTS

Dear all, when i include #include to use the IOCTL_MOUNTMGR_QUERY_POINTS i get the below error fatal error C1083: Cannot open include file: Mountmgr.h: No such file or directory How can i solve this error. Please guide me ...

keyboard layout direction

hi, I would like to detect the direction of the current typing (input) language. I may detect the language by means of "GetKeyboardLayout", but then I'll have to check if it equals to Arabic or Hebrew and so on, is there any way just to detect the direction, i.e. left to right or right to left. thanks! mike. ...

Manually create a dialog child window using an ID from resource.h

I want to add a simple panel to a dialog created using Visual Studio resource editor, but the resource editor doesn't allow this - I need to add my own CWnd as a dialog child. However that way I think I have to use CWnd::Create manually, and pass in names for the class and the window. I want to create an ID like IDC_MYPANEL, and as much...

Is it possible to allow a legacy Win32 GUI app to be run from command line as well?

We have some code that works and it's a Win32 app with a GUI, but I would like to be able to trigger it from the command line as well (silent mode). Is there any easy way to do this? Or do I have to create another project as a command line application? ...

What does WIX's CloseApplication functionality do and how would can the application respond to such a signal

In the WIX setup I've got, when upgrading the application I have set a requirement to close down applications which might hold on to files which needs to be updated: <util:CloseApplication Id="CloseMyApp" Target="[MyAppExe]" CloseMessage="yes" Description="!(loc.MyAppStillRunning)" RebootPrompt="no" ElevatedClos...

Hardcoding the resources in application

Hello! I have some code which shows a simple dialog box and handles user action (written using plain WinAPI). // Display dialog and handle user action LRESULT choice = DialogBoxParam(NULL, MAKEINTRESOURCE(AP_IDD_DIALOG), NULL, (DLGPROC)DialogCallback, NULL); Is there any way to hardcode the resource file dialog.rc, which is used to ...

How do I patch a Windows API at runtime so that it to returns 0 in x64?

In x86, I get the function address using GetProcAddress() and write a simple XOR EAX,EAX; RET 4; in it. Simple and effective. How do I do the same in x64? bool DisableSetUnhandledExceptionFilter() { const BYTE PatchBytes[5] = { 0x33, 0xC0, 0xC2, 0x04, 0x00 }; // XOR EAX,EAX; RET 4; // Obtain the address of SetUnhandledExceptionFilt...

Help with GetGlyphOutline function(WinAPI)

I want to use this function to get contours and within these contours, I want to get cubic bezier. I think I have to call it with GGO_BEZIER. What puzzles me is how the return buffer works. "A glyph outline is returned as a series of one or more contours defined by a TTPOLYGONHEADER structure followed by one or more curves. Eac...

Getting Types in Win32 Dll

Hello, I want to know the types and details in a plain Win32DLL just like we can get in case of COM.In COM every thing embed inside idl and results in TLB, here we get every thing , MSFT exposes APIS by which we can extract types. In case of Win32 I strongly needed types defined in it and all details of that type(e.g what are members i...

How to create combobox with bitmaps in Win32 ?

Hi ! I wanted to create a custom combo box like this (as in MS Word), Are there any Win32 API calls (I can't use MFC) to get this job done, (like ChooseColor() or ChooseFont()? If there aren't any, can anyone please tell me how to do this? Thanks you. Regards, EDIT: Creating the Owner-Drawn Dialog Box!! Is this the only way ? http:...

Using IOCTL_MOUNTMGR_QUERY_POINTS

Dear all, I am not able to know how to use the IOCTL_MOUNTMGR_QUERY_POINTS . I have searched the internet and found some sample code to try with. but i am not sure whether its correct or not.... can you please let me know how to use the IOCTL_MOUNTMGR_QUERY_POINTS to get the drive letter Thank you for your time below is my source c...

How to get PIDs that are using given file name in C#?

How to get PIDs of processes that are using a given file name and mutex name? (Not by custom kernel driver, but in C# in user mode.) UPDATE: Thanks to Daniel Renshaw I found a script that lists all handles with PIDs. (Using a not undocumented and unfrozen functions.) ...

Pin to taskbar event in Window 7

Is there a way to handle "Pin this program to taskbar" user action in the code? Is there such an event in Taskbar API? My search didn't give any results. The reason behind this: my X.exe is launched through some other Y.exe executable, and if user clicks 'Pin' while Y.exe is running, I want to change this shortcut to the actual X.exe. ...

SetWindowPos has not effect on tooltip

Hello, I am trying to give my ComboBox an in place tooltip for long strings. However when I call SetWindowPos on the tooltip, the position is never changed. Called when TTN_SHOW is received: ::SetWindowPos(textTooltip, NULL, TipRect.left, TipRect.top, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER); If I remove the SWP_NOSIZE flag ...

Windows Structured Exception Handling: simple test program will not compile.

#include <windows.h> int main() { int* i = (int*)malloc(sizeof(int)); *i = 5; __try { free(i); free(i); } __except { return -1; } return 0; } I am trying to learn more about windows SEH. My first test program is giving me some real trouble. I have looked at the msdn documenta...

How does one hide a win32 app window?

I want to run the app in silent mode by passing in a parameter, otherwise I will show the window. ...

Given Date, Get Day of Week - SYSTEMTIME

Is it possible to determine the day of the week, using SYSTEMTIME, if a date (month-day-year) is provided or is this structure one-way only? What is the most lightweight way to accomplish what I am asking if SYSTEMTIME cannot do it (using Win32)? ...