|
In addition to the above post, you must bitblit the content from memdc to dc in the CThumbBmpView::OnPaint()function after the statement OnDraw(&memDC);
nave
|
|
|
|
|
I agree only on this (see my reply above). Additionally, the OP have to first select the bitmap inside the memDC. To summarize, the OP has to:
(1) Create a compatible (memory) DC
(2) Select the bitmap inside the memory DC.
(3) Preform Perform BitBlt from the MemDC to the actual one.
Hope that helps
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.
|
|
|
|
|
CPallini wrote: (1) Create a compatible (memory) DC
(2) Select the bitmap inside the memory DC.
I think the CXTPBufferDC will be hadling this.
nave
|
|
|
|
|
i did all what u asked me to do. i converted CDC to CClientDc. But still it doesn't work. i am doing this for the first time and so can u please explain me a little more clearly?? or can u give me any related link that can help me???
Regards,
Srinivas
|
|
|
|
|
if(!bitmap.CreateBitmap(1000,500,1,32,Buffer))
The bitmap file not only contains the pixel data information. It also contain a file header. But the CreateBitmap funtion only need bufffer information. So you must remove the header information from the buffer before passing it to CreateBitmap function.
But still I dont understand why you directly read the bitmap. My suggestion is to use the LoadImage() instead of this.
nave
|
|
|
|
|
Naveen R wrote: But still I dont understand why you directly read the bitmap. My suggestion is to use the LoadImage() instead of this.
its because i don't have the File name or the file path with me. i just have the addresses of the starting sector and ending sector of the image file to work with. i am then reading the data between those sectors (which is nothing but the data of the image file) into a buffer. now i want to show the preview of that image by just using the data in the buffer before storing it as a file. i am still not able to succeed in what i am trying to do.
Regards,
Srinivas
|
|
|
|
|
|
Can anybody tell me how to place a seprator in toolbar
example..
if i m making 2 buttons in serial n then i want a line to be displayed and then after that 2 more buttons...
How to make this line in between buttons
thanxs in advance
|
|
|
|
|
wrote: Can anybody tell me how to place a seprator in toolbar
If you are using the resource editor then slightly drag a button to the right then leave. You will see a separator.
Else through code use
TBSTYLE_SEP .
|
|
|
|
|
Got good help last week for changing text of listCtrl-header and I thougth, my problem is solved. I've the following code:
void koarkstewView::alterheadercontent()<br />
{<br />
LVCOLUMN lvc;<br />
CString titel;<br />
CListCtrl &listCtrl = GetListCtrl();<br />
koarkstewDoc* pDoc = GetDocument();<br />
<br />
karkst *karkstanz;<br />
karkstanz = pDoc->karkstanz;<br />
pDoc->SetTitle("KAR->KST");<br />
int i = 3;<br />
if (karkstanz->wdfirst())<br />
do<br />
{<br />
i++;<br />
titel = karkstanz->wdgetkarnr() + "\n";<br />
titel = titel + gettitel(0, karkstanz->wdgetdatenart(), karkstanz->wdgetvon(), karkstanz->wdgetbis());<br />
listCtrl.GetColumn(i, &lvc);<br />
lvc.pszText = titel.GetBuffer(0);<br />
titel.ReleaseBuffer(); <br />
listCtrl.SetColumn(i, &lvc);<br />
}<br />
while(karkstanz->wdnext());<br />
<br />
}
Works fine - but only in debug-mode!! In release-mode, the text doesn't change
But how to debug the code, if it work's in debug-mode
Any proposals?? Thanks, Gerhard
|
|
|
|
|
ensger wrote: listCtrl.GetColumn(i, &lvc);
lvc.pszText = titel.GetBuffer(0);
titel.ReleaseBuffer();
listCtrl.SetColumn(i, &lvc);
Modify this to,
LVCOLUMN lvc= {0};
listCtrl.GetColumn(i, &lvc);
lvc.mask = LVCF_TEXT ;
lvc.pszText = titel.GetBuffer(0);
titel.ReleaseBuffer();
listCtrl.SetColumn(i, &lvc);
Read this[^] article for better understanding of difference betn release and debug configuration.
|
|
|
|
|
Many thanks, it work's. And thank's for the link. I'll have to read cause I didn't recognice till yet, that programs that work in debug-mode maybe will not work in release-mode.
|
|
|
|
|
ensger wrote: didn't recognice till yet, that programs that work in debug-mode maybe will not work in release-mode
On broader level, in debug mode, lots of things would be taken care of. One of them is variable initialization.
In your case though, you did miss to mention mask. And its always good practice to initialize variables.
|
|
|
|
|
ensger wrote: lvc.pszText = titel.GetBuffer(0);
Why are you calling GetBuffer() unnecessarily? I don't see that you are modifying titel .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Because
lvc.pszText = titel;
results in an error-message like 'no operator defined, that accepts a right-sided operator of type 'class CString''. I didn't even know the existence of 'GetBuffer()' till last week - but it works
|
|
|
|
|
ensger wrote: ...but it works
Of course it does, but GetBuffer() exposes the underlying char* object to possible (unwanted) changes. Try:
lvc.pszText = (LPTSTR) ((LPCTSTR) titel); Now titel cannot be accidentally changed.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I tried and it works. And the sense of this statement is even more obvious for me.
So, many thanks
|
|
|
|
|
Hi all,
Again i m having a problem related to multi threading....
Actually now what i m trying to do is i want to start a thread within a timer that is that thread shold run in particular time intervals...
this i have done it n its workin fi9...
Now my problem is if i have to run this timer for multiple processes like
one timer for that thread s'ld run within 4s sec n other in 5sec like this.......
can anybody plz help me in this.........
thanxs in advance
|
|
|
|
|
I'm not an expert, but i try to help you
It's possibly to start more than one
Timer in a window ( view or dialog )
You have the Handler like this :
void XX::OnTimer(UINT_PTR nIDEvent)<br />
{<br />
switch(nIDEvent){<br />
case TIMER_1: <br />
Timer1Proc();<br />
break;<br />
case TIMER_2:<br />
Timer2Proc();<br />
break;<br />
case TIMER_3:<br />
break;<br />
default:<br />
break;<br />
}<br />
}
TIMER_1 , 2 , 3 is a define
-- modified at 6:53 Wednesday 28th February, 2007
|
|
|
|
|
Each timer can be identified by id.
Watch first parameter of SetTimer .
neha.agarwal27 wrote: it n its workin fi9...
p.s. Dont use SMS like english, for others disliking.
|
|
|
|
|
neha.agarwal27 wrote: ow my problem is if i have to run this timer for multiple processes like
one timer for that thread s'ld run within 4s sec n other in 5sec like this.......
creating new thread every time will be very troublesome as it take some resource.. so if you want to run your thread for 4 sec and 5 sec.. it will run for much higher time depending on CPU condition
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi all,
I want to Know how many and what type of controls that are placed in a Dialog Box.
For example :-
i place a Button,CheckBox,listControl,ComboBox.... etc in a Dialog.
from code i want to Iterate all the Dialog Controls in the Dialog and Let me know what controls i have placed in the Dialog.
for(i = 0; i< No of Controls in Dialog ; i++)
{
if(CheckBox) //Alert it is CheckBox.
if(ComboBox) //Alert it is ComboBox.
.
.
.
}
Please let me know it is very urgent.
|
|
|
|
|
Look up GetWindow and GetNextWindow in MSDN.
|
|
|
|
|
CRect rect;
this->GetWindowRect(rect);
CWnd* pWnd = this->GetWindow(GW_CHILD);
CRect rcWnd;
while (pWnd) {
pWnd->GetWindowRect(rcWnd);
if (rcTest.IntersectRect(rect, rcWnd) && pWnd != this) {
}
pWnd = pWnd->GetWindow(GW_HWNDNEXT);
}
|
|
|
|
|
You can use EnumChildWindows ,too.
BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
{
TCHAR className[256] = {0};
GetClassName(hwndChild,className,256);
return TRUE;
}
EnumChildWindows(m_hWnd,EnumChildProc,0);
|
|
|
|