winapi

WIn32 Help with SwitchToThisWindow, ShowWindow, and SetActiveWindow

I have a VB 6 MDI application. It responds to the depricated SwitchToThisWindow function, but not the ShowWindow and SetActiveWindow functions. I know ShowWindow and SetActiveWindow are declared correctly because I can use them with any other application. EDIT: My goal isn't to use these functions, it is simple to switch the focus from ...

Popup window and context menu

I am using the ToolStripDropDown to host the user control as the pop-up window. The problem is when a context menu strip is displayed from within this pop-up window, the pop-up itself closes in the moment the context menu opens. I have tried to subclass the ContextMenuStrip and added WS_EX_NOACTIVATE to CreateParams but nothing changed. ...

Is there a way to know if the user has enabled "single click to open an item" in the control panel?

My program needs to know when the user has enabled "Single-click to open an item (point to select)" in the folder options window in file explorer. I have a mouse aid program and I need to know what this setting is set to programmatically? Is this available in the registry or something? ...

Getting windows caption from process ID

Hi, I have a process ID, what I want to do is return the class. If it is the desired class then return the caption, how do I do that? C Visual Studio 2008, XP SP3 ...

Import WinAPI Function in *.VBS File

Hi there, Using visual basic in say Excel, I am able to declare WinAPI functions using the DECLARE keyword - e.g. Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" ( _ ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String ) As Boolean However when using this syntax in a *.VBS file - it fa...

ReadFile, COM and NULL characters in c++

I have a problem with ReadFile function in a virtual serial port: char tmp[128]; int multiplo=0; DWORD err; COMSTAT stt; ClearCommError(hcom, &err, &stt); do{ if(ReadFile(hcom, tmp, stt.cbInQue, &err, NULL)){ tmp[err] = '\0'; memcpy(bfIn+multiplo, tmp, err); multiplo = multiplo + err; }else retur...

Animate window issue while using c#

i have used following code to animate a form while form show bottom to top animation function called, while form hide top to bottom animation function called. the code works well for bottom to top animation while i am trying to call top to bottom animation while hide animation doesn't doesn't works, the form hides simply without effect....

Difference between InvalidateRect and RedrawWindow

When I want to redraw a window, is there any preferred function to call between InvalidateRect and RedrawWindow? For instance, are these two calls equal: (win would be a HWND) RedrawWindow(win, NULL, NULL, RDW_INVALIDATE); InvalidateRect(win, NULL, NULL); The main question(s): When should I use one or the other? Are there any differ...

CopyFileEx and partially locked files

Hello! I have been using CopyFileEx since the beginning of times and it has been working great. If the file is not locked, it will copy the file. If the file is locked, it will not and GetLastError will report the error. All fine and dandy. However, there are some files that are partially locked, PST outlook files being the best exampl...

Is there a possibility to differ virtual printer from physical one?

Hi. I have a list of all printers available in WinXP. I need the code (ideally .NET) to filter out all the virtual printers from this list. Is it possible to do? I analyzed all the properties of Win32_Printer wmi class but can't see any suitable one. Please help. ...

Unable to use SendKeys or SendMessage for programmatically pasting non-text objects

I am using the RegisterHotKey Win32 API to listen to the Ctrl_V key combination and using the WndProc method to handle this hot key notification. Now, even if I don't perform any operations in this method apart from calling base.WndProc(ref mesg), the Paste operation doesnt seem to be getting passed onto Windows and hence, paste is not w...

Win32 and Acrobat

Hello, I have a simple Win32 app writen in C, in which I would like to open PDFs. I know I can compile and link to Poppler library, but is there a way to use Acrobat Reader? Kind of like what browsers do, if you have Reader installed, they are automatically able to display PDF in a window though some plugin interface. The problem is, I n...

Win32: displaying PDF

Hello, I have a simple Win32 C app, which I would like to enable to display PDFs (they do not have to be files - they could be in-memory as well). I would like to control at least the zoom level and whether is should be shown as single, standalone pages or continuous "flow" of pages. I'm asking for anything else than Acrobat Reader, Popp...

Detect and prevent/delay windows mobile power off.

I have a window mobile application which needs to detect power off and perform some operation before the device shuts down. I have been able to detect that the device is shutting down using pinvoke to the RequestPowerNotifications win32 api. However I can not figure out how to block the power off for long enough to run my code. ...

tool for monitoring the windows messages used by an external application

i am looking a tool for monitoring the windows messages fired by an external application in real-time. some time ago i used winsight32 (tool that ships with Delphi), but is very memory expensive and freeze my laptop. ...

win api c# property grid value

How do I get property or tree Grid value in component on 3-th software on my program witch WinAPi? Spy++ and analog return GetWindowText only caption window "PropertyGrid". i need read data from other program im my program ...

Window handling manager

I have a Windows box that is running three applications. When the applications are started each application creates a borderless window which is positioned such that they overlap in a particular way. At the moment, when I click on a control on the bottom window, it comes to the top of the window stack. I need to ensure that each windo...

CRichEditCtrl::GetSelText() is not working right

MFC File: winctrl4.cpp (C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\src\mfc) CString CRichEditCtrl::GetSelText() const { ASSERT(::IsWindow(m_hWnd)); CHARRANGE cr; cr.cpMin = cr.cpMax = 0; ::SendMessage(m_hWnd, EM_EXGETSEL, 0, (LPARAM)&cr); CStringA strText; LPSTR lpsz=strText.GetBufferSetLength((cr.cpMa...

How to know if the Kerberos ticket has expired

Hi, I have a client side application that uses Kerberos authentication to connect to remote service. When reseting the password for the SPN in ADSI without renewing the ticket, the authentication fails (of course). The question is, if there is a way to know in advance that the ticket is not valid\ expired. Thanks!! ...

Get realpath of uploaded file

I need to get the aboslute path of a file uploaded by the user in PHP. How can I do that? Im doing this cause I need to post the information to an API via cURL ...