//--------------------------------------------------------------------------- #include #pragma hdrstop #include "GlobalUnit.h" #include "ManageSongFormUnit.h" #include "QRcodePanel.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "PNGButton" #pragma resource "*.dfm" TManageSongForm *ManageSongForm; TQRcodePanel * QRPanel = NULL; //--------------------------------------------------------------------------- __fastcall TManageSongForm::TManageSongForm(TComponent* Owner, bool bUpload, UINT idSong ) : TForm(Owner) { m_pQRdata = NULL; char strURL[1024]; if( bUpload ){ if( idSong>0 ){ String strMsg = L"歌曲上传成功\n\n请进入网站"; if( f_QR_Encode && f_CS_GetWebPageURL ){ char strURL[256], strID[20]; f_CS_GetWebPageURL( URL_SHAREPLAY, strURL ); sprintf( strID, "%d", idSong ); strcat( strURL, strID ); m_pQRdata = new unsigned char[100*100]; int qrWidth = f_QR_Encode( strURL, m_pQRdata ); QRPanel = new TQRcodePanel( NULL ); if( QRPanel ){ m_lbMsg->Width = 150; m_lbGoManage->Left = 72; QRPanel->Parent = this; QRPanel->SetBounds( 192, 26, 100, 100 ); QRPanel->SetQRData( qrWidth, m_pQRdata ); QRPanel->Show(); } } strMsg += L"试听和分享"; f_CS_GetWebPageURL( URL_SONGPLAY, strURL ); m_strGo = strURL; m_strGo += "&musicId=" + IntToStr( (int)idSong ); m_lbMsg->Caption = strMsg; } } else{ m_lbMsg->Caption = L"您上传的未发布歌曲数量已达上限,\n\n请进入网站处理。"; f_CS_GetWebPageURL( URL_SONGMANAGE, strURL ); m_strGo = strURL; } Font->Color = RGB(60,43,23); } //--------------------------------------------------------------------------- void __fastcall TManageSongForm::FormCreate(TObject *Sender) { SetTransparent( this ); Left = Screen->Width / 2 - Width / 2; Top = Screen->Height / 2 - Height / 2; HRGN hRgn = CreateRoundRectRgn(0, 0, Width + 1, Height + 1, 20, 20); SetWindowRgn(Handle, hRgn, TRUE); DeleteObject(hRgn); } //--------------------------------------------------------------------------- void __fastcall TManageSongForm::WMNCHitTest(TWMNCHitTest &Msg) { TForm::Dispatch(&Msg); if (Msg.Result == HTCLIENT && Msg.XPos > Left + 10 && Msg.XPos < Left + Width - 20 && Msg.YPos < Top + 24) Msg.Result = HTCAPTION; } //--------------------------------------------------------------------------- void __fastcall TManageSongForm::GoManageMouseEnter(TObject *Sender) { Screen->Cursor = crHandPoint; } //--------------------------------------------------------------------------- void __fastcall TManageSongForm::GoManageMouseLeave(TObject *Sender) { Screen->Cursor = crDefault; } //--------------------------------------------------------------------------- void __fastcall TManageSongForm::GoManageClick(TObject *Sender) { // char strURL[256]; // f_CS_GetWebPageURL( URL_SONGMANAGE, strURL ); // ShellExecute(Handle, NULL, ((String)strURL).c_str(), NULL, NULL, SW_SHOWNORMAL); ShellExecute(Handle, NULL, m_strGo.c_str(), NULL, NULL, SW_SHOWNORMAL); ModalResult = mrOk; } //--------------------------------------------------------------------------- void __fastcall TManageSongForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { switch( Key ){ case VK_RETURN: return GoManageClick(NULL); break; case VK_ESCAPE: ModalResult = mrCancel; break; } } //--------------------------------------------------------------------------- void __fastcall TManageSongForm::FormDestroy(TObject *Sender) { if( QRPanel ){ delete QRPanel; QRPanel = NULL; } if( m_pQRdata ){ delete[] m_pQRdata; m_pQRdata = NULL; } } //---------------------------------------------------------------------------