skoumas
February 22nd, 2008, 08:54 AM
Hello there.
I am using Visual C++ Express right now.
I dont want to make applications throught the automated processes that this pack offers me, cause application gets much larger than they should have bin.
Yesterday I made my first step on WinApi: this is the result.
#include <windows.h>
char* App_Title = "Skoumas and the brains at the kangela";
LRESULT WINAPI myProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_CLOSE) {
int apantisi;
apantisi = MessageBox(NULL, "Are you Sure?",App_Title,1);
if (apantisi==1)
PostQuitMessage(0);
}
return 0;
}
LRESULT WINAPI myProcbutton(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == 1) {
int apantisi;
apantisi = MessageBox(NULL, "Are you Sure?",App_Title,1);
if (apantisi==1)
PostQuitMessage(0);
}
return 0;
}
int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
MSG msg;
HWND myDialog=CreateWindowEx(0, WC_DIALOG, App_Title, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
600, 100, 400, 200, NULL, NULL,NULL,NULL
);
HWND button1=CreateWindowEx( 0,"BUTTON", "My Button",BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD,
50,50,100,25,myDialog,NULL,NULL,NULL
);
SetWindowLong(myDialog, DWL_DLGPROC, (long) myProc);
SetWindowLong(button1, DWL_DLGPROC, (long) myProcbutton);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
------------------------------------------------------
In this code you can see that the program generates a simple window and a button inside it.
I want to be able when i press the button to show a message box.
Can you please help me?
I am using Visual C++ Express right now.
I dont want to make applications throught the automated processes that this pack offers me, cause application gets much larger than they should have bin.
Yesterday I made my first step on WinApi: this is the result.
#include <windows.h>
char* App_Title = "Skoumas and the brains at the kangela";
LRESULT WINAPI myProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_CLOSE) {
int apantisi;
apantisi = MessageBox(NULL, "Are you Sure?",App_Title,1);
if (apantisi==1)
PostQuitMessage(0);
}
return 0;
}
LRESULT WINAPI myProcbutton(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == 1) {
int apantisi;
apantisi = MessageBox(NULL, "Are you Sure?",App_Title,1);
if (apantisi==1)
PostQuitMessage(0);
}
return 0;
}
int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
MSG msg;
HWND myDialog=CreateWindowEx(0, WC_DIALOG, App_Title, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
600, 100, 400, 200, NULL, NULL,NULL,NULL
);
HWND button1=CreateWindowEx( 0,"BUTTON", "My Button",BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD,
50,50,100,25,myDialog,NULL,NULL,NULL
);
SetWindowLong(myDialog, DWL_DLGPROC, (long) myProc);
SetWindowLong(button1, DWL_DLGPROC, (long) myProcbutton);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
------------------------------------------------------
In this code you can see that the program generates a simple window and a button inside it.
I want to be able when i press the button to show a message box.
Can you please help me?