|
How to get column width of each columns in the ListView Control
|
|
|
|
|
You may use, for instance, ListView_GetColumnWidth macro.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Hi Guys,
As i was working i got a problem. as i have to open a file, i simply call CreateFile and it Opens it. now if some application like MS Excel ect have open it previously, it is not letting me open the file.. now if it is about sharing voilation, how notepad manages the file to open it?? i think i am clear to whar i require
Expecting some Quick responce..
HARSH
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.
|
|
|
|
|
My guess is that Notepad opens the file for reading only (and only tries to open it for writing if the user wants to save, at which point it will also fail), when Excel or Word or the likes opens the file it probably allows other processes to read the file, but not to write to them (this would explain how you get a "open for reading only" option from Word if you try to open a document that is opened by another word instance/another user's word...). Can it be that when you use CreateFile to open the file you try to open it for writing?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
|
aks. wrote: What is the difference between MPEG-4 and MPEG-4 VKI version?
Maybe the same difference there is between a C++ forum and Google .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: C++ forum and Google.
Heh heh
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
I had a requirement of do screen scraping on windows. I want to capture words which are available on active window along with the pixels.
So can any one help me out how to do this....?
Thanks
John.
|
|
|
|
|
First get the window handle of that pixel you want,
then get the text of this window
Hope it helps
www.logicsims.ir
|
|
|
|
|
John502 wrote: I had a requirement of do screen scraping on windows. I want to capture words which are available on active window along with the pixels.
So can any one help me out how to do this....?
are you scrapping from custom window or generic window?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I want to scrape text from custom window... From the custom window it self i just want to find out where is that text (what i am trying to search) is avaialable. Once i get the pixel pisitions of that text then i want to scrape that..
This is my requirement... Please help me out with your suggestions...
Thanks
John...
|
|
|
|
|
hi i want to move button control on mouse LButton down with no Resize and position must be saved within the dialog.
How it can be done.
|
|
|
|
|
First, commas, full-stops and semicolons has a meaning also in natural langage:
Your question can be:
"hi, I want to move A button control on mouse LButton down, with no Resize; position must be saved within the dialog.
How it can be done?"
or
"hi I want to move button controls on mouse LButton down with no Resize and position. Must be saved within the dialog.
How it can be done?"
And they are quite different questions.
Assuming the first, since a control is a window, just use MoveWindow (note: mouse coordinates are obtained in screen coordinates, while move window requires parent client coordinates, so do the proper translation with ScreenToClient ).
I don't understand what you mean with "saved within the dialog": if you mean "saved within the dialog RESOURCE", then give a look to http://msdn.microsoft.com/en-us/library/ms648004(v=VS.85).aspx[^].
Consider also that, unless you are writing a "resource management tool", modifying the resource result in modifying the "exe", and this is not, in general, a good idea: what does it happen if multiple users attempt to to modify your "exe" if it is shared across a network?
It is better to save the control positions in a file stored in a user specific directory (you can get the path with SHGetFolderPath , giving CSIDL_APPDATA as a CSIDL) and, when loading the dialog, change the controls positions (again, with MoveWindow ) accordingly to such file (if existent) before showing the dialog.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
jiya-123 wrote: hi i want to move button control on mouse LButton down with no Resize
Use MoveWindow [^] or SetWindowPos [^].
jiya-123 wrote: position must be saved within the dialog.
To make new position persistent, you may store coordinate values in a configuration file.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well, what's actually stopping you?
I can see a few steps:
First, you need this to toggle on and off. If it was on all the time, anyone using this dialog will hate you. "I just tried to press OK, but the damn button keeps moving!"
You'll need to subclass your button(s), and override WM_LBUTTONDOWN,WM_MOUSEMOVE,WM_LBUTTONUP. For the button messages, either pass them on as normal, or toggle a "I'm dragging flag". In the mouse button, subtract the current position from the last position, and move the window by that much. Something like:
void CMyMovableButton::OnMouseMove (UINT fFlags, CPoint ptMouse)
{
if (m_bDragging)
{
CWnd *pParent = GetParent ();
MapWindowPoints (pParent, &ptMouse, 1);
CPoint ptDelta = ptMouse - m_ptMouseLast;
MoveWindow (ptDelta.x, ptDelta.y);
SetWindowPos (NULL, ptDelta.x, ptDelta.y, 0,0, SWP_NOSIZE | SWP_NOZORDER);
m_ptMouseLast = ptMouse;
}
else
__super::OnMouseMove (fFlags, ptMouse);
}
You'll also need to store all your window positions when the dialog closes (or store them whenever a control has finished moving) so that you can use that information next time the dialog is used. Maybe make structure full of CPOints (ie, ptOKButton, ptCancelButton) and save that in the registry for use in you CMyMovableDlg::OnInitDialog function?
You might also want to look at CDiagramEditor - DIY vector and dialog editor[^] for an alternate way of doing all this.
It sounds like you have a lot of work ahead of you - and I know no shortcut. I hope you have a strong business case for this, and not just "wouldn't it be cool?"
Maybe when you're done, you could write an article based on it?
Good luck,
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
|
I m having 3 coloumns in my list view
Column1 Column2 Column3
when i click a button Column1 should move to 2nd position column3 should come to first and column2 will be in 3rd position
i m trying this in win 32
thanks in advance
|
|
|
|
|
AFAIK there's no magic for that: you have to rebuild properly the list.
[added]
Wow: it looks like I was wrong...
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Have a look at ListView_SetColumnOrderArray . It should do what you're looking for.
|
|
|
|
|
|
Is there any way to remove the space for the title at the top of a groupbox. When I use the GetWindowRect property, it's giving me a rectangle with a gap at the top. I don't want the gap - I want the dimensions of the entire group box, with title area (which I am not using). How do I get this? I found a solution for .NET here, but nothing for MFC:
http://stackoverflow.com/questions/2110148/wpf-groupbox-with-no-header-space[^]
Thanks in advance.
|
|
|
|
|
permutations wrote: When I use the GetWindowRect property, it's giving me a rectangle with a gap at the top. I don't want the gap - I want the dimensions of the entire group box, with title area...
I'm obviously misunderstanding, but what is the difference between the "gap at the top" and the "title area?"
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
No difference - I'm talking about the title area. Is there a way to style the groupbox so no space is given to the title and GetWindowRect will return the entire groupbox, all the way to the top?
|
|
|
|
|
Not that I know of. You might try taking the height of the font and dividing it in half, since that's how much sticks above the group border.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|