Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

displaying jpg onto a picture control on a dialog box

59 views
Skip to first unread message

funksou...@hotmail.it

unread,
Nov 2, 2012, 10:05:36 AM11/2/12
to
hi, how can i show a jpg file on a picture control box?

BOOL CALLBACK AppDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{

case WM_INITDIALOG:
DragAcceptFiles(hDlg,true);
SetClassLongPtr(hDlg, GCLP_HICON, (long)LoadIcon(0, IDI_APPLICATION));
return 1;
case WM_COMMAND:
switch(wParam)
{
case IDOK:
return 0;
case IDCANCEL:
EndDialog(hDlg, 0);
}
switch(wParam)
{
case IDC_BUTTON1:
ShellExecute(hDlg,
"open",
"C:\immagine1.jpg",
NULL,
NULL,
IDC_STATIC);

break;
}

switch(wParam)
{
case IDC_BUTTON4:
ShellExecute(hDlg,
"open",
"C:\log.txt",
NULL,
NULL,
SW_SHOWDEFAULT);
break;
}






}
return 0;
}


instead using the shell execute that open the default viewer???
Thank you all!

JJ

unread,
Nov 2, 2012, 12:30:33 PM11/2/12
to
As developer, you're working at a lower level point of view. If you want
to display an image, basically you'll have to open the image file, read
its data, then draw it on a window.

Here, you'll need to load the image file using LoadImage function or GDI+
API. Then use WM_PAINT to draw the image when the control needs to be
"painted".

You should have the MSDN library handy for reference.

Christian ASTOR

unread,
Nov 2, 2012, 10:17:02 PM11/2/12
to
funksou...@hotmail.it a �crit :
> hi, how can i show a jpg file on a picture control box?

There are plenty of methods to load a JPG (IShellImageDataFactory,
"AtlAxWin" class, OleLoadPicture(), IImgCtx, GDI+, etc..)

0 new messages