winapi,dialog,windows-xp,hook , using hook on OPENFILEW dialog disables resize control


using hook on OPENFILEW dialog disables resize control

Question:

Tag: winapi,dialog,windows-xp,hook

Using this code the resulting dialog box is drawn without ability to be able to be resized by mouse:

#include <windows.h>

static UINT_PTR CALLBACK OFNHookProc (HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) {
  return 0;
}

int main() {
  OPENFILENAMEW ofn;
  ZeroMemory(&ofn, sizeof(ofn));
  ofn.lStructSize = sizeof(OPENFILENAMEW);
  ofn.nMaxFile = MAX_PATH;
  ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_ENABLEHOOK;
  ofn.lpfnHook = OFNHookProc;
  GetOpenFileNameW(&ofn);
  return 0;
}

Removing OFN_ENABLEHOOK shows correct dialog window with resize indicator at bottom right corner. How to make dialog that is user-resizeable and with hook procedure ?

(of course that hook is mock here, only to illustrate the error, no matter what I put inside, of course if it is correct on other matters, result is the same)


Answer:

You need to include the OFN_ENABLESIZING flag when using OFN_ENABLEHOOK. This is documented behavior:

OPENFILENAME structure

OFN_ENABLESIZING
0x00800000
Enables the Explorer-style dialog box to be resized using either the mouse or the keyboard. By default, the Explorer-style Open and Save As dialog boxes allow the dialog box to be resized regardless of whether this flag is set. This flag is necessary only if you provide a hook procedure or custom template. The old-style dialog box does not permit resizing.


Related:


how to change Text to Speech voice and how to insert characters into char array


c++,arrays,windows,winapi,text-to-speech
I need to change the voie of the Text To Speech engine. when a menu is selected ID_SPEAK_PLAY I get the text of an edit box and simply read it. my situation can be solved in two ways : insert the XML code at the begining of ptrData without using...

Accessing GetConsoleHistoryInfo() from managed code


c#,winapi,console-application,dllimport,managed
I've got a vaguely Java background and just installed Visual Studio Community 2015. Playing about with it so have a console app up and running and wanted to use above function after attaching to a different Console. Trouble is I have no idea about the appropriate declaration for this function...

How to quote variables in a whiptail command with dynamic/conditional options?


bash,dialog,whiptail
I need to disable options in a dialog command built in a Bash script. Here is the original working script: my_backtitle="This is a test" selected_options=($(dialog \ --backtitle "$my_backtitle" \ --separate-output \ --checklist "Select your options:" 0 0 \ "option1" "description of option 1" "" \ "option2" "description of option 2"...

GetWindowsDirectory() API returns wrong (vba\vb6)


vba,winapi,vb6
on my Windows-Terminal user, I'm trying to have two application point to the same Windows directory, one written in VBA one in VB6. When calling the GetWindowsDirectory() API from VB6 it returns the correct path C:\documents and settings\%user%\Windows When calling it from VBA macro, it returns C:\Windows Notice that same...

How to avoid user to click outside popup Dialog window using Qt and Python?


qt,user-interface,python-3.x,dialog,qt-creator
I created a Dialog window using Qt Creator and Python. I would like that Window stays on the top of my Gui AND avoid users to click outside that Dialog Until this dialog was closed.

Show UI dialogs using data-popup attributes


javascript,jquery,jquery-ui,dialog,jquery-ui-dialog
I am using jquery ui dialog to show more than one popup on one page, each popup will have its own ID and it will be triggered by an anchor with a data-popup="" attribute. For example, <a class="popup-button" data-popup="#popup-a">POPUP A</a> Will trigger the popup that has the ID #popup-a Below...

How do I call LocalFree()?


c,winapi
I have this piece of code HLOCAL localHandle; char *lpText; localHandle = LocalAlloc(LMEM_MOVEABLE, 40); if(localHandle) { lpText = (char*)LocalLock(localHandle); //Call LocalFree(localHandle) or LocalFree(lpText) ???? } Should I call LocalFree(localHandle); or LocalFree(lpText); ?...

how to correctly send CMFCMenuButton selected ID to the message map?


c++,menu,mfc,dialog
firstly let me describe what I have: scenario: CMFCMenuButton, loaded with a CMenu, in a dialog test: click on an item of the menuresult: the message map will get the ID of the CMFCMenuButton and not the ID of the menu how to get the actual menu ID clicked: use...

Can a dialog intercept drag'n'drop messages passed to its controls?


winapi,mfc,drag-and-drop
If a dialog registers some of its controls as drop-targets, will drag'n'drop messages intended for those controls pass through the dialog's message processing in a way that the dialog can register a message handler to be notified/intercept those messages? In a similar fashion to this question, I want to catch...

MASM console window creation troubles (maybe my stack frame??)


winapi,assembly,stack,x86-64,masm
I'm having trouble with the following code snippet. I'm compiling an asm file with a c++ file using visual studio express 2012. I've tried debugging calculating the addresses of the stack pointers and memory locations (still learning assembly obviously), but can't find a fault. (As I'm new it's probably something...

How to create a submenu for a popup menu?


c,winapi
When I want to create a popup menu, I would use the CreatePopupMenu() function. But what if one of the popup menu items needs to have a submenu, should I also use CreatePopupMenu() to create the submenu, or should I use CreateMenu()?...

How can I send data between 2 applications using SendMessage?


delphi,winapi
I have 2 applications- Manager with this code: procedure TForm1.CopyData(var Msg: TWMCopyData); var sMsg: String; begin if IsIconic(Application.Handle) then Application.Restore; sMsg := PWideChar(Msg.CopyDataStruct.lpData); Caption := Caption+'#'+sMsg; Msg.Result := 123; end; procedure TForm1.Button1Click(Sender: TObject); const WM_MY_MESSAGE = WM_USER + 1; var h: HWND; begin Caption := 'X'; h := FindWindow('TForm1', 'Client');...

Generating a self-signed X509Certificate2 certificate with its private key


c#,.net,winapi,pki,x509certificate2
I'm not the most familiar with the unmanaged cryptography library in the Windows API, but alas I am trying to generate a self-signed X509Certificate2 certificate. Here is the complete code: using System; using System.Security; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Security.Cryptography.X509Certificates; namespace Example { [StructLayout(LayoutKind.Sequential)] public struct SystemTime { public short...

Get list of process


delphi,winapi
I need to get the list of process with their PID. I know how to get the PID by its handle and viceversa, but the problem is that I'm not the one who create the process, so I don't have the handle nor the PID. I didn't find exactly information...

Explain what problems could have this function (if any)


.net,vb.net,winapi,pinvoke,getlasterror
SCENARIO When P/Invoking, I thinked it could be a great idea to simplify/reduct tons of code by designing a generic function that calls the function, then it checks for the GetLastWin32Error I'm using this code: ''' <summary> ''' Invokes the specified encapsulated function, trying to provide a higher safety level...

MessageBox won't work when handling WM_DESTROY event from DialogBox


c,user-interface,winapi
While elaborating an answer for another question (by myself), I've come up with the idea of using a MessageBox to report the result of my dialog box. It is a WinAPI modal dialog box created with the DialogBox() function. However, I noticed that handling WM_DESTROY in the dialog's procedure function...

C++ Windows API DlgDirList sometimes don't return the correct listing


c++,winapi,listbox,directory-listing,file-listing
I have 2 List Box, one always listing directories from a path and other listing the files from the selected directory. The first time i select a directory, the files are shown properly, but if i select another directory, it lists nothing. That's my current main.cpp, where all GUI stuff...

More convenient way to work with strings in winapi calls


string,winapi,rust
I'm looking for more convenient way to work with std::String in winapi calls in Rust. Using rust v 0.12.0-nigtly with winapi 0.1.22 and user32-sys 0.1.1 Now I'm using something like this: use winapi; use user32; pub fn get_window_title(handle: i32) -> String { let mut v: Vec<u16> = Vec::new(); v.reserve(255); let...

Same version number for different Windows versions


c,winapi
In this page, there is something like this: Windows Server 2008 6.0 Windows Vista 6.0 GetVersionEx() returns the version number (i.e. 6.0), but as you can see, this number can map to two different Windows versions! So is there's a way to know exactly what Windows version I have?...

Javascript: call dialog from button


javascript,button,dialog
I hope you can help me, because i'm new at javascript. I want to open a dialog by clicking on an button. When it shows up and you click "OK", there should pop-up a second dialog. http://forums.asp.net/t/1962249.aspx?Make+a+button+open+a+javascript+dialog And also on stackoverflow i saw related questions. But none of them could...

Javafx: Close alert box (or, any dialog box) programatically


javafx,dialog
I have a JavaFx application in which I display an alert box using: alert = new Alert(AlertType.CONFIRMATION); alert.setTitle("Title"); alert.setHeaderText("Some Text"); alert.setContentText("Choose your option."); buttonTypeOne = new ButtonType("Yes"); buttonTypeCancel = new ButtonType("No", ButtonData.CANCEL_CLOSE); alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeCancel); Optional<ButtonType> result = alert.showAndWait(); Because the alert executesshowAndWait, so it will be displayed till the user...

Read lines from file async using WINAPI ReadFile


c++,multithreading,winapi,createfile,overlapped-io
I need to read several lines from file simultaneously, i.e. asynchronously. Lines in file are of the same size. For instance, I need to read the second and the fourth lines of file to separate variables or to an array. I'm more used to c#'s async/await and all these OVERLAPPED...

Restarting a process from another process


c++,winapi
I have two processes: ProcessA and ProcessB. When i launch my application, i call ProcessA which uses CreateProcess() to launch ProcessB. ProcessA is killed by ProcessB when my application receives command A. Likewise, ProcessB should relaunch ProcessA when it receives command B. Where i am stuck on is on the...

How do I declare OutputDebugStringA without windows.h macros?


c++,winapi
You know how Python has from urllib import *, but also offers from urllib import request, so you can just import that one symbol? Unfortunately C/C++ don't offer that but that's what I would like to do here: from windows.h import OutputDebugStringA, because all I need is that one function....

If statement not working in vb6


winapi,vb6
I want to make a program which could close a window with the title "Personalization" in vb6. The problem is that the if statement is not working.Here's my code(it only finds a window named "Personalization" without closing it): Option Explicit Private Sub Command1_Click() Timer1.Enabled = Not Timer1.Enabled End Sub Private...

ICallFactory with 32-bit and 64-bit type libraries side by side


windows,winapi,com,registry,typelib
I have a in-proc COM server for which I want to build 32-bit and 64-bit versions. I can do this with no problem. However, I am encountering some issues when both versions are registered. I am not using ATL. In my DllRegisterServer function, I am using RegisterTypeLibForUser. I am acquiring...

Dialog error in android


android,dialog
I am not able to understand why I'm getting error saying Dialog cannot be resolved to a type import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; public class DatePickerFragment extends DialogFragment { @Override public Dialog onCreateDialog( Bundle savedInstanceState ) { return new AlertDialog.Builder( getActivity() ).setTitle( R.string.date_picker_title ) .setPositiveButton( android.R.string.ok, null ) .create();...

winapi: from HDC to an HBITMAP


c++,winapi,bitmap,gdi
I would like to do something which I believe is fairly simple but since I am new to the winapi I am finding a lot of problems. Basically I have an HDC (which I am BitBlitting from a loaded Bitmap) and I am drawing a rectangle on it. Then I...

How can a dialog become responsive while waiting for a call to DoModal() to return?


winapi,com,mfc,modal-dialog
A button on a dialog causes a child dialog to be created, and displayed modally. e.g: void ParentDialog::OnButton() { ChildDialog dlg; int ret = dlg.DoModal(); } The parent dialog is initially unresponsive as expected. But, the child dialog also makes COM calls to a server module, which causes the server...

Hide Window from taskbar without using WS_EX_TOOLWINDOW


c,winapi
I have a main Window and an About Window, The About Window is opened from the main Window, but the problem is that the About Window is shown in the taskbar! I have found that in order to hide a Window from the taskbar, I can use the WS_EX_TOOLWINDOW style,...

Win32 Message Pump and std::thread Used to Create OpenGL Context and Render


multithreading,winapi,opengl,c++11
If I have a function that does the following: bool foo::init() { [Code that creates window] std::thread run(std::bind(&foo::run, this)); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } } Where run is defined as: void foo::run() { [Code that creates initial opengl context] [Code that recreates window based on new...

User process can't see global shared memory created by service


c++,windows,security,winapi,memory-mapped-files
I have a Windows service (running in the system process) and a desktop application that need to share a configuration structure. The data originates in the app, but the user process doesn't have permission to create a global memory object so I create it when the service starts using CreateFileMapping()...

Is a StatusBar created in simple mode by default?


c,winapi
When a StatusBar is first created, for example: HWND hStatusBar = CreateWindowEx(0, STATUSCLASSNAME, "", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, 0, GetModuleHandle(NULL), NULL); Is it created in simple mode or in multiple-part mode? or maybe this is not guaranteed and it is better to set the mode I...

How To Get Window handles In Mozilla Firefox


winapi,mfc,ui-automation
How to get handles of all the child windows in Mozilla firefox. Spy++ is showing only one class and window caption for all the windows. I tried using GetWindow and FindWindowEx but got nothing. I want to read URL from mozilla firefox.

Get all supported FPS values of a camera in Microsoft Media Foundation


c++,windows,winapi,ms-media-foundation
I want to get a list of all FPS values that my webcam supports. In How to Set the Video Capture Frame Rate msdn article it says that I can query the system for maximum and minimum supported FPS of a particular camera. It also says: The device might support...

Access std::map from different threads


c++,windows,winapi
I have read that std::map is not thread safe. So if I am accessing (read/write) the std::map from different threads, should I simply wrap the relevant code in a critical section? Note: I am using Visual C++ 2010....

How to handle an event message while using chrome embedded framework (CEF)?


c++,winapi,visual-c++,chromium-embedded
I'm using Chromium Embedded Framework(CEF) to develop a windows desktop application(using C++/Win32, No MFC). I have used the sample "cefsimple" project and extended on it till now. I have added "Handlers" for keyboard events etc. Everything works fine till now, I can get the handle of the browser window and...

Put a string into a dialog from a slected list item from a expandable list child


android,dialog,expandablelistview
I've been trying to pull details of an item selected, from my strings.xml. To a dialog pop up when i select an item from my expandable list view (child). Sadly with little success. This is the expandable list fragment from my NavigationDrawerFragment. everything works great. the dialog pulls up with...

Count digits in file using WinApi functions


c++,winapi,createfile
I need to count digits in file using CreateFile and ReadFile methods from <Windows.h>. Here's what I have: int CountDigitsInFile(PCTSTR path) { HANDLE hFile = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { _tprintf_s(TEXT("Open File Error")); return NULL; } TCHAR data[100]; DWORD dwRead; DWORD dwFileSize =...

Obtain thread handles/id of a specific process


c++,multithreading,winapi
I have a multi-threaded embedded architecture that contains 6 application specific processes which are executed when the initialization process is executed. Likewise, each have their own number of threads that are running. What i want to do is suspend the running threads of 1 particular process based on whether the...

How should I read the filename in FILE_NOTIFY_INFORMATION struct


c++,winapi,filesystems,file-monitoring,readdirectorychangesw
I'm trying to monitor file changes but I am not really sure on how to read the filename in the FILE_NOTIFY_INFORMATION struct: HANDLE dwChangeHandles[2]; DWORD dwWaitStatus; wChangeHandles[0] = FindFirstChangeNotification(dirname.c_str(), FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE); if (dwChangeHandles[0] == INVALID_HANDLE_VALUE) printerr(__FILE__,__LINE__,"FindFirstChangeNotification function failed.\n"); ... if ((dwChangeHandles[0] == NULL) || (dwChangeHandles[1] == NULL)) //final validation printerr(__FILE__,__LINE__,"Unexpected...

Create jDialog Swing with a message of error with image


java,swing,dialog
I'm new of Java and I want to do a jDialog that is opening when I push a button in the main JFrame and show a message of error in this way: I can't put the image in another way in NetBeans? I create in the source package a directory...

ImageView setOnClickListener in a dialog


android,dialog,imageview,onclicklistener
I create a custom dialog box with this method: public Dialog onCreateDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); LayoutInflater inflater = this.getLayoutInflater(); builder.setView(inflater.inflate(R.layout.dialog_rate, null)) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { SharedPreferences.Editor settingsEditor = settings.edit(); settingsEditor.putBoolean("rate",false); settingsEditor.apply(); Intent intent = new Intent();...

C++ and WinApi - usage of GetWindowText() to get parameters for C++ code


c++,winapi,file-io
I have coded some C++ console program which converts one filetype to another. I need to turn the console application into a window one. I have never made window applications. I have chosen WinApi, because I don't have much time and don't want to change IDE (DEV C++ 5.10), compiler/linker...

SAPUI5/OPENUI5 - Routing with Dialogs


routing,dialog,sapui5,openui5
I´m currently stuck with the combination of routing and dialogs. I have a view with list elements and when I click on an element in the list I want the Detail view to be shown in a Dialog (Popup). The thing is, I also want the ID of the list...

New window opening with parent window's controls


c++,winapi
Sorry for english slaughter but i can't find anything about that. I'm trying to open an empty window in c++ with winapi but new window opening with parent window's controls like a clone. case VBTN: { vsa1 = CreateWindowEx(NULL, L"Window Class", L"Test", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 350,...

Issue finding exe path of all windows in python


python,windows,winapi
I am using the code below to determine the foreground window and find the path for the .exe file that created it. hwnd = win32gui.GetForegroundWindow() _, pid = win32process.GetWindowThreadProcessId(hwnd) hndl = win32api.OpenProcess(win32con.PROCESS_QUERY_INFORMATION | win32con.PROCESS_VM_READ, 0, pid) path = win32process.GetModuleFileNameEx(hndl, 0) print path This workd for windows such as Google Chrome,...

Populating a List Control with the sorted contents of an `std::multimap`?


c++,winapi,stl,mfc,clistctrl
As a follow-up to this question, I need a way to access my data by index. But the data needs to be sorted by timestamp, contain a filepath as a value, and be displayed in real-time as new elements are discovered. Considering that multiple files/folders could potentially contain an identical...

Does LoadLibrary return NULL or an error code < 32 on failure?


winapi
The MSDN documentation states If the function succeeds, the return value is a handle to the module. If the function fails, the return value is NULL. To get extended error information, call GetLastError. while Microsoft support has a list of return values less than 32 that indicate an error The...

MoveFileEx() File removal on reboot


c++,windows,winapi
Currently I can remove a directory on reboot. Im currently doing this by using the MoveFileEx function along with passing the MOVEFILE_DELAY_UNTIL_REBOOTconstant. My question is if I have the following: Directory 1 and inside I have Directory 2... Directory 2 is unistalled which means the directory needs to be removed...