小编Sak*_*ket的帖子

如何获得对话框中控件的宽度 - 高度

我创建了一个带有一些控件的对话框 -

IDD_DIALOG_EFFECTS DIALOGEX 0, 0, 168, 49
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif", 400, 0, 0x1
BEGIN
    ---           ---
    ---           ---
    CTEXT           "",3,200,120,60,60, WS_VISIBLE
END
Run Code Online (Sandbox Code Playgroud)

在Header中 - 文件:const int16 kItem = 3;

现在,当我试图获得控件的位置和尺寸时,它并不准确.

// Retrieving the location and dimension of the control
RECT    wRect_proxy;
GetWindowRect(GetDlgItem(hDlg, kItem), &wRect_proxy);
ScreenToClient (hDlg, (LPPOINT)&wRect_proxy);
ScreenToClient (hDlg, (LPPOINT)&(wRect_proxy.right));

// Output of the control as location and position that I am getting is:
wRect_proxy.left:   300     (Expected: 200)
wRect_proxy.top:    195     (Expected: 120)
wRect_proxy.right: …
Run Code Online (Sandbox Code Playgroud)

height winapi controls get width

0
推荐指数
1
解决办法
89
查看次数

编译器是否对由new初始化的对象调用隐式析构函数

我有一个疑问,因为C++(GNU g ++)编译器调用带有堆栈中对象的隐式d-tor.当它为一个对象调用d-tor时,内存 - 用new分配.

struct abc{
   int a;
};

int main(){
 {
     abc ob1;
 }//! Here implicit ~abc() will be called

 {
 abc *ob2 = new abc();
 } //! Will comipler call d-tor for ob2 ?

 return 0;
}
Run Code Online (Sandbox Code Playgroud)

请帮助我知道,如果编译器没有释放*ob2的内存那么为什么它这样做呢?

c++ destructor

0
推荐指数
1
解决办法
120
查看次数

标签 统计

c++ ×1

controls ×1

destructor ×1

get ×1

height ×1

width ×1

winapi ×1