|
Thank you evryone for ur help
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
How can I add a dialog to Cview?
|
|
|
|
|
Create a new dialog class and make it a member variable for modeless, or create it in the scope of the function that calls it for modal dialogs.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
By that I mean embedded a modal dialog inside a SDI view.
|
|
|
|
|
Embedding in what way ? So the modal dialog is part of the CView window ? Or just so that the modal dialog is shown by the view ? If the former, you can't. If the latter, exactly as I said. In your view, create the dialog class, and call DoModal on it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Use CFormView
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
This is an assignment and we're recommanded not to use CFormView, but somehow to mimic the CFromView ways
|
|
|
|
|
Oh. You said a 'Modal dialog'. Otherwise, I'd have said to use CFormView. CFormView gives you a dialog like view, it does NOT 'add a modal dialog to your CView'.
If you're not allowed to use CFormView, then create your own controls, and embed them into your CView in your view constructor.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
According to assignment specification, It is feasible to add modal dialog to CView, and add controls to this dialog.
|
|
|
|
|
Hmmm - perhaps you can add a dialog, but it can't possible be modal, that's not what modal means.
I'm going to have a play with this.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
OK, if you create a dialog, set it's style to be 'CHILD', and then make it a member variable and do this:
BOOL CVC6CViewView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
BOOL b = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
dlg.Create(IDD_THEDIALOG, this);
dlg.SetParent(this);
dlg.ShowWindow(SW_SHOW);
return b;
}
Then you end up with the dialog embedded in your view. The Create function is registered as a handler for the Create event, obviously.
It's still not modal. You could make it modal by ignoring the rest of the view until OK is clicked, and responding to OK by closing the dialog, but overall, I'd say that's not what's required, I can't imagine why it would be.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How can I set the background color when I initial the view ? I want to set it black.
|
|
|
|
|
One way is to handle WM_ERASEBKGNBKD and paint the background there.
John
|
|
|
|
|
I know how to do that in visual c++ NET. But I cant use Filestream bec I am using visual C++ 6.0. I know. I know. it is so old but I have no choice. so how can I convert byte array to image(or binary) that will insert data to sql database.
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), strPath, IMAGE_BITMAP, 100,140,LR_LOADFROMFILE | LR_CREATEDIBSECTION);
CBitmap mybmp;
mybmp.Attach((HBITMAP)hBitmap);
BITMAP sBM;
mybmp.GetBitmap(&sBM);
//add new pics
BYTE* pbOldBitmapBits = new BYTE[sBM.bmWidthBytes*sBM.bmHeight];
mybmp.GetBitmapBits(sBM.bmWidthBytes*sBM.bmHeight, (LPVOID)pbOldBitmapBits);
m_Picture.SetBitmap((HBITMAP)mybmp);
char c[10];
itoa(sBM.bmWidthBytes,c,10);
CString strTemp = c;
BSTR bstrWidth = strTemp.AllocSysString();
strTemp.Empty();
itoa(sBM.bmHeight,c,10);
strTemp = c;
BSTR bstrHeight = strTemp.AllocSysString();
spIPlasmaConsumables->AddConsumablePictures(m_spIUnkConnection,"TEST1",pbOldBitmapBits,bstrHeight,bstrWidth);//add new image at sql database
pbOldBitmapBits(bytes) convert to image(binary)
Remember I cant use C++ .NET at all
use Visual c++ 6.0 only
|
|
|
|
|
If you're loading from file, load as a DIBSection, then you get a pointer to the bits. You can copy this into SQL Server, if you must, and then use it to recreate the image. I guess you'd also need to store the width, height and bit depth though.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi , i am first time working with VC++,
now i have to write my thesis report, nayone can help me with sending me thesis reports of projects done in VC++.
thanking you
|
|
|
|
|
Just out of curiosity, why would you want to write a thesis whose content uses a tool/language that you have no experience with? This would not seem like a good time to learn a new tool, especially if you have a time constraint.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
sheshidar wrote: sending me thesis reports of projects done in VC++.
HAHAHAHAHAHAHAHAHAHAHHAAHAHAHA !!!
You ARE joking, right ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
|
It reminded me of this[^]
are you one of those girls?
-prakash
-- modified at 22:57 Monday 17th October, 2005
|
|
|
|
|
Mr.Prakash wrote: are you one of those girls?
Seems to be
"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
|
|
|
|
|
I'm trying to use CObList with a class I created. The class I created I inherited CObject.
class CFAFRecord : public CObject
{/*data*/}
I'm able to create this and insert it into the CObList. But when I try to access the list with m_variable.GetNext(m_curPosition); and I try to assign it to a CFAFRecord object, I get the error, 'cannot convert 'class CObject' to 'class CFAFRecord'.
It won't let me typecast it. It looks like it's not recognizing that CFAFRecord is a CObject. Any help here?
Danny
The stupidity of others amazes me!
|
|
|
|
|
First bit of advice is to drop CObList and use STL's std::list instead. If you can not do that and have compeling reasons to use CObList maybe you could post some code showing how you are trying to cast the returned pointer.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|