我创建了一个带有一些控件的对话框 -
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) 我有一个疑问,因为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的内存那么为什么它这样做呢?