标题:“函数”: 从“char [7]”到“LPCWSTR”的类型不兼容
取消只看楼主
黑心
Rank: 1
等 级:新手上路
帖 子:12
专家分:7
注 册:2016-9-23
结帖率:50%
已结贴  问题点数:20 回复次数:3 
“函数”: 从“char [7]”到“LPCWSTR”的类型不兼容
“函数”: 从“char [7]”到“LPCWSTR”的类型不兼容
Main.c
#include "stdafx.h"
#include "Win32Project15.h"
#include"Resource.h"
#include<COMMCTRL.H>
#pragma comment(lib,"comctl32.lib")

int APIENTRY _tWinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPWSTR    lpCmdLine,
    int       nCmdShow)
{
    InitCommonControls();
    DialogBox(hPrevInstance,MAKEINTRESOURCE(IDD_MAIN),NULL,Main_Proc);
    return 0;
}
Win32Project15.c


#include "stdafx.h"
#include<windows.h>
#include<windowsx.h>
#include"Resource.h"
#include "Win32Project15.h"

#pragma comment(lib,"comctl32.lib")

BOOL   WINAPI  Main_Proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
        HANDLE_MSG(hwnd, WM_INITDIALOG, Main_onlnicDialog);
        HANDLE_MSG(hwnd, WM_COMMAND, Main_onCommand);
        HANDLE_MSG(hwnd, WM_CLOSE, Main_Close);
        
    }
return FALSE;
}
BOOL Main_onlnicDialog(HWND hwnd, HWND hwndm, LPARAM lParam)
{
    return TRUE;
}
void Main_onCommand(HWND hwnd, int id, HWND hwndCTl, UINT codeNotify)
{
    switch (id)
    {
    case IDOK:
    {
        TCHAR name[256];
        GetDlgItemText(hwnd, IDC_EDITNAME,name , sizeof(name));
        
      TCHAR msg[256];
      wsprintf(msg,"%s你好",name);
      MessageBox(hwnd, msg, msg, MB_OK);
      break;
    }   
    default:
        break;
    }
}
void Main_Close(HWND hwnd)
{
    EndDialog(hwnd, 0);
}
 Win32Project15.h
#pragma once

#include "resource.h"
#ifndef __WIN32PROJECT_H__
#define __WIN32PROJECT_H__


BOOL WINAPI Main_Proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL Main_onlnicDialog(HWND hwnd, HWND hwndm, LPARAM lParam);
void Main_onCommand(HWND hwnd, int id, HWND hwndCTl, UINT codeNotify);
void Main_Close(HWND hwnd);
#endif
搜索更多相关主题的帖子: comment include return 
2016-09-23 19:35
黑心
Rank: 1
等 级:新手上路
帖 子:12
专家分:7
注 册:2016-9-23
得分:0 
在Main.c,我用的是TCHAR
2016-09-24 10:13
黑心
Rank: 1
等 级:新手上路
帖 子:12
专家分:7
注 册:2016-9-23
得分:0 
2016-09-24 10:18
黑心
Rank: 1
等 级:新手上路
帖 子:12
专家分:7
注 册:2016-9-23
得分:0 
谢谢,好了,为什么是L
2016-09-25 13:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-469119-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.455367 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved