wndproc

C# ListView Disable Horizontal Scrollbar

风格不统一 提交于 2019-12-01 03:55:30
is there a way I can stop the horizontal scroll bar from ever showing up in a listview? I want the vertical scroll bar to show when needed but I want the horizontal scroll bar to never show up. I would imagine it would have something to do with WndProc? Thanks You could try something like this, I used in a project once and it worked: [DllImport ("user32")] private static extern long ShowScrollBar (long hwnd , long wBar, long bShow); long SB_HORZ = 0; long SB_VERT = 1; long SB_BOTH = 3; private void HideHorizontalScrollBar () { ShowScrollBar(listView1.Handle.ToInt64(), SB_HORZ, 0); } Hope it

C++: How to set a new wndProc for a console application?

孤者浪人 提交于 2019-12-01 03:48:04
If I have a console application with a handle to it set up like so; HWND hWnd = GetConsoleWindow(); Then how do I set up a new wndProc for the window? I tried using SetWindowLong(hWnd, GWL_WNDPROC, (LONG)conProc); With conProc being defined as LRESULT CALLBACK conProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_NCHITTEST: return HTCAPTION; } return DefWindowProc(hWnd, msg, wParam, lParam ); } But it doesn't work and says "Error code: 5 - Access is denied" on GetLastError() I understand that it's pretty difficult to modify the console application like this, since

C# Form Move Stopped Event

跟風遠走 提交于 2019-12-01 03:39:25
问题 Is there any event in C# that fires when the form STOPS being moved. Not while its moving. If there is no event for it, is there a way of doing it with WndProc? 回答1: The ResizeEnd event fires after a move ends. Perhaps you could use that. 回答2: This is not a failsafe solution, but it's pure .NET and it's dead simple. Add a timer to your form, set it to a relatively short delay (100-150 ms seemed OK for me). Add the following code for the Form.LocationChanged and Timer.Tick events: private void

How to use this WndProc in Windows Forms application?

会有一股神秘感。 提交于 2019-12-01 01:03:59
Please guide me how to use this WndProc in Windows Forms application: private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == NativeCalls.APIAttach && (uint)lParam == NativeCalls.SKYPECONTROLAPI_ATTACH_SUCCESS) { // Get the current handle to the Skype window NativeCalls.HWND_BROADCAST = wParam; handled = true; return new IntPtr(1); } // Skype sends our program messages using WM_COPYDATA. the data is in lParam if (msg == NativeCalls.WM_COPYDATA && wParam == NativeCalls.HWND_BROADCAST) { COPYDATASTRUCT data = (COPYDATASTRUCT)Marshal

WndProc: How to get window messages when form is minimized

倾然丶 夕夏残阳落幕 提交于 2019-11-30 14:18:56
To communicate with a certain service, I have to override the WindProc . and receive window messages. However, when the form is minimized, I get no longer any message. I know that it has to be like that, but is there a workaround for this? I don't want to have a hidden form which stays always open... jrequejo I've also needed to solve a similar problem recently. Abel's answer set me on the right direction. Here is a complete example of how I did it, by changing a normal window into a message-only window: class MessageWindow : Form { [DllImport("user32.dll")] static extern IntPtr SetParent

JAVA JNA WindowProc implementation

こ雲淡風輕ζ 提交于 2019-11-30 11:40:30
问题 I'm trying to write a simple application in Java that will communicate with an USB device. The USB device is made by me using a Microchip Microcontroller. The communication is rather simple, since the USB device is from the HID Class, arrays of 64 bytes are exchanged between the computer and the device. My program finds the device based on the product ID and the vendor ID, can write and read 64 bytes, but now I would like to detect when the device is connected or disconnected from the

C# ListView Disable Horizontal Scrollbar

陌路散爱 提交于 2019-11-30 09:00:42
问题 is there a way I can stop the horizontal scroll bar from ever showing up in a listview? I want the vertical scroll bar to show when needed but I want the horizontal scroll bar to never show up. I would imagine it would have something to do with WndProc? Thanks 回答1: You could try something like this, I used in a project once and it worked: [DllImport ("user32")] private static extern long ShowScrollBar (long hwnd , long wBar, long bShow); long SB_HORZ = 0; long SB_VERT = 1; long SB_BOTH = 3;

Get the coordinates of a WM_NCHITTEST message?

人走茶凉 提交于 2019-11-30 08:33:49
问题 How do I get the coordinates of a WM_NCHITTEST message in C# code? I'd love to get the fastest way, because performance is a requirement. 回答1: From MSDN: wParam This parameter is not used. lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen. The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen. So you just need to extract the low-order

JAVA JNA WindowProc implementation

夙愿已清 提交于 2019-11-30 00:58:28
I'm trying to write a simple application in Java that will communicate with an USB device. The USB device is made by me using a Microchip Microcontroller. The communication is rather simple, since the USB device is from the HID Class, arrays of 64 bytes are exchanged between the computer and the device. My program finds the device based on the product ID and the vendor ID, can write and read 64 bytes, but now I would like to detect when the device is connected or disconnected from the computer. As I've seen in a C# program provided by Microchip as an example application, the WndProc method is

WndProc: How to get window messages when form is minimized

心已入冬 提交于 2019-11-29 20:47:33
问题 To communicate with a certain service, I have to override the WindProc . and receive window messages. However, when the form is minimized, I get no longer any message. I know that it has to be like that, but is there a workaround for this? I don't want to have a hidden form which stays always open... 回答1: I've also needed to solve a similar problem recently. Abel's answer set me on the right direction. Here is a complete example of how I did it, by changing a normal window into a message-only