winapi

C++ system tray only program

拈花ヽ惹草 提交于 2021-02-11 07:41:20
问题 After checking Microsoft's documentation on system tray icons (that I could find): Shell_NotifyIconA function NOTIFYICONDATAA structure I've noticed that a window handle (HWND) is REQUIRED. This is very bad for what I'm trying to accomplish, as I'm looking to create a program that only reacts to the system tray: it doesn't "minimize" the window to the tray, it just uses notifications (clicking/right clicking on the icon) to interact. How would I go about doing this? 回答1: The Windows 7 SDK

C++ system tray only program

泄露秘密 提交于 2021-02-11 07:41:17
问题 After checking Microsoft's documentation on system tray icons (that I could find): Shell_NotifyIconA function NOTIFYICONDATAA structure I've noticed that a window handle (HWND) is REQUIRED. This is very bad for what I'm trying to accomplish, as I'm looking to create a program that only reacts to the system tray: it doesn't "minimize" the window to the tray, it just uses notifications (clicking/right clicking on the icon) to interact. How would I go about doing this? 回答1: The Windows 7 SDK

c++ access variable from different switch case

筅森魡賤 提交于 2021-02-11 00:35:31
问题 I'm creating a win32 application and initialized my statusbar width variables in my WM_CREATE switch case. case WM_CREATE: { int statwidths[] = { 200, -1 }; } break; I would like to access statwidths[ 0 ] in my WM_SIZE switch case as that number will be used to determine the size of the rest of my windows in my program. case WM_SIZE: { int OpenDocumentWidth = statwidths[ 0 ]; } break; Is there a way to do this? They are both in the same switch statement in the same file. 回答1: If these are

c++ access variable from different switch case

左心房为你撑大大i 提交于 2021-02-11 00:31:30
问题 I'm creating a win32 application and initialized my statusbar width variables in my WM_CREATE switch case. case WM_CREATE: { int statwidths[] = { 200, -1 }; } break; I would like to access statwidths[ 0 ] in my WM_SIZE switch case as that number will be used to determine the size of the rest of my windows in my program. case WM_SIZE: { int OpenDocumentWidth = statwidths[ 0 ]; } break; Is there a way to do this? They are both in the same switch statement in the same file. 回答1: If these are

Tool Help API returns invalid HMODULE?

别说谁变了你拦得住时间么 提交于 2021-02-10 23:22:44
问题 In my app, I hook some Windows API calls by patching PE Import Access table. I enumerate all modules in a process using this Tool Help API (Module32First,Module32Next). One of the functions I hook is LoadLibrary. In it, I load module by calling the original LoadLibrary and then I enumerate again all the loaded modules to detect new loaded modules I have not hooked yet (because LoadLibrary can load the specified module plus all the modules it depends on). It works fine most of the time. But

Tool Help API returns invalid HMODULE?

北城以北 提交于 2021-02-10 23:19:56
问题 In my app, I hook some Windows API calls by patching PE Import Access table. I enumerate all modules in a process using this Tool Help API (Module32First,Module32Next). One of the functions I hook is LoadLibrary. In it, I load module by calling the original LoadLibrary and then I enumerate again all the loaded modules to detect new loaded modules I have not hooked yet (because LoadLibrary can load the specified module plus all the modules it depends on). It works fine most of the time. But

Direct Composition, IDCompositionGaussianBlurEffect Throwing Access Violation Exception

霸气de小男生 提交于 2021-02-10 22:42:22
问题 I was working on a project which uses direct composition based on this Article: Windows with C++ : High-Performance Window Layering Using the Windows Composition Engine I was able to recreate the example and it is working. Currently i'm trying to apply IDCompositionGaussianBlurEffect to My Visual (variable: visual) but the Compiler Throws an Access Violation Exception. Is there any way to Apply the Blur Effect on to my visual using Direct Composition. The Exception: Exception thrown at

CreateFile() Failed With GetLastError() = 5

我们两清 提交于 2021-02-10 20:34:14
问题 I have written a sample application to read the file from the other file. When I run this application form virtual machine I am getting Access denied. Below is the code. int _tmain(int argc, _TCHAR* argv[]) { WCHAR *wcsPath = L"\\\\150.160.130.22\\share\\123.XML"; HANDLE hFile = CreateFileW(wcsPath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); if (NULL == hFile) { printf("failed - %d", GetLastError()); } return 0; } Please let me know any changes. 回答1: Error code 5 stands for

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

孤者浪人 提交于 2021-02-10 18:23:08
问题 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

Get Currently Opened Word Document from Process

限于喜欢 提交于 2021-02-10 18:22:58
问题 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