VC写的程序,窗口没有系统样式,求帮助 怎么给应用程序的窗口加上系统的样式我用的是win7系统直接用API CreateWindow创建的窗口和按钮等等太朴素了,和WIN98一样,我想要让它用上系统主题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在stdafx.h中加入manifest#if defined _M_IX86#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")#elif defined _M_IA64#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")#elif defined _M_X64#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")#else#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")#endif warning LNK4044: unrecognized option "manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"; ignored出警告了 效果没有变,还是经典主题,我想要WIN7的主题效果 #ifdef _UNICODE#if defined _M_IX86#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")#elif defined _M_X64#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")#else#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")#endif#endif使用 UNICODE 字符集编译工程 同意ls,你的工程是Unicode编码的吗? 我已经按照网上说的把_MBCS那个选项改成_UNICODE了,编译环境应该是UNICODE了把可是还是没有样式我在学WIN SDK,是直接用API建立的窗口,全部代码如下#include <Windows.h>#ifdef _UNICODE#if defined _M_IX86#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")#elif defined _M_X64#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")#else#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")#endif#endifint main(int args, char **argc){ void wintest2(); wintest2(); return 0;}LRESULT WINAPI WinProc2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam){ switch (msg) { case WM_KEYUP: MessageBox(hWnd, "hehe", "cap", MB_YESNO); break; case WM_CREATE: break; case WM_PAINT: break; case WM_CLOSE: break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hWnd, msg, wParam, lParam);}void wintest2(){ WNDCLASSEX wndclsex; HANDLE hWnd, hWnd2; MSG msg; wndclsex.cbSize = sizeof(WNDCLASSEX); wndclsex.cbClsExtra = 0; wndclsex.cbWndExtra = 0; wndclsex.lpszClassName = "Stardust Window Class"; wndclsex.lpszMenuName = NULL; wndclsex.lpfnWndProc = WinProc2; wndclsex.hIcon = LoadIcon(NULL, IDI_APPLICATION); wndclsex.hIconSm = NULL; wndclsex.hCursor = LoadCursor(NULL, IDC_ARROW); wndclsex.hbrBackground = (HBRUSH) COLOR_WINDOW; wndclsex.style = CS_HREDRAW | CS_VREDRAW; RegisterClassEx(&wndclsex); hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, "Stardust Window Class", "TEST", WS_OVERLAPPEDWINDOW ^ WS_MAXIMIZEBOX ^ WS_THICKFRAME ^ WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, NULL, NULL); ShowWindow(hWnd, SW_SHOW); CreateWindowEx(0, "STATIC", "名称:", WS_CHILD | WS_VISIBLE, 30, 80, 48, 48, hWnd, NULL, NULL, NULL); CreateWindowEx(0, "EDIT", "", WS_BORDER | WS_CHILD | WS_VISIBLE, 30 + 48 + 10, 80, 128, 24, hWnd, NULL, NULL, NULL); CreateWindowEx(0, "BUTTON", "hehe", WS_CHILD | WS_VISIBLE, 80, 180, 128, 48, hWnd, NULL, NULL, NULL); while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); }} 我换成VS2010版本用了上面的方法就有效果了VC6却没用,一模一样的代码啊诡~~~~谁能帮我解释一下啊 如何在一个窗口中添加滚动条 如何是我写的程序能在没装VS2008的电脑上运行 FOR语句问题 问个硬盘保护卡的问问题(海光的硬盘保护卡) [讨论调查] 如果不是计算机专业毕业的,自学的,但是水平还是强的,那样子大公司有没有人要? ####怎么让程序播放音频文件!!! 明天去一搞银行外围系统及产品开发的公司面试,想问问需要具体什么知识和是在什 关于ADO的问题(菜鸟问 急待回答!!) 用ADO访问数据库时,如何拼写动态SQL 怎样让对话框程序运行后不在任务栏显示图标 服务程序的问题 满分提问:TransparentBlt函数是不是不能用于JPG格式的图片,将其作透明处理?
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif使用 UNICODE 字符集编译工程
把_MBCS那个选项改成_UNICODE了,编译环境应该是UNICODE了把
可是还是没有样式
我在学WIN SDK,是直接用API建立的窗口,全部代码如下
#include <Windows.h>#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
int main(int args, char **argc)
{
void wintest2();
wintest2(); return 0;
}LRESULT WINAPI WinProc2(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_KEYUP:
MessageBox(hWnd, "hehe", "cap", MB_YESNO);
break;
case WM_CREATE:
break;
case WM_PAINT:
break;
case WM_CLOSE:
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}void wintest2()
{
WNDCLASSEX wndclsex;
HANDLE hWnd, hWnd2;
MSG msg;
wndclsex.cbSize = sizeof(WNDCLASSEX);
wndclsex.cbClsExtra = 0;
wndclsex.cbWndExtra = 0;
wndclsex.lpszClassName = "Stardust Window Class";
wndclsex.lpszMenuName = NULL;
wndclsex.lpfnWndProc = WinProc2;
wndclsex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclsex.hIconSm = NULL;
wndclsex.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclsex.hbrBackground = (HBRUSH) COLOR_WINDOW;
wndclsex.style = CS_HREDRAW | CS_VREDRAW;
RegisterClassEx(&wndclsex); hWnd = CreateWindowEx(WS_EX_CLIENTEDGE, "Stardust Window Class", "TEST", WS_OVERLAPPEDWINDOW ^ WS_MAXIMIZEBOX ^ WS_THICKFRAME ^ WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, NULL, NULL);
ShowWindow(hWnd, SW_SHOW); CreateWindowEx(0, "STATIC", "名称:", WS_CHILD | WS_VISIBLE, 30, 80, 48, 48, hWnd, NULL, NULL, NULL);
CreateWindowEx(0, "EDIT", "", WS_BORDER | WS_CHILD | WS_VISIBLE, 30 + 48 + 10, 80, 128, 24, hWnd, NULL, NULL, NULL); CreateWindowEx(0, "BUTTON", "hehe", WS_CHILD | WS_VISIBLE, 80, 180, 128, 48, hWnd, NULL, NULL, NULL);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
VC6却没用,一模一样的代码啊
诡~~~~
谁能帮我解释一下啊