|
To know the colors used you can use ReadConsoleOutput .
To know tho cursor position I think you can use GetConsoleSelectionInfo .
Russell
|
|
|
|
|
Big thanks!
It works great, but not with PDCurses
|
|
|
|
|
Hi all,
How can one catch the event of the 'End Task', generated from the task manager window? Why do I want to know, to prevent users from closing certain applications.
Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
I think you'll find it impossble to stop the user unless they don't have permissions to end the task, have you thought about making you application a Service ?
|
|
|
|
|
I know there is a WM_QUERYENDSESSION message which will occured during shutdown.
If u can Dream... U can do it
|
|
|
|
|
Hello All..
I am trying to draw a bitmap as background for the status bar. I have derived my own status bar from CStatusBar. When I try to override OnPaint ().. it erases the default status bar messages and panes.. I tried to change the Device Context on OnCreate () and OnNCPaint () both are not working here is the code.
<br />
void CMyStatusBar::OnNcPaint()<br />
{<br />
CDC* pdc= GetWindowDC();<br />
<br />
CDC memdc; <br />
memdc.CreateCompatibleDC(pdc); <br />
memdc.SelectObject(m_hBmp); <br />
pdc->BitBlt(0, 0, <br />
m_rectLogo.Width(), <br />
m_rectLogo.Height(), <br />
&memdc, 0, 0, SRCCOPY); <br />
<br />
ReleaseDC(pdc); <br />
}<br />
<br />
int CMyStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CStatusBar::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
m_hBmp = (HBITMAP)LoadImage(AfxGetInstanceHandle(), <br />
MAKEINTRESOURCE(IDB_BKCOLOR_BMP), IMAGE_BITMAP, <br />
0, 0, LR_CREATEDIBSECTION);<br />
<br />
BITMAP bm;<br />
GetObject(m_hBmp, sizeof(bm), &bm); <br />
<br />
m_rectLogo.left = 15;<br />
m_rectLogo.right = 15 + bm.bmWidth;<br />
m_rectLogo.top = 2 ;<br />
<br />
return 0;<br />
}<br />
Next I tried to create a solid brush (for testing) in OnCreate and tried to select that object but that is also not working
<br />
int CMyStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CStatusBar::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
if (!m_oBrush.CreateSolidBrush (RGB(255, 0, 0)))<br />
AfxMessageBox ("Error in creating brush");<br />
<br />
GetStatusBarCtrl().GetDC ()->SelectObject (&m_oBrush);<br />
<br />
return 0;<br />
}<br />
I am unable to change the DC of the status bar.
Let me know how to draw a bitmap as back ground for a status bar?
Thanks for your time
|
|
|
|
|
Ok . Try CDC->fillsolidrect instead of bitmap painting. iF it not works , problem may with ur dc handle .
If u can Dream... U can do it
|
|
|
|
|
Thanks for quick response. I am looking for chaging the background with an image. The function fillsolidrect changes the full color of the status bar.
|
|
|
|
|
Ok , i tried it and got the result.
try moving the same code to onpaint.
If u can Dream... U can do it
|
|
|
|
|
I tried to override OnDraw () but all panes are not getting painted I am getting solid rectangle image on full status bar. here is the code
void CMyStatusBar::OnPaint()<br />
{<br />
CPaintDC dc(this);
RECT rect;<br />
GetClientRect (&rect);<br />
dc.FillSolidRect (&rect, RGB(255, 124, 20));<br />
}
If I remove FillSolidRect function the status message, panes are not visible.
Please help me out.
Thanks for your time.
|
|
|
|
|
|
Thanks... Here is an easy solution for that, you can call SetBkColor () directly. it will change the back ground color.
m_wndStatusBar.GetStatusBarCtrl ().SetBkColor (RGB ( 255, 255, 22));
Thanks for your time
|
|
|
|
|
Ok. But you said you need to Draw image as a background . I think there is no function to set background image. you need to handle drawitem
If u can Dream... U can do it
|
|
|
|
|
You are right... I could achieve drawing background color, but not image.
Here is the code
<br />
void CMyStatusBar::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)<br />
{<br />
CDC dc;<br />
dc.Attach(lpDrawItemStruct->hDC);<br />
<br />
CRect rect(&lpDrawItemStruct->rcItem);<br />
<br />
switch(lpDrawItemStruct->itemID) {<br />
<br />
case 0:<br />
dc.FillSolidRect (rect, RGB (255,255,0));<br />
break;<br />
here is the code in mainfrm.cpp in OnCreate () function
for (int i=0; i<4; i++)<br />
{<br />
m_wndStatusBar.GetStatusBarCtrl().SetText("", i, SBT_OWNERDRAW); <br />
}<br />
Since it is owner draw.. DrawItem is called. but FillSolidRect is getting executed but no change in UI. I tried to use CDC functions like TextOut, rectangle,etc.. UI there is no change.
Can you say why is this behaviour? What went wrong
Thanks for your time.
|
|
|
|
|
Because after your oncreate the framework again calls some SetText(with default stats messages , in that it is not ownerdraw)for puttif default messages for file -> new ,etc. So ur changes are lost.
If u can Dream... U can do it
|
|
|
|
|
Sorry i forgot to say this , Also put m_wndStatusBar.SetPaneStyle(0,SBPS_OWNERDRAW); in ur on create. 0 -> pane number .
this will be ok.
If u can Dream... U can do it
|
|
|
|
|
How to change a Dialog Form's scrollbar's color?
|
|
|
|
|
try WM_CTLCOLOR
If u can Dream... U can do it
|
|
|
|
|
See WM_CTLCOLORSCROLLBAR .
|
|
|
|
|
Hello Every body,
I had developed an application of attendenceManagement, where Payslip is generated at every 30th of month and that should be sent to each employee mail address, so how can i save a payslip and forward to every empolyee.
Help me.
Sundeep
|
|
|
|
|
Wrong forum, try here, C#[^]
|
|
|
|
|
Oh an C#.Net question on the C++ forum?;)
|
|
|
|
|
Hello
If I want to perform a web based installation like what Symantec anti virus provides for installing updates, what are the things we have to take into consideration. I am new to web based development and unaware of the various factors to be considered during web based development. Is it possible in VC++ ?
Thanx.
|
|
|
|
|
How to write partial scanline to other TIFF file?
|
|
|
|
|
The Tiff file consist of tags and to insert the scan line the 256 and 257 tag should be added to tiff file which denotes the acutal scanline width and hight, and other tags attributes should be filled appropriately.
Its better to insert these tags and scan line data at end, if it is inserted in between then we end up shifting the details of each tag by that offset
I hope this will help in finding the right solutions.
Regards
Sunil Tonger
|
|
|
|