Postato originariamente da HeDo:
per "eliminare tutto" intendo "eliminare la parte di codice che si occupa del manifest"
però guarda, è un problema che non ho mai avuto e ci lavoro da anni. Posso dire con certezza che il 2008 se ne occupa da solo, il 2005 penso anche lui però se trovi in giro qualche post che dice il contrario (sul 2005) potrebbe essere.
al limite posta l'intero prog e ci do un'occhiata
guarda hai ragione, il manifest se imposto di generarlo lo genera, ma non quello di xp .. cioè pulsanti ecc sono del manifest di win98.
cmq questo è il file delle risorse:
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
1 RT_MANIFEST "C:\WxDev files\lista.exe.manifest"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italiano (Italia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.hPostato originariamente da HeDo:
per "eliminare tutto" intendo "eliminare la parte di codice che si occupa del manifest"
però guarda, è un problema che non ho mai avuto e ci lavoro da anni. Posso dire con certezza che il 2008 se ne occupa da solo, il 2005 penso anche lui però se trovi in giro qualche post che dice il contrario (sul 2005) potrebbe essere.
al limite posta l'intero prog e ci do un'occhiata
guarda hai ragione, il manifest se imposto di generarlo lo genera, ma non quello di xp .. cioè pulsanti ecc sono del manifest di win98.
cmq questo è il file delle risorse:
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
1 RT_MANIFEST "C:\WxDev files\lista.exe.manifest"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italiano (Italia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h{parsed_message}"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"{parsed_message}"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"{parsed_message}"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
MAIN_ICON ICON "icona.ico"
#endif // Italiano (Italia) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
file resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by lista.rc
//
#define MAIN_ICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40018
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
lista.cpp
#include <windows.h>
#include "resource.h"
#include <commctrl.h>
//Definizione del gestore eventi per la finestra Main
LRESULT CALLBACK ClasseMain_EvtHandler(HWND, UINT, WPARAM,LPARAM);
void InitClassMainWindow (WNDCLASSEX&,HINSTANCE);
LPCTSTR titoloMainWindow = L"looool";
LPCTSTR MainWindow_class = L"MainWindow";
HWND MainWindow_hwnd, PulsanteCerca_hwnd;
MSG messages;
WNDCLASSEX ClasseMain;
HINSTANCE AppInst;
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
//InitCommonControls();
AppInst = hInstance;
InitClassMainWindow(ClasseMain,hInstance);
RegisterClassEx(&ClasseMain); //Registrazione della classe.
MainWindow_hwnd = CreateWindowEx(
0,
MainWindow_class,
titoloMainWindow,
WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
532,
433,
(HWND)GetDesktopWindow(),
NULL,
hInstance,
NULL
);
PulsanteCerca_hwnd = CreateWindow(
L"BUTTON", // Predefined class; Unicode assumed.
L"Cerca", // Button text.
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // Styles.
402, // x position.
27, // y position.
103, // Button width.
35, // Button height.
MainWindow_hwnd, // Parent window.
NULL, // No menu.
hInstance,
NULL
); // Pointer not needed.
CreateWindow(
L"EDIT",
NULL,
WS_CHILD | WS_VISIBLE | ES_LEFT,
10, 37, 389, 21,
MainWindow_hwnd,
(HMENU) 25,
hInstance,
NULL);
// Find out if the window was created
if( !MainWindow_hwnd ) { // If the window was not created,
MessageBox(NULL,L"Errore grave. Contattare lo sviluppatore.",L"Errore!",MB_OK); // stop the application
return 0;
}
// Display the window to the user
ShowWindow(MainWindow_hwnd, SW_SHOWNORMAL);
UpdateWindow(MainWindow_hwnd);
while( GetMessage(&messages, NULL, 0, 0) )
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return 0;
}
void InitClassMainWindow (WNDCLASSEX& ClassName,HINSTANCE hInstance)
{
ClasseMain.cbSize = sizeof(WNDCLASSEX); //Dimensione Variabile.
ClasseMain.cbClsExtra = 0; //Memoria allocata extra.
ClasseMain.hInstance = hInstance; //Istanza dell'app.
ClasseMain.cbWndExtra = 0; //Memoria allocata per la finestra extra.
ClasseMain.style = CS_HREDRAW | CS_VREDRAW; //stile della finestra;
ClasseMain.lpfnWndProc = ClasseMain_EvtHandler; //Funzione handler.
ClasseMain.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(MAIN_ICON)); //Icona per l'exe.
ClasseMain.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(MAIN_ICON)); //Icona per la finestra
ClasseMain.hbrBackground = (HBRUSH)COLOR_BACKGROUND; //Sfondo della finestra.
ClasseMain.lpszMenuName = NULL; //Menu della finestra.
ClasseMain.lpszClassName = MainWindow_class;
}
LRESULT CALLBACK ClasseMain_EvtHandler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
POINT MousePos;
GetCursorPos(&MousePos);
switch(Msg)
{
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
case WM_SIZE:
break;
case WM_COMMAND:
switch(HIWORD(wParam))
{
case BN_CLICKED:
if((HWND)lParam == PulsanteCerca_hwnd)
MessageBox(NULL,L"asd",L"loool",MB_OK);
break;
}
break;
case WM_LBUTTONDOWN:
break;
case WM_CREATE:
InitCommonControls();
break;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return 0;
}
"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"Postato originariamente da HeDo:
per "eliminare tutto" intendo "eliminare la parte di codice che si occupa del manifest"
però guarda, è un problema che non ho mai avuto e ci lavoro da anni. Posso dire con certezza che il 2008 se ne occupa da solo, il 2005 penso anche lui però se trovi in giro qualche post che dice il contrario (sul 2005) potrebbe essere.
al limite posta l'intero prog e ci do un'occhiata
guarda hai ragione, il manifest se imposto di generarlo lo genera, ma non quello di xp .. cioè pulsanti ecc sono del manifest di win98.
cmq questo è il file delle risorse:
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
1 RT_MANIFEST "C:\WxDev files\lista.exe.manifest"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italiano (Italia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h{parsed_message}"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"{parsed_message}"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"{parsed_message}"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
MAIN_ICON ICON "icona.ico"
#endif // Italiano (Italia) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
file resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by lista.rc
//
#define MAIN_ICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40018
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
lista.cpp
#include <windows.h>
#include "resource.h"
#include <commctrl.h>
//Definizione del gestore eventi per la finestra Main
LRESULT CALLBACK ClasseMain_EvtHandler(HWND, UINT, WPARAM,LPARAM);
void InitClassMainWindow (WNDCLASSEX&,HINSTANCE);
LPCTSTR titoloMainWindow = L"looool";
LPCTSTR MainWindow_class = L"MainWindow";
HWND MainWindow_hwnd, PulsanteCerca_hwnd;
MSG messages;
WNDCLASSEX ClasseMain;
HINSTANCE AppInst;
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
//InitCommonControls();
AppInst = hInstance;
InitClassMainWindow(ClasseMain,hInstance);
RegisterClassEx(&ClasseMain); //Registrazione della classe.
MainWindow_hwnd = CreateWindowEx(
0,
MainWindow_class,
titoloMainWindow,
WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
532,
433,
(HWND)GetDesktopWindow(),
NULL,
hInstance,
NULL
);
PulsanteCerca_hwnd = CreateWindow(
L"BUTTON", // Predefined class; Unicode assumed.
L"Cerca", // Button text.
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // Styles.
402, // x position.
27, // y position.
103, // Button width.
35, // Button height.
MainWindow_hwnd, // Parent window.
NULL, // No menu.
hInstance,
NULL
); // Pointer not needed.
CreateWindow(
L"EDIT",
NULL,
WS_CHILD | WS_VISIBLE | ES_LEFT,
10, 37, 389, 21,
MainWindow_hwnd,
(HMENU) 25,
hInstance,
NULL);
// Find out if the window was created
if( !MainWindow_hwnd ) { // If the window was not created,
MessageBox(NULL,L"Errore grave. Contattare lo sviluppatore.",L"Errore!",MB_OK); // stop the application
return 0;
}
// Display the window to the user
ShowWindow(MainWindow_hwnd, SW_SHOWNORMAL);
UpdateWindow(MainWindow_hwnd);
while( GetMessage(&messages, NULL, 0, 0) )
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return 0;
}
void InitClassMainWindow (WNDCLASSEX& ClassName,HINSTANCE hInstance)
{
ClasseMain.cbSize = sizeof(WNDCLASSEX); //Dimensione Variabile.
ClasseMain.cbClsExtra = 0; //Memoria allocata extra.
ClasseMain.hInstance = hInstance; //Istanza dell'app.
ClasseMain.cbWndExtra = 0; //Memoria allocata per la finestra extra.
ClasseMain.style = CS_HREDRAW | CS_VREDRAW; //stile della finestra;
ClasseMain.lpfnWndProc = ClasseMain_EvtHandler; //Funzione handler.
ClasseMain.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(MAIN_ICON)); //Icona per l'exe.
ClasseMain.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(MAIN_ICON)); //Icona per la finestra
ClasseMain.hbrBackground = (HBRUSH)COLOR_BACKGROUND; //Sfondo della finestra.
ClasseMain.lpszMenuName = NULL; //Menu della finestra.
ClasseMain.lpszClassName = MainWindow_class;
}
LRESULT CALLBACK ClasseMain_EvtHandler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
POINT MousePos;
GetCursorPos(&MousePos);
switch(Msg)
{
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
case WM_SIZE:
break;
case WM_COMMAND:
switch(HIWORD(wParam))
{
case BN_CLICKED:
if((HWND)lParam == PulsanteCerca_hwnd)
MessageBox(NULL,L"asd",L"loool",MB_OK);
break;
}
break;
case WM_LBUTTONDOWN:
break;
case WM_CREATE:
InitCommonControls();
break;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return 0;
}
"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"Postato originariamente da HeDo:
per "eliminare tutto" intendo "eliminare la parte di codice che si occupa del manifest"
però guarda, è un problema che non ho mai avuto e ci lavoro da anni. Posso dire con certezza che il 2008 se ne occupa da solo, il 2005 penso anche lui però se trovi in giro qualche post che dice il contrario (sul 2005) potrebbe essere.
al limite posta l'intero prog e ci do un'occhiata
guarda hai ragione, il manifest se imposto di generarlo lo genera, ma non quello di xp .. cioè pulsanti ecc sono del manifest di win98.
cmq questo è il file delle risorse:
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
1 RT_MANIFEST "C:\WxDev files\lista.exe.manifest"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Italiano (Italia) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ITA)
#ifdef _WIN32
LANGUAGE LANG_ITALIAN, SUBLANG_ITALIAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h{parsed_message}"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"{parsed_message}"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"{parsed_message}"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
MAIN_ICON ICON "icona.ico"
#endif // Italiano (Italia) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
file resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by lista.rc
//
#define MAIN_ICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40018
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
lista.cpp
#include <windows.h>
#include "resource.h"
#include <commctrl.h>
//Definizione del gestore eventi per la finestra Main
LRESULT CALLBACK ClasseMain_EvtHandler(HWND, UINT, WPARAM,LPARAM);
void InitClassMainWindow (WNDCLASSEX&,HINSTANCE);
LPCTSTR titoloMainWindow = L"looool";
LPCTSTR MainWindow_class = L"MainWindow";
HWND MainWindow_hwnd, PulsanteCerca_hwnd;
MSG messages;
WNDCLASSEX ClasseMain;
HINSTANCE AppInst;
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
//InitCommonControls();
AppInst = hInstance;
InitClassMainWindow(ClasseMain,hInstance);
RegisterClassEx(&ClasseMain); //Registrazione della classe.
MainWindow_hwnd = CreateWindowEx(
0,
MainWindow_class,
titoloMainWindow,
WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
532,
433,
(HWND)GetDesktopWindow(),
NULL,
hInstance,
NULL
);
PulsanteCerca_hwnd = CreateWindow(
L"BUTTON", // Predefined class; Unicode assumed.
L"Cerca", // Button text.
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // Styles.
402, // x position.
27, // y position.
103, // Button width.
35, // Button height.
MainWindow_hwnd, // Parent window.
NULL, // No menu.
hInstance,
NULL
); // Pointer not needed.
CreateWindow(
L"EDIT",
NULL,
WS_CHILD | WS_VISIBLE | ES_LEFT,
10, 37, 389, 21,
MainWindow_hwnd,
(HMENU) 25,
hInstance,
NULL);
// Find out if the window was created
if( !MainWindow_hwnd ) { // If the window was not created,
MessageBox(NULL,L"Errore grave. Contattare lo sviluppatore.",L"Errore!",MB_OK); // stop the application
return 0;
}
// Display the window to the user
ShowWindow(MainWindow_hwnd, SW_SHOWNORMAL);
UpdateWindow(MainWindow_hwnd);
while( GetMessage(&messages, NULL, 0, 0) )
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return 0;
}
void InitClassMainWindow (WNDCLASSEX& ClassName,HINSTANCE hInstance)
{
ClasseMain.cbSize = sizeof(WNDCLASSEX); //Dimensione Variabile.
ClasseMain.cbClsExtra = 0; //Memoria allocata extra.
ClasseMain.hInstance = hInstance; //Istanza dell'app.
ClasseMain.cbWndExtra = 0; //Memoria allocata per la finestra extra.
ClasseMain.style = CS_HREDRAW | CS_VREDRAW; //stile della finestra;
ClasseMain.lpfnWndProc = ClasseMain_EvtHandler; //Funzione handler.
ClasseMain.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(MAIN_ICON)); //Icona per l'exe.
ClasseMain.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(MAIN_ICON)); //Icona per la finestra
ClasseMain.hbrBackground = (HBRUSH)COLOR_BACKGROUND; //Sfondo della finestra.
ClasseMain.lpszMenuName = NULL; //Menu della finestra.
ClasseMain.lpszClassName = MainWindow_class;
}
LRESULT CALLBACK ClasseMain_EvtHandler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
POINT MousePos;
GetCursorPos(&MousePos);
switch(Msg)
{
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
case WM_SIZE:
break;
case WM_COMMAND:
switch(HIWORD(wParam))
{
case BN_CLICKED:
if((HWND)lParam == PulsanteCerca_hwnd)
MessageBox(NULL,L"asd",L"loool",MB_OK);
break;
}
break;
case WM_LBUTTONDOWN:
break;
case WM_CREATE:
InitCommonControls();
break;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return 0;
}
"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
MAIN_ICON ICON "icona.ico"
#endif // Italiano (Italia) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
file resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by lista.rc
//
#define MAIN_ICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40018
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
lista.cpp
#include <windows.h>
#include "resource.h"
#include <commctrl.h>
//Definizione del gestore eventi per la finestra Main
LRESULT CALLBACK ClasseMain_EvtHandler(HWND, UINT, WPARAM,LPARAM);
void InitClassMainWindow (WNDCLASSEX&,HINSTANCE);
LPCTSTR titoloMainWindow = L"looool";
LPCTSTR MainWindow_class = L"MainWindow";
HWND MainWindow_hwnd, PulsanteCerca_hwnd;
MSG messages;
WNDCLASSEX ClasseMain;
HINSTANCE AppInst;
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
//InitCommonControls();
AppInst = hInstance;
InitClassMainWindow(ClasseMain,hInstance);
RegisterClassEx(&ClasseMain); //Registrazione della classe.
MainWindow_hwnd = CreateWindowEx(
0,
MainWindow_class,
titoloMainWindow,
WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT,
532,
433,
(HWND)GetDesktopWindow(),
NULL,
hInstance,
NULL
);
PulsanteCerca_hwnd = CreateWindow(
L"BUTTON", // Predefined class; Unicode assumed.
L"Cerca", // Button text.
WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON, // Styles.
402, // x position.
27, // y position.
103, // Button width.
35, // Button height.
MainWindow_hwnd, // Parent window.
NULL, // No menu.
hInstance,
NULL
); // Pointer not needed.
CreateWindow(
L"EDIT",
NULL,
WS_CHILD | WS_VISIBLE | ES_LEFT,
10, 37, 389, 21,
MainWindow_hwnd,
(HMENU) 25,
hInstance,
NULL);
// Find out if the window was created
if( !MainWindow_hwnd ) { // If the window was not created,
MessageBox(NULL,L"Errore grave. Contattare lo sviluppatore.",L"Errore!",MB_OK); // stop the application
return 0;
}
// Display the window to the user
ShowWindow(MainWindow_hwnd, SW_SHOWNORMAL);
UpdateWindow(MainWindow_hwnd);
while( GetMessage(&messages, NULL, 0, 0) )
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return 0;
}
void InitClassMainWindow (WNDCLASSEX& ClassName,HINSTANCE hInstance)
{
ClasseMain.cbSize = sizeof(WNDCLASSEX); //Dimensione Variabile.
ClasseMain.cbClsExtra = 0; //Memoria allocata extra.
ClasseMain.hInstance = hInstance; //Istanza dell'app.
ClasseMain.cbWndExtra = 0; //Memoria allocata per la finestra extra.
ClasseMain.style = CS_HREDRAW | CS_VREDRAW; //stile della finestra;
ClasseMain.lpfnWndProc = ClasseMain_EvtHandler; //Funzione handler.
ClasseMain.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(MAIN_ICON)); //Icona per l'exe.
ClasseMain.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(MAIN_ICON)); //Icona per la finestra
ClasseMain.hbrBackground = (HBRUSH)COLOR_BACKGROUND; //Sfondo della finestra.
ClasseMain.lpszMenuName = NULL; //Menu della finestra.
ClasseMain.lpszClassName = MainWindow_class;
}
LRESULT CALLBACK ClasseMain_EvtHandler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
POINT MousePos;
GetCursorPos(&MousePos);
switch(Msg)
{
case WM_DESTROY:
PostQuitMessage(WM_QUIT);
break;
case WM_SIZE:
break;
case WM_COMMAND:
switch(HIWORD(wParam))
{
case BN_CLICKED:
if((HWND)lParam == PulsanteCerca_hwnd)
MessageBox(NULL,L"asd",L"loool",MB_OK);
break;
}
break;
case WM_LBUTTONDOWN:
break;
case WM_CREATE:
InitCommonControls();
break;
default:
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
return 0;
}