我可以用deiphi编写下面的代码吗?200分(0分)

  • 主题发起人 主题发起人 IoveDelphi
  • 开始时间 开始时间
I

IoveDelphi

Unregistered / Unconfirmed
GUEST, unregistred user!
void CActivedeskDlg::OnAdd( )

{

CFileDialog fd ( TRUE, NULL, NULL, NULL, "ActiveDesktop Files(*.htm,*.jpg,*.gif,*.bmp)|*.htm;*.jpg;*.gif;*.bmp||" ) ;

if ( fd.DoModal( ) == IDCANCEL )

return ;

CString fname = fd.GetPathName( ) ;

COMPONENT comp = { 0 } ;

comp.dwSize = sizeof ( comp ) ;

comp.fChecked = 1 ;

comp.fNoScroll = 0 ;

comp.fDirty = 0 ;

COMPPOS pos = { 0 } ;

pos.dwSize = sizeof ( pos ) ;

pos.dwHeight = 250 ;

pos.dwWidth = 250 ;

pos.fCanResize = 1 ;

pos.fCanResizeX = 1 ;

pos.fCanResizeY = 1 ;

pos.iLeft = 200 ;

pos.iPreferredLeftPercent = 60 ;

pos.iPreferredTopPercent = 30 ;

pos.iTop = 50 ;

pos.izIndex = 0 ;

comp.cpPos = pos ;

if ( fd.GetFileExt( ) == "htm" )

comp.iComponentType = COMP_TYPE_WEBSITE ;

else

comp.iComponentType = COMP_TYPE_PICTURE ;



USES_CONVERSION ;

wcscpy ( comp.wszSource, T2OLE ( ( LPCTSTR ) fname ) ) ;

wcscpy ( comp.wszSubscribedURL, T2OLE ( ( LPCTSTR ) fname ) ) ;

wcscpy ( comp.wszFriendlyName, T2OLE ( ( LPCTSTR ) fd.GetFileName( ) ) ) ;

HRESULT hr = pad -> AddDesktopItem ( &comp, 0 ) ;

if ( FAILED ( hr ) )

MessageBox ( "Cannot add item" ) ;

else

{

pad -> ApplyChanges ( AD_APPLY_SAVE | AD_APPLY_REFRESH | AD_APPLY_FORCE ) ;

m_list.AddString ( fname ) ;

}

}

分数在http://www.delphibbs.com/delphibbs/dispq.asp?lid=1853170
 
后退
顶部