|
Hi all:
The DC is available, but how can i get what the color of brush is in it, and also some other parameters in it, such as pen etc.?
GetObject()?
|
|
|
|
|
Hello Kwib,
if you are using MFC,here is answer
GetCurrentBrush - Returns a pointer to the currently selected CBrush object.
GetCurrentFont - Returns a pointer to the currently selected CFont object.
GetCurrentPalette - Returns a pointer to the currently selected CPalette object.
GetCurrentPen -Returns a pointer to the currently selected CPen object.
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Thanks ThatsAlok
But I'm working under plain c, should I call it SDK environment?
|
|
|
|
|
|
Greetings,
I am trying to change the size of a FormView application after I have resized a control and I must be missing something essential.
I can get the window to resize (smaller), but then scroll bars appear that weren't there before. I suspect it is something inherent to how a FormView works as when I resize smaller manually, the scroll bars appear even though no controls are obscured.
I suspect I have some setting in the FormView wrong since it doesn't behave with manual resizing.
Anyway...
My current approach is to call AfxGetMainWnd()->GetWindowPos(), adjust the values and then call SetWindowPos(). Then I call ResizeParentToFit() which almost does the job.
Here is a code fragment. The control involved is a CListCtrl...
WINDOWPLACEMENT wpMain, wpOldList;
AfxGetMainWnd()->GetWindowPlacement(&wpMain);
m_RecordList.GetWindowPlacement(&wpOldList);
... make the size and content changes to the list ...
WINDOWPLACEMENT wpNewList;
m_RecordList.GetWindowPlacement(&wpNewList);
int sizeChange = wpOldList.rcNormalPosition.right - wpNewList.rcNormalPosition.right;
wpMain.rcNormalPosition.right -= sizeChange;
AfxGetMainWnd()->SetWindowPlacement(&wpMain);
ResizeParentToFit();
Any hints would be greatly appreciated. Thanks!
|
|
|
|
|
I'm not sure to understand, so I hope I won't provide a bad answer.
As I understand it, you want to force the size of your application. I would do so by resizing the MainFrame object, using CMainFrame::SetWindowPos. Then I would catch the WM_SIZE message in the Form View to handle controls size and position changes.
Oh, and you can manage the way your view handles scroll bars by overring CScrollView::SetScrollSizes.
HTH,
|
|
|
|
|
K(arl) wrote:
As I understand it, you want to force the size of your application. I would do so by resizing the MainFrame object, using CMainFrame::SetWindowPos. Then I would catch the WM_SIZE message in the Form View to handle controls size and position changes.
Yes, I want to set the size of the application. I've tried using SetWindowPos(), but it works no better.
Catching the OnSize stuff would not help as the control has already been sized; there is nothing to be done. Manually (or rather programatically) adjusting the scroll bar is something I would like to avoid.
For now, I am using a kludge by setting the original size of the Formview and the control that gets resized (in the visual dialog editor) to something absurdly small. Then when I load up the control and resize it, I can also resize the MainFrame and it seems to work. No annoying, unneeded scrollbars appear. But this seems like an inelegant solution. Surely there is a better way!
|
|
|
|
|
I suppose the code you indicated is in a method of the Form View, right? Did you try to resize the view using /*CFormView::*/SetWindowPos() instead of AfxGetMainWnd()->SetWindowPos() (which would resize the main frame) and then calling ResizeParentToFit which should resize the Main Frame according to the size of the view?
|
|
|
|
|
I'll try that when I get home.
Thanks!
|
|
|
|
|
K(arl) wrote:
As I understand it, you want to force the size of your application. I would do so by resizing the MainFrame object, using CMainFrame::SetWindowPos. Then I would catch the WM_SIZE message in the Form View to handle controls size and position changes.
Oh, and you can manage the way your view handles scroll bars by overring CScrollView::SetScrollSizes.
OK, now I understand what you meant.
What I am doing now is use WindowSetPos() and SetScrollSizes. Pretty much as you suggested. I didn't understand from the documentation what SetScrollSizes did. It just sets the the threhold for window size for when the scrollbars appear. Which is what I needed.
Thanks for your help.
|
|
|
|
|
I know the information is out there and I am just missing it. Of course there is the overwhelming amount of information out there.
OK, here it is: I am trying to understand the VC++ .NET environment and having no luck. I have one window that has a text box and a button. The button calls another form there text is entered or edited. A button on that form hides that window. What I am trying to do is to get the edited text from the second window into the first, calling window and pass it to the text box there.
Most everything I have been seeing around is for C# and I intend on moving in that direction, but my professor has insisted we use VC++ .net for this project. Sadly, I may have no hair left when we are done.
Help?
Thom
|
|
|
|
|
When you create a second form, add a method that returns GetWindowText() from the control in question. That'll be the string. If you want to get the text AFTER the form closes, store it in a variable when the form closes, because once it's gone, it's gone
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks, I will give it a try. I ahve spent a lot of time looking at help files and search engines, the lines of text are squirming. It would help if that GUI/OOP class taught more than puting pretty lines in a graphic window.
Thom
- Hind sight is always 20/20 -
|
|
|
|
|
LordTygger wrote:
It would help if that GUI/OOP class taught more than puting pretty lines in a graphic window.
Yeah, for sure.
LordTygger wrote:
- Hind sight is always 20/20 -
Megadeth ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I have to make a thumbnail List Ctrl with checkbox extended style, But I found that each item size in ICON style is different, if the file name is long the default size for the Item will be bigger.
For example: SetImageList(&myImageList,LVSIL_NORMAL), the size for myImageList is 100*100.
Then in the OnCustomDraw function, I use:
GetItemRect(nItemIndex,&rcBound,LVIR_BOUNDS);
if the file name's length is shorter than the 100,
the rcBound's width is 116, but if the file name is longer than 100, the rcBound's widht will increase automatic!!
When I set the checkbox extended style, the checkbox will be draw just beside the thumbnail, if the file name is not long enough, some part of the checkbox will out of the ListCtrl item area by default, in this condition, I can not draw the checkbox properly!!
So my question is:
Is there any way to change the ListCtrl Item size?
Or Is good solution to show both the thumbnail and checkbox?
Thanks a lot! Any comment is appreciate!!
|
|
|
|
|
Any help for using SendMessage or any equivalent in the richedit view for typing the character that is at 0x80 position of the font map.
I used like SendMessage(WM_CHAR, '\x080',0) which is not working.
Thanks
Jai Srimannarayana
|
|
|
|
|
I have a listctrl in report view but if I type in more than
259 characters, it just acts really wierd. It like moves data to the next line or cuts it off.
Any idea on how to resolve this? Please any response any
one can give me will be greatly appreciated.
Sincerely,
Danielle (an overworked gradaute student)
|
|
|
|
|
Hi,
Office 2003 provides smart tag functionality to outlook if Word 2003 is the default email editor. Oulook uses InternetExplorer_Server
class window to show the messages composed using MS-Word or HTML
format and this window is capable of displaying smart tags. Messages
composed in Plain Text or Rich Edit are displayed in RichEdit20W
class window and this window cannot show smart tag information.
My problem is to provide smart tag kind of functionality to this
RichEdit20W class window. Is there any way to get the handle of
email viewer window of outlook?
One more behaviour I've observed that the smart tag information is
embeded into the message at the time of composing the message and
not at the time of viewing it. My requirement is to recognize smart
tags at the time of viewing the mails. I can choose any editor for
composing the message and any editor for viewing the message. I want
the smart tag functionality be available in every case.
Please help me if you have any idea in this regard.
- Rajeev
|
|
|
|
|
This is my first crack at Multithreading and I am going to do it on MFC.
I read that MFC has 2 types of threads (The User Interface Thread and The Worker Thread). Obvious one is for the GUI Message Queue and the other is for the programs internal Work. Now onto my question:
1). Since an MFC program already has a its main thread that does all the work when you open the program, could I just leave that as the GUI thread and make one more thread as the worker thread? Or Do I have to make one thread for each?
Thanks
|
|
|
|
|
|
Hi all,
I want to list all the computers in a local network.
Computers name or IP address.
And is there any way to send messages to a compuetr with its
mac address of its adapter?
Thanks.
|
|
|
|
|
dSolariuM wrote:
I want to list all the computers in a local network.
Computers name or IP address.
NetServerEnum<br />
NetServerGetInfo
dSolariuM wrote:
And is there any way to send messages to a compuetr with its mac address of its adapter?
Dunno Know about sending message with Mac Address but you send message using NetMessageBufferSend api if you know server name
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Does anyone know where i can get the code to convert numbers to words using C++?
Looking for something basic, a few simple functions etc...
Example: "123"
"One hundred and twenty three"
|
|
|
|
|
Here are a few examples:
http://www.barasch.com/excel/cCo11432.htm
http://ourworld.compuserve.com/homepages/easysurf/cnvert18.htm
http://www.ozgrid.com/VBA/ValueToWords.htm
http://www.cs.bris.ac.uk/home/pehlivan/post/example/sec09.html
http://www.codeguru.com/Cpp/Cpp/algorithms/general/article.php/c9139/
http://www.google.com/search?hl=en&q=convert+numbers+to+words&btnG=Google+Search
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I brought home an MFC project and am now wanting to take it back to work tomorrow. Problem is my CD burner wont copy the huge .pch files (in debug and release directory). It gets to that point and just stays there with no apparent progress. Will it be okay if I remove these .pch f iles from my copy here at home, take the rest of it to work and copy over the .pch files from friday which are at work?
Thanks,
sb
|
|
|
|