Soyez le premier à donner votre avis sur cette source.
Vue 3 138 fois - Téléchargée 234 fois
#include <windows.h> #include "resource.h" #define BNU_INIT (WM_USER+1) HINSTANCE hinst; HWND hwndapp, hinit = 0; DWORD count = 0; char *szappname = "DlgInit"; BOOL CALLBACK InitDlgProc(HWND hdlg, UINT mssg, WPARAM wParam, LPARAM lParam) { switch(mssg) { case WM_INITDIALOG: SetTimer(hdlg, 1, 300, 0); return 1; case WM_TIMER: if(++count > 10) {DestroyWindow(hdlg); return 0;} SetDlgItemInt(hdlg, IDST_INIT, count, 0); break; case WM_DESTROY: KillTimer(hdlg, 1); hinit = 0; } return 0; } LRESULT CALLBACK AppWndProc(HWND hwnd, UINT mssg, WPARAM wParam, LPARAM lParam) { switch(mssg) { case WM_CREATE: PostMessage(hwnd, BNU_INIT, 0, 0); return 0; case BNU_INIT: hinit = CreateDialog(hinst, MAKEINTRESOURCE(IDD_INIT), hwnd, InitDlgProc); return 0; case WM_DESTROY: if(hinit) DestroyWindow(hinit); PostQuitMessage(0); } return DefWindowProc(hwnd, mssg, wParam, lParam); } void InitInstance() { WNDCLASSEX wclsx; wclsx.cbSize = sizeof(WNDCLASSEX); wclsx.style = CS_HREDRAW | CS_VREDRAW; wclsx.hCursor = LoadCursor(0, IDC_ARROW); wclsx.hInstance = hinst; wclsx.cbClsExtra = wclsx.cbWndExtra = 0; wclsx.hIconSm = 0; wclsx.lpszMenuName = 0; wclsx.hIcon = LoadIcon(0, IDI_APPLICATION); wclsx.lpfnWndProc = AppWndProc; wclsx.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wclsx.lpszClassName = szappname; if(!RegisterClassEx(&wclsx)) goto errInit; hwndapp = CreateWindowEx(0, szappname, szappname, WS_OVERLAPPED | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hinst, 0); return; errInit: MessageBox(0, "ERREUR", szappname, MB_ICONERROR); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, PSTR, int) { MSG msg; hinst = hInstance; InitInstance(); if(!hwndapp) return 0; ShowWindow(hwndapp, SW_SHOW); UpdateWindow(hwndapp); while(GetMessage (&msg, 0, 0, 0)) { if(hinit == 0 || !IsDialogMessage(hinit, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return 0; }
et voilà ce que j'obtiens:
--------------------Configuration: DlgInit - Win32 Release--------------------
Compiling resources...
Compiling...
DlgInit.cpp
Linking...
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Release/DlgInit.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
DlgInit.exe - 2 error(s), 0 warning(s)
__________________
puis j'ai réussi en créant un projet win32 vide
et en y intégrant les sources
là ça marche mais
les resources ne semble plus éditables.
Afin de modifier,
j'ai édité le rc en séparé et ai recompilé le tout
(je voulais vérifier que le splatch screen s'affichait bien en dehors de l'appli en fond...)
et c'est bien le cas,
maintenant, on va voir pour y intégrer des images
et l'intégrer dans d'autres projets .
Magicalement Votre
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.