简体   繁体   English

如何将此代码实现到对话框类型资源文件中?

[英]How do I implement this code into a dialog type resource file?

// Epvolume.rc -- Resource script

#include "resource.h"
#include "windows.h"
#include "commctrl.h"

//
// Dialog box
//
VOLUMECONTROL DIALOGEX 0, 0, 160, 60
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | DS_SETFONT
CAPTION "Audio Endpoint Volume"
FONT 8, "Arial Rounded MT Bold", 400, 0, 0x0
BEGIN
    LTEXT      "Min",IDC_STATIC_MINVOL,10,10,20,12
    RTEXT      "Max",IDC_STATIC_MAXVOL,130,10,20,12
    CONTROL    "",IDC_SLIDER_VOLUME,"msctls_trackbar32",
               TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,10,20,140,12
    CONTROL    "Mute",IDC_CHECK_MUTE,"Button",
               BS_AUTOCHECKBOX | WS_TABSTOP,20,40,70,12
END

I don't know a thing about resource files, I tried to make it a dialog resource type but I don't quite know how to enter this code into that dialog file because I don't really know how to work it.我对资源文件一无所知,我试图将其设为对话框资源类型,但我不太清楚如何将此代码输入到该对话框文件中,因为我真的不知道如何使用它。 Just to clear things up, when I make a new dialog file it gives me a blank dialog, which I don't know how to edit, maybe I'm doing something wrong?只是为了澄清一下,当我创建一个新的对话框文件时,它会给我一个空白对话框,我不知道如何编辑,也许我做错了什么? I don't know where to put the code我不知道把代码放在哪里

You need to open the resource file as text rather than with the designer.您需要以文本形式而不是使用设计器打开资源文件。 In solution explorer select the resource script file and hit ctrl+alt+0.在解决方案资源管理器 select 中,资源脚本文件并按 ctrl+alt+0。 You can then cut-and-paste text as usual.然后,您可以照常剪切和粘贴文本。

Most of the time when simply laying out a new dialog it is easier to use the designer but editting it as text is much easier when you have existing resources you want to bring into a project.大多数情况下,简单地布置一个新对话框更容易使用设计器,但当您拥有想要引入项目的现有资源时,将其编辑为文本会容易得多。

Note that you will also need to edit resources.h to add the various control symbol names (for example IDC_SLIDER_VOLUME) as well as modifying _APS_NEXT_CONTROL_VALUE to be the next unused value.请注意,您还需要编辑 resources.h 以添加各种控制符号名称(例如 IDC_SLIDER_VOLUME),并将 _APS_NEXT_CONTROL_VALUE 修改为下一个未使用的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在C ++中为对话框实现Windows风格? - How do I implement Windows style for a dialog box in C++? 如何在Win32 C ++中将数据类型传递到资源(.rc)文件? - How do I pass a data type to a resource (.rc) file in Win32 C++? 如何在没有通过引用传递的资源的情况下简化 java 中的代码? - How do I simplify this code in java without the resource of passing by reference? 如何获得Visual Studio 2008为MFC对话框资源创建类? - How do i get visual studio 2008 to create a class for my MFC dialog resource? 如何在另一个VS 2013项目中的新VS 2013项目上使用对话框(资源文件)? - How can I use a dialog (resource file) on a new VS 2013 project from a different VS 2013 project? 在Qt中,如何实现与代码中的变量保持一致的小部件 - In qt, how do I implement a widget that stays consistent with variables in the code 如何在类中实现“模板”? 我的代码有问题吗? - How do I implement "template" in classes? Is there something wrong with my code? 如何在此 C++ 代码中实现轮数? - How do I implement the number of rounds in this C++ code? 如何使用Tensorflow c ++来实现此代码(FaceNet)? - How do I use Tensorflow c++ to implement this code (FaceNet)? 如何在文件打开对话框中隐藏特定控件? (使用CFileDialog创建的对话框) - How do I hide a particular control in File-open dialog? (A dialog created using CFileDialog)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM