Click here to Skip to main content
12,699,054 members (25,119 online)
Rate this:
Please Sign up or sign in to vote.
See more: C Windows
Hello everyone
I want create windows API application and put singleline edit controls on it.
The edit controls should have two arrows at sides to scroll horizontally using mouse. I could not find any edit styles to do this in windows edit controls. Is there any other way to do this, other than creating customized controls?
Thanks in advanse
my code to create edit control as this:
int iStyleEx = WS_EX_CLIENTEDGE;
static wchar_t wszBuffer[400];
HWND hWndEdit = CreateWindowExW( iStyleEx, L"EDIT", wszBuffer, iSstyle,
		cpx, cpy, cpWidth, cpHeight, hwndDlg, NULL, hInst, NULL );
As there is no simple way to add arrows to both sides of edit control to scroll horizontally, I think the best way to solve this problem is to create two button controls to left and right of edit control, and handle their WM_LBUTTONDOWN and WM_LBUTTONUP events.
The button controls should paint arrows.
Posted 11-Sep-12 10:47am
Updated 12-Sep-12 3:56am
Sergey Alexandrovich Kryukov 11-Sep-12 15:48pm
Did you try to type a really long text? I think you should not see those arrows if the text fits...
mr.abzadeh 11-Sep-12 15:59pm
I am not able to put arrows there, and edit control has no arrows by default, even for long text.
Sergey Alexandrovich Kryukov 11-Sep-12 17:38pm
Really? Hm... Than perhaps you could create a really short code sample to show what is you code and to reproduce this problem only? If so, please use "Improve question".
mr.abzadeh 12-Sep-12 8:58am
I improved my question and a simple code to show how I create edit controls.
Kenneth Haugland 11-Sep-12 15:49pm
Use WPF if you are not already using it, this problem would be a pice of cake...
Sergey Alexandrovich Kryukov 11-Sep-12 17:39pm
Well.. WPF with C (as tagged)?
Kenneth Haugland 11-Sep-12 17:46pm
Well, I guess its possible, but Im not used to people tagging the question appropreatly, so I assumend wrongly :-)
Wes Aday 11-Sep-12 15:51pm
Yes you have to create a custom control as that is a non-standard behavior. Most people just use scrollbars....
Kenneth Haugland 11-Sep-12 15:55pm
I dont really understand why he cant use the up and down arrow keys but perhaps Im getting old fashoned.
Wes Aday 11-Sep-12 15:58pm
He's asking about arrows on either side of the control in the window (as I interpret it). And using C....
Kenneth Haugland 11-Sep-12 16:11pm
I see that is C but I still dont understand his problem. BTW: You can use WPF with C++/CLI, whitch Im assuming what he means by C, although C could mean anything Borland etc.
Wes Aday 11-Sep-12 16:13pm
I don't understand his problem either. He could just use scrollbars like the rest of the world and be done with it.
mr.abzadeh 11-Sep-12 16:23pm
I use windows api (native C, visual studio 2010). I do not use .net and wpf

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Maybe this function could help

ScrollWindowEx function

int ScrollWindowEx(
_In_ HWND hWnd,
_In_ int dx,
_In_ int dy,
_In_ const RECT *prcScroll,
_In_ const RECT *prcClip,
_In_ HRGN hrgnUpdate,
_Out_ LPRECT prcUpdate,
_In_ UINT flags

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100