winapi

Get Currently Opened Word Document from Process

喜夏-厌秋 提交于 2021-02-10 18:21:52
问题 The goal is to get the full path to the document opened in an instance of Microsoft Word that I have a process reference for. Pseudocode Example: Process myWordProcess = something; // This is my process reference DocumentInformation docInfo = SomeNamespace.GetDocumentInformation(myWordProcess); string documentPath = docInfo.FullName; // "C:\User\Foo\Documents\Test.docx" The starting point is a Process object which is executed by WINWORD.exe . I am not looking for a way that includes parsing

URLDownloadToFile fails with 0x800c0008 (INET_E_DOWNLOAD_FAILURE) depending on length of URL [duplicate]

霸气de小男生 提交于 2021-02-10 18:19:29
问题 This question already has answers here : What is the maximum URL length you can pass to the Wininet function, HttpOpenRequest? (3 answers) Closed 2 years ago . I'm aware there is a similar question here. However my symptoms differ. There seems to be some kind of URL length restriction in place that I couldn't find documented. The limit seens to be 2084 (sic! not 2048!) characters in the URL. The easiest repro is just a console application with this code: #include "stdafx.h" #include "urlmon.h

c++ programming for joystick in windows

时光毁灭记忆、已成空白 提交于 2021-02-10 18:00:45
问题 i want to connect joystick to my c++ qt program in windows.I studied about programming with win32 api using the joystickapi library in microsoft guid for joystick program But I didn't understand exactly What should I do after checking the system compatibility? Completion description: my code for system compatibility: JOYINFO joyinfo; UINT wNumDevs, wDeviceID; BOOL bDev1Attached, bDev2Attached; void joyCapablitis(){ if((wNumDevs = joyGetNumDevs()) == 0) qDebug()<<"no driver available";

c++ programming for joystick in windows

偶尔善良 提交于 2021-02-10 17:54:04
问题 i want to connect joystick to my c++ qt program in windows.I studied about programming with win32 api using the joystickapi library in microsoft guid for joystick program But I didn't understand exactly What should I do after checking the system compatibility? Completion description: my code for system compatibility: JOYINFO joyinfo; UINT wNumDevs, wDeviceID; BOOL bDev1Attached, bDev2Attached; void joyCapablitis(){ if((wNumDevs = joyGetNumDevs()) == 0) qDebug()<<"no driver available";

What's the difference between SetWindowLongPtr(GWL_HWNDPARENT) and SetParent?

青春壹個敷衍的年華 提交于 2021-02-10 17:37:02
问题 I need to create a watermark window(markHwnd) for some application windows on desktop, the watermark window style is: uint dwStyle = Win32API.WS_CLIPSIBLINGS | Win32API.WS_CLIPCHILDREN | Win32API.WS_POPUP; uint dwExStyle = Win32API.WS_EX_LAYERED | Win32API.WS_EX_TRANSPARENT | Win32API.WS_EX_NOACTIVATE | Win32API.WS_EX_NOPARENTNOTIFY | Win32API.WS_EX_TOOLWINDOW; markHwnd = Win32API.CreateWindowEx(dwExStyle, wndclassRegResult, ti.ToString(), dwStyle, 0, 0, 0, 0,IntPtr.Zero, IntPtr.Zero,

What's the difference between SetWindowLongPtr(GWL_HWNDPARENT) and SetParent?

好久不见. 提交于 2021-02-10 17:36:23
问题 I need to create a watermark window(markHwnd) for some application windows on desktop, the watermark window style is: uint dwStyle = Win32API.WS_CLIPSIBLINGS | Win32API.WS_CLIPCHILDREN | Win32API.WS_POPUP; uint dwExStyle = Win32API.WS_EX_LAYERED | Win32API.WS_EX_TRANSPARENT | Win32API.WS_EX_NOACTIVATE | Win32API.WS_EX_NOPARENTNOTIFY | Win32API.WS_EX_TOOLWINDOW; markHwnd = Win32API.CreateWindowEx(dwExStyle, wndclassRegResult, ti.ToString(), dwStyle, 0, 0, 0, 0,IntPtr.Zero, IntPtr.Zero,

How can you iterate though directories without using any recursive functions in c?

匆匆过客 提交于 2021-02-10 17:35:41
问题 I'm trying to create a program in pure C using the WIN32 api to iterate though directories trees and list any files located in them, and if it finds a folder, it should go into that directory to search for any files in there, I have a recursive function that works perfectly, but it is necessary that code is not recursive. Can anybody help modify the code to make it work without the recursive feature? void WINAPI IterateFiles(char* Directory) { HANDLE hFind; WIN32_FIND_DATA Win32FindData; char

Access windows local machine store with Python win32crypt

喜欢而已 提交于 2021-02-10 14:53:15
问题 I'm trying to access a certificate, that's stored in windows local machine store. This can't be done with wincertstore, as it uses CertOpenSystemStoreA function (see remarks: https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certopensystemstorea) However CertOpenStore from pywin32 has access, I just don't know how to pass the right parameters. Here's my code: import win32crypt # store provider CERT_STORE_PROV_SYSTEM = 13 #dwFlags CERT_SYSTEM_STORE_CURRENT_SERVICE =

Window won't update while changing its shape

对着背影说爱祢 提交于 2021-02-10 14:36:30
问题 I have successfully created a window but it wont update the window to change its shape and color. I have tried to solve this for days an appreciate any help. The program is meant to show an orange window that can be reshaped. It would also help, if you could check the code by compiling it in Visual Studios. Here is the code: #include <Windows.h> #include "Header.h" bool running = true; void *buffer_memory; int buffer_width; int buffer_hight; BITMAPINFO buffer_bitmap_info; LRESULT CALLBACK

Block ESC and Enter keys in modeless dialog box (Win32, non-MFC)

ε祈祈猫儿з 提交于 2021-02-10 14:34:11
问题 There're some articles written on this subject, but none of them worked in my case. I'm writing the following using Win32 (no MFC). The goal is to prevent ESC or ENTER keys from closing the modeless dialog box. Here's the dialog template: IDD_DIALOG_1 DIALOGEX 0, 0, 345, 179 STYLE DS_SETFONT | DS_FIXEDSYS | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "New Pt",IDC_CHECK_NEW_PT,"Button",BS_AUTOCHECKBOX | BS