Salut!
j'ai un probleme, j'ai créer un logiciel permettant de visualiser des images.
Les images sont stocke en ressource dans un dll.
Mais je n'arrive pas a les afficher.
Aider moi svp!!
Voici les fichiers:
*************Imagerie.cpp*************
(programme principale.)
#include <windows.h>
#include "resource.h"
HINSTANCE hInst = NULL;
HWND hwnd = NULL;
WNDCLASS fenetre;
HMODULE hm = 0;
bool OnCommand(UINT id, HWND hwnd);
LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
LRESULT CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{return (DefWindowProc(hwnd, msg, wparam, lparam));}
LRESULT CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_INITDIALOG:
break;
case WM_COMMAND:
{
OnCommand(LOWORD(wParam), hwnd);
switch(LOWORD(wParam))
{
case WM_DESTROY:
{
EndDialog(hwnd, FALSE);
break;
}
}
break;
}
default:
return FALSE;
}
return TRUE;
}
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInst,
LPSTR lpCmdLine,
int nCmdShow)
{
fenetre.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
fenetre.lpfnWndProc = WindowProc;
fenetre.cbClsExtra = 0;
fenetre.cbWndExtra = 0;
fenetre.hInstance = hInstance;
fenetre.hIcon = LoadIcon(NULL, IDI_EXCLAMATION);
fenetre.hCursor = LoadCursor(NULL, IDC_ARROW);
fenetre.hbrBackground = (struct HBRUSH__ *)GetStockObject(WHITE_BRUSH);
fenetre.lpszMenuName = NULL;
fenetre.lpszClassName = "Imagerie";
if (!RegisterClass(&fenetre)) return(0);
hInst = hInstance;
DialogBox(hInst, MAKEINTRESOURCE(IDD_MENU), NULL, ( DLGPROC ) DlgProc);
return (0);
}
bool OnCommand(UINT id, HWND hwnd)
{
switch(id)
{
case ID_CHARGER:
{
hm = LoadLibrary("images.dll");
if (!hm)
{
MessageBox(hwnd,"Ce logiciel ne fonctionne pas sans un Plug-In.\n\nCe logiciel va donc se
terminer.","Plug-in non trouvé!",MB_OK | MB_ICONERROR);
exit(1);
}
}
return 0;
return 0;
}
return 0;
}
*****************************
je n'inclus pas les ressource car il n'y a qu'une fenetre et un bouton.
la dll:
*************************
#include <iostream.h>
#include "plugin.h"
#include <windows.h>
extern "C" PLUGIN void images(HWND hwnd)
{
}
************************
plugin.h:
***********************
#include <windows.h>
#define PLUGIN __declspec( dllexport )
extern "C" PLUGIN void images(HWND hwnd);
**********************
et dans les ressources de la dll, je voudrais mettre les images, les dialog box et les boutons
"precedant"
et "suivant" pour la navigation.
Comment faire svp???
Aidez moi!