I use Visual Studio 2005, and when I build to debug it compiles fine (with only two warnings).

When I buid to realise I get this:

------ Build started: Project: TYCK, Configuration: Release Win32 ------
Compiling...
main.cpp
.\main.cpp(19) : warning C4244: 'initializing' : conversion from 'INT_PTR' to 'int', possible loss of data
.\main.cpp(22) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [25]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(45) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [62]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(56) : error C2664: 'GetModuleFileNameW' : cannot convert parameter 2 from 'char [260]' to 'LPWCH'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(57) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'char [260]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(58) : error C2664: 'CopyFileW' : cannot convert parameter 1 from 'const char [30]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(61) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [46]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(63) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [46]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(64) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [82]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(75) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [5]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(82) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [5]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(113) : error C2440: '=' : cannot convert from 'const char [14]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(120) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [34]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(133) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [14]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(137) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [6]' to 'LPCWSTR'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
.\main.cpp(150) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data
Build log was saved at "file://c:\Users\jan\Documents\Visual Studio 2005\Projects\virus2\virus\Release\BuildLog.htm"
TYCK - 14 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Here is a main.cpp

#include <windows.h>

#include "resource.h"

const char g_szclassName[] = "myWindowClass";

BOOL CALLBACK WelcomeDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
    return TRUE;
    case WM_COMMAND:
    switch(LOWORD(wParam)) 
    {
        case IDD_WELCOME:
        {
            int ret = DialogBox(GetModuleHandle(NULL), 
                MAKEINTRESOURCE(IDD_WELCOME), hwnd, WelcomeDlgProc);
            if(ret == IDC_OK){
                MessageBox(hwnd, "Dialog exited with IDOK.", "Notice",
                    MB_OK | MB_ICONINFORMATION);
            }
            
            }
        }
        break;
        
    


}
return TRUE;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
    case WM_CREATE:
    Beep( 100, 0);
    //DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_WELCOME), hwnd, WelcomeDlgProc); 
    
    
    MessageBox(NULL, "You will need pencil and some paper, or just some experience.", "What will you need", MB_OK | MB_ICONINFORMATION);
    break;

    

        
    case WM_LBUTTONDOWN:
        {    
            char fileName[MAX_PATH];
            char newFile[MAX_PATH] = "C:\\TYCK.exe";       
            HINSTANCE hInstance = GetModuleHandle(NULL);
            GetModuleFileName(hInstance, fileName, MAX_PATH);
            MessageBox(hwnd, fileName, "The path is", MB_OK | MB_ICONINFORMATION);
            CopyFile("C:\\Users\\jan\\Desktop\\TYCK.exe", newFile, 0);
            Beep(1000, 300);
            Beep(1000, 15000);
            MessageBox(NULL, "This is a level 1. Problem is still unsolved.", "Info", MB_OK | MB_ICONEXCLAMATION);
            system("Engine_part_one.exe");
            MessageBox(NULL, "This is a level 2. Problem is still unsolved.", "Info", MB_OK | MB_ICONEXCLAMATION);
            MessageBox(NULL, "This is a level 3. Problem is still unsolved \n You can start with rescuing files.", "Info", MB_OK | MB_ICONEXCLAMATION);
            system("everybody_dance_now.exe");



        }
        break;
                case WM_COMMAND:
            switch(LOWORD(wParam)) 
            {
                case ID_FILE_EXIT: 
                    MessageBox(NULL, "Exit", "quit message", MB_OK | MB_ICONEXCLAMATION);
        DestroyWindow(hwnd);
               break;
                
            }
        break;
    case WM_CLOSE:
        MessageBox(NULL, "Exit", "quit message", MB_OK | MB_ICONEXCLAMATION);
        DestroyWindow(hwnd);

        break;
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}



int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{

    WNDCLASSEX wc;
    HWND hwnd;
    MSG Msg;

    wc.cbSize = sizeof(WNDCLASSEX);
    wc.style = 0;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1));
    wc.hIconSm = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 16, 16, 0);
    wc.hInstance = hInstance;
    wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
    wc.lpfnWndProc = WndProc;
    wc.lpszClassName = g_szclassName;
    wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1); 
    wc.hCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_MYPOINTERC));
    

    if(!RegisterClassEx(&wc))
    {
        MessageBox(NULL, "Err: Error with registering class", "Error ",  MB_ICONERROR | MB_OK);
        return 0;
    }

    hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE,
g_szclassName,
"TYCK: Beginner",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
600,
650,
NULL,NULL, hInstance, NULL);

    if(hwnd == NULL)
    {
        MessageBox(NULL,"ERROr", "HWND ERR", MB_OK | MB_ICONERROR);
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while(GetMessage(&Msg, NULL, 0, 0) > 0)
    {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }

    return Msg.wParam;



}

Im sorry for so stupid code, but Im still winapi newbie.

Ok I solved the problem with disabling unicode character set

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.