|
Yes, the HWND is correct (i see a pointer).
It must be correct, because the user uses already this view and
opens the dialog if he wishes
FPopUpListe::FPopUpListe(CWnd* pParent_t,CString Funktion_t,CWnd *Komp_t,void *Value_t)
: CDialog(FPopUpListe::IDD, pParent_t)
{
Funktion = Funktion_t;
Parent = pParent_t;
Komp = Komp_t;
Value= Value_t;
Liste = NULL;
}
I send pParent_t to the Dialog Constructor.
Parent is a class-variable which i use to get/see faster the Parent of the control
|
|
|
|
|
baerten wrote: Yes, the HWND is correct (i see a pointer).
The view object may be instantiated but the corresponding window may not be created. To ensure the window is created, you could use something like
<br />
ASSERT((pView != NULL) && (pView->GetSafeHwnd() != NULL);<br />
baerten wrote: Parent is a class-variable which i use to get/see faster the Parent of the control
Why don't you use CWnd::GetParent() when you need it?
I'm searching for ideas, I'll come back as soon as I get one.
There are two things that one must get used to or one will find life unendurable: the damages of time and injustices of men
Fold with us! ¤ flickr
|
|
|
|
|
ASSERT((pView != NULL) && (pView->GetSafeHwnd() != NULL); --> ok, no Assertion
Big thanks ! Thats very nice
Merci, très gentil de vous.
|
|
|
|
|
I use VS2005 since few days....
I need to modify the status of a menu item (enabled/not enabled)
when the user opens the menu. In VS6 I used OnUpdate method for
any menu item. That method was called before showing the menu item
so I was able to modify its status.
Now in VS2005 the OnUpdate method is called when I click on the
menu item and not when I open it.
What is changed ? can someone help me ?
thank a lot !
|
|
|
|
|
ilgale wrote: In VS6 I used OnUpdate method for
any menu item.
Is there any reason, for not using ON_UPDATE_COMMAND_UI ?
|
|
|
|
|
This[^] is the preferred way to set the status of a menu item.
/ravi
|
|
|
|
|
how can i display the bitmap on ListView using CreateBitmap function?
<br />
void CThumbBmpView::OnPaint()<br />
{<br />
CPaintDC dc(this);
<br />
<br />
CRect r;<br />
GetClientRect(&r);<br />
<br />
CXTPBufferDC memDC(dc, r);<br />
memDC.FillSolidRect(r, (RGB(255,255,255)));<br />
<br />
OnPrepareDC(&memDC);<br />
OnDraw(&memDC);<br />
<br />
<br />
<br />
}<br />
<br />
<br />
<br />
void CThumbBmpView::OnDraw(CDC* pDC)<br />
{<br />
<br />
HANDLE hFile;<br />
DWORD dwNumberOfBytesToRead;<br />
DWORD dwNumberOfBytesRead;<br />
<br />
<br />
<br />
hFile = CreateFile( "D:\\preview.bmp",<br />
GENERIC_READ, <br />
FILE_SHARE_READ,<br />
NULL,<br />
OPEN_EXISTING,<br />
FILE_ATTRIBUTE_NORMAL,<br />
NULL );<br />
<br />
if( hFile == INVALID_HANDLE_VALUE )<br />
{ <br />
MessageBox( "Invalid Handle", "ERROR", MB_ICONERROR);<br />
<br />
}<br />
else<br />
{<br />
BYTE *Buffer;<br />
DWORD p=SetFilePointer( hFile, 0x000, NULL, FILE_BEGIN );<br />
<br />
Buffer = new BYTE [2363392+1];<br />
<br />
BOOL bResult = ReadFile( hFile,<br />
Buffer,<br />
2363392,<br />
&dwNumberOfBytesRead,
NULL<br />
);<br />
<br />
if(!bResult)<br />
MessageBox("Error");<br />
<br />
<br />
<br />
<br />
<br />
if(!bitmap.CreateBitmap(1000,500,1,32,Buffer))<br />
MessageBox("cant Create Bitmap");<br />
<br />
}<br />
CDC dcCompatible;<br />
if ( !dcCompatible.CreateCompatibleDC( pDC ) )<br />
{<br />
return;<br />
}<br />
CBitmap* pOld = dcCompatible.SelectObject( &bitmap );<br />
<br />
BITMAP bmInfo;<br />
if ( bitmap.GetObject( sizeof( bmInfo ), &bmInfo ) != 0 )<br />
{<br />
pDC->BitBlt( 0,0, bmInfo.bmWidth, bmInfo.bmHeight, &dcCompatible, 0,0, SRCCOPY );<br />
<br />
}<br />
<br />
dcCompatible.SelectObject( pOld );<br />
<br />
}<br />
<br />
<br />
Regards,
Srinivas
|
|
|
|
|
vasu_sri wrote: CDC dcCompatible;
if ( !dcCompatible.CreateCompatibleDC( pDC ) )
this will not work. Yous should pass the pointer of original device context. it can be modified as follows
CClientDc dc(this)<br />
CDC dcCompatible;<br />
if ( !dcCompatible.CreateCompatibleDC( &dc ) )
nave
|
|
|
|
|
I don't think this is the problem. Actually I don't think it is a problem.
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.
|
|
|
|
|
I bet itwill not work unless you change it.
nave
|
|
|
|
|
And why?
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.
|
|
|
|
|
|
Good (though empirical) point. I will try...
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.
|
|
|
|
|
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.
|
|
|
|