|
DavidCrow wrote:
Just add a picture control to the dialog's template. Change it's type to either Icon or Bitmap.
how do i do that by code?
/\|-||\/|/\|)
|
|
|
|
|
Click on the Picture Control icon in the Toolbox window and then click in the dialog's template where you want the control placed. It's just like adding any other control (e.g., button, listbox).
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
how can i do that by code
/\|-||\/|/\|)
|
|
|
|
|
Exactly what do you mean "by code?" What I showed you will modify your project's .RC file, which is code your project needs in order to run.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i mean i nedd to create this image dynamically at run time so i need to write physically the code not using the rc interface
/\|-||\/|/\|)
|
|
|
|
|
Check out:
CBitmapButton
CButton::SetIcon()
CButton::SetBitmap()
CStatic::SetIcon()
CStatic::SetBitmap()
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Ok thx i have just discovered how using setbitmap
/\|-||\/|/\|)
|
|
|
|
|
hi again
Ok i need now to move the picture i have created in runtime how do i do that?
/\|-||\/|/\|)
|
|
|
|
|
How about MoveWindow() or SetWindowPos() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I can't use them with my image i have tried
how can i associate ID_image to be able to move it
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
I can't use them with my image i have tried
But since you have not shown what code you tried with, how can I determine if you did it correctly or not?
Halawlaws wrote:
how can i associate ID_image to be able to move it
Based on what little I know of your problem, I'd start with GetDlgItem() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i cant use them
i dont have a class or a struct to call them all i have is the id of the image:ID_IMAGE
/\|-||\/|/\|)
|
|
|
|
|
Halawlaws wrote:
i dont have a class or a struct to call them...
What does having a class or struct have to do with being able to use MoveWindow() or SetWindowPos() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
What does having a class or struct have to do with being able to use MoveWindow() or SetWindowPos()?
If u dont have a class and u use MoveWindow() the only thing that will move is the dialog u must specify that u want the image.
how do u do that?
/\|-||\/|/\|)
|
|
|
|
|
Perhaps you are confused as to what MoveWindow() does. It changes the position and dimensions of the specified window, whether that window is a dialog, control, or a frame. If the window in which you are wanting to move has child windows (e.g., dialog having controls), all of them are moved too.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi guys,
Can anybody give me a explicit explanation about what is a HWND(handle to a window) , what does it differ from a CWnd object ?? Please provide examples if you can.
I've searched in MSDN but could not get enough information
Regards ,
Nick
|
|
|
|
|
I think it's like this: An HWND is a number (handle) to a window (dialog, edit box, etc) that is used by the Windows operating system to refer to the window specifically. CWnd is just an MFC class that encapsulates a registered window class and its handle. You could just as easily make up a class called CMyWindow and in the constructor have it call the Windows API to create a window of the type you want (button, for instance) in your class's constructor, then have the HWND be a property of your class. CWnd is just an encapsulating class, as is CListBox, CComboBox, etc.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Thanks for reply,
So is a HWND smth like : "CWnd object - template resource" .
Does it mean that if i have a handle to a window ,
i can use all methods declared in a CWnd for this window???
sorry i don't get it
|
|
|
|
|
Well, CWnd is an MFC class. You can get an HWND to a window just using the Windows API to create a window, then registering it. If you're using a CWnd class, you can just use the methods of the class; it takes care of all the HWND stuff for you (usually). So if you're using a CWnd-derived object, you probably don't need to use an HWND
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
A handle is nothing more than a token that an application can use to identify and access an object such as a device, a file, a window, or a dialog box.
See here for what CWnd is and is not.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
You can get the CWnd (or the corresponding class) pointer from the handle by using FromHandle(HWND hWnd) so you'll be able to use the advantages from the 2 ways.
Marc.
|
|
|
|
|
CWnd is wraps the Window handle and window handle related API's into a single Class.
suhredayan There is no spoon.
|
|
|
|
|
I have got the project which on executing opens the window without title bar
it is MFC project window stays there where it gets opened
how can i drag window from one place to another on my computer screen
initially position is set like this
this->m_MainDialog.SetWindowPos(&CWnd::wndTop,100,100,0,0,SWP_NOSIZE);
this->m_MainDialog.ShowWindow(SW_SHOW);
please help
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|
|
Override the WM_LBUTTONDOWN message handler , like this :
void CYourClass::OnLButtonDown(UINT nFlags , CPoint point)
{
SendMessage(WM_NCLBUTTONDOWN,HTCAPTION);
}
"Success is the ability of going from one failure to another with no loss of enthusiasm" - W.Churchill
|
|
|
|
|
when i right click on my dialog box window and right click on my class wizard it gives error
classWizard database E:\oda\source\ODA.dw does not exist
Ankit Aneja
"Nothing is impossible. The word itself says - I M possible"
|
|
|
|