|
Hi All,
Over the past few weeks I have been trying all sorts of different ZIP examples found in CodeProject but all of them I can seem to get going under Visual Studio 2005.
The application is a CLR Console App.
Anyone suggest one that can be successfully used under VS2005 ?
Cheers...
Pete
|
|
|
|
|
I want to create a window in which both the Non-Client and the Client are owner-drawn.
I know that I have to handle the WM_NCPAINT and WM_NCACTIVATE messages for Non-client drawing and WM_PAINT message for Client drawing.
For a simple test I added the following code in a Dialog based Application
BOOL COwnDrwDlg::OnNcActivate(BOOL bActive) <br />
{<br />
if (bActive)<br />
{<br />
CRect rect;<br />
GetWindowRect(&rect);<br />
<br />
CBrush FB(RGB(0, 80, 0));<br />
CPaintDC dc(this);<br />
CBrush* pOld = dc.SelectObject(&FB);<br />
dc.Rectangle(&rect);<br />
dc.SelectObject(pOld);<br />
}<br />
<br />
return true;<br />
}<br />
<br />
void COwnDrwDlg::OnNcPaint() <br />
{<br />
CRect rect;<br />
GetWindowRect(&rect);<br />
<br />
CString str;<br />
str.Format(_T("OnNcPaint : Width = %d Height = %d"), rect.Width(), rect.Height());<br />
TRACE(str);<br />
<br />
CBrush FB(RGB(0, 80, 0));<br />
CPaintDC dc(this);<br />
CBrush* pOld = dc.SelectObject(&FB);<br />
dc.Rectangle(&rect);<br />
dc.SelectObject(pOld);<br />
}<br />
<br />
void COwnDrwDlg::OnPaint() <br />
{<br />
CRect rect;<br />
GetClientRect(&rect);<br />
<br />
if (IsIconic())<br />
{<br />
CPaintDC dc(this);
<br />
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);<br />
<br />
int cxIcon = GetSystemMetrics(SM_CXICON);<br />
int cyIcon = GetSystemMetrics(SM_CYICON);<br />
int x = (rect.Width() - cxIcon + 1) / 2;<br />
int y = (rect.Height() - cyIcon + 1) / 2;<br />
<br />
dc.DrawIcon(x, y, m_hIcon);<br />
}<br />
else<br />
{<br />
CBrush FB(RGB(80, 0, 0));<br />
CPaintDC dc(this);<br />
CBrush* pOld = dc.SelectObject(&FB);<br />
dc.Rectangle(&rect);<br />
dc.SelectObject(pOld);<br />
}
I thought this much code would result in a window having a green outer rectangle and a dark red inner rectangle, minus the system buttons.
But it did not happen. All I got was captionless grey window.
Where did I go wrong? Where I can get a good documentation regarding painting the non-client area efficiently?
Cutebug
|
|
|
|
|
You could try CWindowDC instead of CPaintDC in OnNcPaint. I don't think you need handle OnNcActivate, just check the state of the window in OnNcPaint (i.e. does it have the focus, etc).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
How do i write using SetItemData/GetItemData to link items listed in the droplist(combobox) to certain files(.txt)? Is there any examples i can refer to?
Thanks A Lot
|
|
|
|
|
cyn8 wrote: How do i write using SetItemData/GetItemData to link items listed in the droplist(combobox) to certain files(.txt)?
You question is not clear...
Do you want to see all the txt files in a directory listed in your combo box, then take a look at DlgDirListComboBox .
|
|
|
|
|
In my application i have another edit box and a browse button to find a file and load it. But I want to be able to create a link from the droplist to the edit box to load the respectful files according to the item listed in the combobox droplist.
for example...
in the drop list, it has:
item1
item2
item3
by selecting one of them, eg. "item1".....
Item1 will be directed to location example "c://File1.txt"
the edit box will also show "c://File1.txt" and the file will be automatically load it
May i know how to do this?
Thanks
|
|
|
|
|
cyn8 wrote: from the droplist to the edit box to load the respectful files according to the item listed in the combobox droplist.
There are two event notifications for this purpose...
1. CBN_SELCHANGE
2. CBN_SELENDOK
You can handle either of them to handle change of combobox items. In this event handler write the code for displaying file contents.
|
|
|
|
|
Nibu, Where is Naveen, Nishad etc...
|
|
|
|
|
I tried and failed to contact you by phone... why cant you mail me...?
- NS -
|
|
|
|
|
Its very nice to contact you later. Really I miss you all badly. I still love NeST and all NeSTians very much.
It is very sorry to say that I was forced to follow the path of Shameer Ebrahim. I have two reasons to leave from there with out sayinng any word to any.
Mainly I fear the disgrace and secondly I want to come back there just like after a long leave.
Sorry Sorry Sorry....
Currently I am not using any mobile that's why no one can get me through the phone. I shifted to C# and working for a US Client with a little better salary.
I feel NeST is a heaven and sure I have to come back there. Contact you al later..
Where is Prince of Common Controls ( Mr.Naveen )
Please convey my regards to all there.
Bye
With lots of love
Benoy Bose
|
|
|
|
|
I am really sorry because I am very busy now. I am with one of my colleague
Could you contact me later...?
- NS -
|
|
|
|
|
Benoy Bose wrote: Where is Prince of Common Controls ( Mr.Naveen )
hi benoy... I am here..
Now a days very busy with the projects...Dont have time to spend in code project.. well where r u now?
nave
|
|
|
|
|
I think you were so busy, since there are no log in the code project. Here I am not at all busy and having a lot of free time.
Please convey my regards to
Sankar, Ajesh, Prince and Rinu
|
|
|
|
|
Hi, I want to display the output from my hardware which is a squarewave In this dialog based application, i must be able to zoom in/out of the display. May i know which is more approriate, using picture control or custom control? How should the codes be written and are there any good examples for me to refer? I'm a begineer here
Thanks in advance
|
|
|
|
|
Hi,
I use the CRecordset.GetFieldValue to get the last row data. I want to know that is there have any faster way to get last row data
Thanks
|
|
|
|
|
I'm using Visual Studio Express.
I tried to output some data into a text file, I found that the file is encoded in UTF16. The wired part is that non-ASCII characters are in MultiByte encoding (all of them takes two bytes), but the ASCII ones got in UTF16 (which also takes two bytes), and the whole file has a UTF16 BOM.
The file is opened with fopen , and written with fprintf . My strings in my program all all unicode strings, so I had to write like this:
fprintf(" ");
fprintf("%ls", L"UNICODE STRING");
There is some non-ASCII characters in my unicode strings.
I used wide-char version functions in my program explictly, except for file operations (I didn't use wfprintf or wfopen). The charset for the project is set to "No set", and neither UNICODE nor MBCS is defined.
I have set the locale at the begin of main.
And I want to get a MultiByte file, how can get it?
Thanks in advance.
|
|
|
|
|
I would like to know how to detect the movement of Joystick in any windows?
Please help?
|
|
|
|
|
May i know how to use the scrolling control? How do you add it to the custom control to allow a horizontal scroll and also ensure that the squarewave drawn in that custom control is shift appropriately during scrolling. Is there any example on doing so?
Thanks in advance
|
|
|
|
|
cyn8 wrote: May i know how to use the scrolling control?
Your question is not clear!
|
|
|
|
|
I wonder how to periodically obtain and show mem usage in my program.
I think a Timer and thread technique are needed for this purpose. However, I am not sure and clear about this.
Please give me some hints and instructions.
Thanks
|
|
|
|
|
cy163@hotmail.com wrote: I think a Timer and thread technique are needed for this purpose. However, I am not sure and clear about this.
A timer should be okay, but both threads and timer is not a good idea. But timers doesn't give the precision that is required.
|
|
|
|
|
What is the exact acceptable range for creating your own custom command ids for menue items? I was trying to create a dynamic popup menu. Everything worked fine, I created menu item with AddMenu():
AddMenu(MF_ENABLED | MF_STRING, id, "aaa")
my id was the problem. The numbers I was using were conflicting I guess with MFC reserved numbers. I experimented a bit and found that if I used really high numbers, starting at say 400000, it worked. Otherwise I get multiple errors, such as the right id not being returned in the OnCommand() override, or the menu item being greyed.
|
|
|
|
|
|
Look up WM_USER in the help text. This is a #defined constant in the Windows header files that is always equal to the highest Windows message ID. Thus, you can safely define your own IDs starting at WM_USER + 1.
Beware, however, that some Windows common controls use IDs above WM_USER, so what I have done use WM_USER + 1000, + 1001, + 1002, etc., and I have not had any problems.
Scott
|
|
|
|
|
Hi. I am trying to create a pop up loading message. Something like the MessageBox function would do, but no buttons will be visible or enabled until done loading. The app is dialog based. Loading/Done loading will be controled in the main window, and the pop up will be a modal simply to prevent any action from the user in the main window until done loading. Is this possible? Thanks in advance.
|
|
|
|