Do we have the capability of loading images and placing them into windows?
Found a solution on my ownÂÃ, 8)
dlg::OnInitDialog(), int
{
ÂÃ, string sText;
ÂÃ, CStatic *pLabel;
ÂÃ, unsigned int hImage;
ÂÃ, sText = "Program Name\n"ÂÃ, Ã‚Ã, Ã‚Ã, Ã‚Ã, Ã‚Ã, Ã‚Ã, Ã‚Ã, Ã‚Ã, Ã‚Ã, +ÂÃ,Â
ÂÃ, Ã‚Ã, "ÂÃ,© 2006 Campanile Data Systems\n" +
ÂÃ, Ã‚Ã, "All Rights Reserved\n\n"ÂÃ, Ã‚Ã, Ã‚Ã, Ã‚Ã, Ã‚Ã, +
ÂÃ, Ã‚Ã, "Version 0.01 1/21/06";
ÂÃ, pLabel = GetControl(lblAboutText);
ÂÃ, pLabel ->SetText(sText);
ÂÃ, hImage = LoadImageA(GetModuleHandleA(0),"chezp",0,0,0,0); // "chezp" is resource id
ÂÃ, if (hImage = null)
ÂÃ, Ã‚Ã, MessageBox(0,"Image failed to load","Internal Error",0);
ÂÃ, pLabel = GetControl(lblAboutImage); // static control, SS_SUNKEN for nice look
ÂÃ, pLabel ->SetImage(hImage);
ÂÃ, CenterWindow();
ÂÃ, return true;
}
The image functions are not done yet. We will have load and show image soon.
Quote from: Ionic Wizard on January 22, 2006, 12:37:38 PM
The image functions are not done yet.ÂÃ, We will have load and show image soon.
I thought so. However, it's good for me to see if I can figure this stuff out while we wait for the language to be fleshed out. One cannot have too much experience with MSDN and the API!
You did a good job ;)
Both the button and static classes have a SetImage method. If creating your controls manually, without the dialog editor, use the styles ABS_BITMAP or ASS_BITMAP.
Paul.
Here is an example of putting an image onto your main window:
global sub main()
{
ÂÃ, def winMain as myWindow;
ÂÃ, CStatic Image;
ÂÃ, winMain.Create(0,0,640,440,
ÂÃ, Ã‚Ã, AWS_CAPTION|AWS_VISIBLE|AWS_BORDER|AWS_SYSMENU|AWS_AUTODRAW|AWS_SIZE|
ÂÃ, Ã‚Ã, Ã‚Ã, AWS_MAXIMIZEBOX|AWS_MINIMIZEBOX,
ÂÃ, Ã‚Ã, Ã‚Ã, 0," Cafe Critique",NULL);
ÂÃ, winMain.SetWindowColor(GetSysColor(15));
ÂÃ, Image.m_hwnd = CreateWindowEXA(0,"STATIC","",
ÂÃ, Ã‚Ã, ASS_BITMAP|AWS_CHILD|AWS_VISIBLE|SS_NOTIFY|SS_CENTERIMAGE|SS_SUNKEN,
ÂÃ, Ã‚Ã, 30,30,
ÂÃ, Ã‚Ã, 170,255,
ÂÃ, Ã‚Ã, winMain.m_hwnd,1,GetModuleHandleA(0),null);
ÂÃ, Image.SetImage(LoadImageA(GetModuleHandleA(0),"chezp2",0,0,0,0)); //chezp2 = resource ID
ÂÃ, // message loop
ÂÃ, do
ÂÃ, {
ÂÃ, Ã‚Ã, wait();
ÂÃ, }until winMain.m_run = 0;
ÂÃ, return 0;
}
(It's just a scrap and won't compile as is.)