int main() { if (!OpenClipboard(NULL)) { std::cout << "Unable to open clipboard" << std::endl; return 1; } EmptyClipboard(); UINT skypeClipboardFormat = RegisterClipboardFormat(L"SkypeMessageFragment"); if (skypeClipboardFormat == 0) { std::cout << "Unable to register clipboard format" << std::endl; return 2; } std::string message; std::string author; std::string date; int y, m, d, h, min = 0; std::tm time; std::cout << "Enter skype username of author: "; std::getline(std::cin, author); std::cout << "\nEnter message:\n"; std::getline(std::cin, message); long int secs = static_cast<long int>(std::time(NULL)); char str[30]; sprintf_s(str, sizeof(str), "%d", secs); std::string txt = "<quote author=\"" + author + "\" timestamp=\"" + str + "\">" + message + "</quote>"; CopyToClipboard(CF_TEXT, message); CopyToClipboard(skypeClipboardFormat, txt); CloseClipboard(); return 0; }
Parameter::~Parameter(void) { char string[NUM_PARAMETERS*12]; char tmpString[12]; /* Stop midi */ for (unsigned int devID = 0; devID < numDevices; devID++) { MMRESULT rc; rc = midiInReset(midiInDevice[devID]); rc = midiInStop(midiInDevice[devID]); rc = midiInClose(midiInDevice[devID]); } #if 0 /* Save to clipboard... */ string[0] = 0; for (int par = 0; par < NUM_PARAMETERS; par++) { if (changed[par]) { sprintf(tmpString, "%d:%.2f(%d) ", par, value[par], (int)(value[par]*127.0f + 0.49f)); strcat(string, tmpString); } } CopyToClipboard(string); #endif }
void CViewMessagesGrid::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewMessagesGrid::OnMessagesCopySelected - Function Begin")); CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); #ifdef wxUSE_CLIPBOARD pFrame->UpdateStatusText(_("Copying selected messages to Clipboard...")); OpenClipboard(); wxArrayInt arrSelRows = m_pGridPane->GetSelectedRows2(); for (unsigned int i=0; i< arrSelRows.GetCount();i++) { CopyToClipboard(arrSelRows[i]); } CloseClipboard(); pFrame->UpdateStatusText(wxT("")); #endif UpdateSelection(); pFrame->FireRefreshView(); wxLogTrace(wxT("Function Start/End"), wxT("CViewMessagesGrid::OnMessagesCopySelected - Function End")); }
void CLeftView::OnEditCopy() { // find selected item CListCtrl& ctlList = (CListCtrl&) GetListCtrl(); POSITION pos = ctlList.GetFirstSelectedItemPosition(); if (pos != NULL ) { int nItem = ctlList.GetNextSelectedItem(pos); if(nItem > -1) { CALDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc->m_listItems.IsEmpty()) { PITEMDATA pData = NULL; DWORD nIndex = (DWORD) ctlList.GetItemData(nItem); POSITION pos = pDoc->m_listItems.FindIndex(nIndex); if( pos != NULL) { pData = pDoc->m_listItems.GetAt(pos); if(pData) CopyToClipboard(pData->sData); } } } } }
void SelectedPacketsToClipboard(HWND ListBox) { char *Packet = new char[1000000]; Packet[0] = '\0'; DWORD Count = SendMessage(ListBox, LB_GETCOUNT, 0, 0); if ((Count != 0) && (Count != LB_ERR)) { for (DWORD i = 0; i < Count; i++) { if (SendMessage(ListBox, LB_GETSEL, i, 0) > 0) { DWORD Size = strlen(Packet); if (Size > 0) { Packet[Size] = '\r'; Packet[Size+1] = '\n'; SendMessage(ListBox, LB_GETTEXT, i, (LPARAM)&Packet[Size+2]); } else SendMessage(ListBox, LB_GETTEXT, i, (LPARAM)Packet); } } if (strlen(Packet) > 0) CopyToClipboard(Packet); } delete Packet; }
void CViewMessages::OnMessagesCopyAll( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesCopyAll - Function Begin")); CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); #ifdef wxUSE_CLIPBOARD pFrame->UpdateStatusText(_("Copying all messages to the clipboard...")); int iRowCount = m_pListPane->GetItemCount(); OpenClipboard(iRowCount); for (wxInt32 iIndex = 0; iIndex < iRowCount; iIndex++) { CopyToClipboard(iIndex); } CloseClipboard(); pFrame->UpdateStatusText(wxT("")); #endif UpdateSelection(); pFrame->FireRefreshView(); wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesCopyAll - Function End")); }
void CViewMessages::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesCopySelected - Function Begin")); CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); #ifdef wxUSE_CLIPBOARD wxInt32 iIndex = -1; pFrame->UpdateStatusText(_("Copying selected messages to the clipboard...")); OpenClipboard(m_pListPane->GetSelectedItemCount()); for (;;) { iIndex = m_pListPane->GetNextItem( iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); if (iIndex == -1) break; CopyToClipboard(iIndex); } CloseClipboard(); pFrame->UpdateStatusText(wxT("")); #endif UpdateSelection(); pFrame->FireRefreshView(); wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesCopySelected - Function End")); }
void WatchesTable::OnMenuCopyValue(wxCommandEvent& event) { wxUnusedVar(event); if (m_selectedId != wxNOT_FOUND) { wxString value = GetColumnText(m_selectedId, 1); // copy expr + value to clipboard CopyToClipboard(value); } }
/** * Copy a piece of map and instantly paste at given location. * * @param tile Tile where to paste (northern). * @param flags Command flags. * @param p1 Various bits: * \li bits 0..27 [28] - northern tile of the source area * \li bits 28..31 [4] - rail type (RailType) to convert to, ignored if CPM_CONVERT_RAILTYPE mode is off * @param p2 Various bits: * \li bits 0..5 [6] - source area width * \li bits 6..11 [6] - source area height * \li bits 12..15 [4] - additional amount of tile heights to add to each tile (-8..7) * \li bits 16..18 [3] - transformation to perform (DirTransformation) * \li bits 19..27 [9] - mode (CopyPasteMode) * \li bits 28..31 [4] - [ unused ] * @param text Unused. * @return The cost of this operation or an error. */ CommandCost CmdInstantCopyPaste(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { CopyPasteParams copy_paste; /* extract and validate source area */ copy_paste.src_area.tile = GenericTileIndex(TileIndex(GB(p1, 0, 28))); copy_paste.src_area.w = GB(p2, 0, 6); copy_paste.src_area.h = GB(p2, 6, 6); CommandCost ret = ValParamCopyPasteArea(copy_paste.src_area); if (ret.Failed()) return ret; /* calculate and validate destination area */ copy_paste.dst_area = TransformTileArea(copy_paste.src_area, GenericTileIndex(tile), copy_paste.transformation); ret = ValParamCopyPasteArea(copy_paste.dst_area); if (ret.Failed()) return ret; /* extract and validate copy/paste mode */ copy_paste.mode = (CopyPasteMode)GB(p2, 19, 9); if (!ValParamCopyPasteMode(copy_paste.mode)) return CMD_ERROR; /* extract and validate rail type */ copy_paste.railtype = (RailType)GB(p1, 28, 4); if (!ValParamRailtype(copy_paste.railtype)) return CMD_ERROR; /* extract transformation */ copy_paste.transformation = (DirTransformation)GB(p2, 16, 3); /* extract the additional number of height units */ int additional_height_delta = GB(p2, 12, 4); // this is a 4-bit SIGNED integer (-8..7) additional_height_delta |= -(additional_height_delta & (1 << 3)); // propagate the sign bit /* calculate the height */ copy_paste.height_delta = CalcCopyPasteHeightDelta(copy_paste.src_area, copy_paste.dst_area, copy_paste.transformation, additional_height_delta); /* when copy and paste areas are too close each other, firstly * copy to the clipboard and then from the clipboard to the map */ if (CopyPasteAreasMayColide(copy_paste)) { Map *clipboard = GetClipboardBuffer(INSTANT_COPY_PASTE_BUFFER); /* Copy to a buffer, but only in the first stage of the command. * In a single player game and also while we are a server, the first one is non-DC_EXEC * stage (which is fallowed then by a DC_EXEC stage). When we are a client, there is only * one stage which is either a single non-DC_EXEC stage (shift pressed), or a single DC_EXEC * stage (command comming from the network). */ if ((_networking && !_network_server) || !(flags & DC_EXEC)) { CopyToClipboard(clipboard, copy_paste.src_area); } /* paste from the clipboard */ ret = PasteFromClipboard(clipboard, tile, flags, copy_paste.mode, copy_paste.transformation, copy_paste.railtype, additional_height_delta); } else { /* copy/paste directly */ InitializePasting(flags, copy_paste); DoCopyPaste(copy_paste); ret = FinalizePasting(); } return ret; }
// Implement copy. void ScintillaQt::Copy() { if (!sel.Empty()) { SelectionText text; CopySelectionRange(&text); CopyToClipboard(text); } }
//--------------------------------------------------------------------------- void __fastcall TSynchronizeDialog::CopyLog() { TInstantOperationVisualizer Visualizer; UnicodeString Content; for (int i = 0; i < LogView->Items->Count; i++) { TListItem * Item = LogView->Items->Item[i]; Content += Item->Caption + L"\t" + Item->SubItems->Strings[0] + L"\r\n"; } CopyToClipboard(Content); }
void URLView::MouseUp( BPoint point ) { // If the link isn't enabled, don't do anything. if( !IsEnabled() ) return; // Do we want to show the right-click menu? if( inPopup && GetTextRect().Contains( point ) ) { BPopUpMenu *popup = CreatePopupMenu(); // Work around a current bug in Be's popup menus. point.y = point.y - 6; // Display the popup menu. BMenuItem *selected = popup->Go( ConvertToScreen( point ) , false, true ); // Did the user select an item? if( selected ) { BString label( selected->Label() ); // Did the user select the first item? If so, launch the URL. if( label.FindFirst( "Open" ) != B_ERROR || label.FindFirst( "Send" ) != B_ERROR || label.FindFirst( "Connect" ) != B_ERROR ) { LaunchURL(); } // Did the user select the second item? else if( label.FindFirst( "Copy" ) != B_ERROR ) { CopyToClipboard(); } } // If not, restore the normal link color. else { SetHighColor( color ); Redraw(); } } // If the link was clicked on (and not dragged), run the program // that should handle the URL. if( selected && GetTextRect().Contains( point ) && !draggedOut && !inPopup ) { LaunchURL(); } selected = false; draggedOut = false; inPopup = false; // Should we restore the hovering-highlighted color or the original // link color? if( GetTextRect().Contains( point ) && !draggedOut && !inPopup && hoverEnabled ) { SetHighColor( hoverColor ); } else if( !hovering ) SetHighColor( color ); Redraw(); }
void KeyboardWidget::CopyNotes() { const char *comma = ", "; const char *semi = ";\r\n"; // const char *obrack = "{"; const char *cbrack = "}"; RecNote *note; bsString pitches; if (recGroup) { bsString rhythms; bsString volumes; pitches = "{ "; rhythms = "{ "; volumes = "{ "; while ((note = recHead->next) != recTail) { PitchString(note->key, pitches); RhythmString(note->dur, rhythms); NumberString(note->vol, volumes); note->Remove(); delete note; if (recHead->next == recTail) break; pitches += comma; rhythms += comma; volumes += comma; } pitches += cbrack; pitches += comma; pitches += rhythms; pitches += cbrack; pitches += comma; pitches += volumes; pitches += cbrack; pitches += semi; } else { while ((note = recHead->next) != recTail) { PitchString(note->key, pitches); pitches += comma; RhythmString(note->dur, pitches); pitches += comma; NumberString(note->vol, pitches); pitches += semi; note->Remove(); delete note; } } CopyToClipboard(pitches); }
//--------------------------------------------------------------------------- void __fastcall TFileSystemInfoDialog::ClipboardButtonClick( TObject * /*Sender*/) { TInstantOperationVisualizer Visualizer; NeedSpaceAvailable(); FLastFeededControl = NULL; FClipboard = L""; Feed(ClipboardAddItem); CopyToClipboard(FClipboard); }
BOOL SMaskEdit::MaskCopy() { //if (!CanUseMask()) // return (BOOL)DefWindowProc(WM_COPY, 0, 0); GetMaskState(); SStringT strMaskedText = GetMaskedText(m_nStartChar, m_nEndChar); CopyToClipboard(strMaskedText); return TRUE; }
void CViewMessages::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesCopySelected - Function Begin")); CAdvancedFrame* pFrame = wxDynamicCast(GetParent()->GetParent()->GetParent(), CAdvancedFrame); wxASSERT(pFrame); wxASSERT(wxDynamicCast(pFrame, CAdvancedFrame)); wxASSERT(m_pListPane); #ifdef wxUSE_CLIPBOARD wxInt32 iIndex = -1; wxInt32 iRowCount = 0; pFrame->UpdateStatusText(_("Copying selected messages to the clipboard...")); // Count the number of items selected for (;;) { iIndex = m_pListPane->GetNextItem( iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); if (iIndex == -1) break; iRowCount++; } OpenClipboard( iRowCount * 1024 ); // Reset the position indicator iIndex = -1; // Copy selected items to clipboard for (;;) { iIndex = m_pListPane->GetNextItem( iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); if (iIndex == -1) break; CopyToClipboard(iIndex); } CloseClipboard(); pFrame->UpdateStatusText(wxT("")); #endif UpdateSelection(); wxLogTrace(wxT("Function Start/End"), wxT("CViewMessages::OnMessagesCopySelected - Function End")); }
void CClipboardMonitorDlg::ProcessString(CString& str) { if (str.IsEmpty()) return; int len = str.GetLength(); // remove quotes if present if (str[0] == L'\"' && str[len - 1] == L'\"') { str.Delete(len - 1); str.Delete(0); len -= 2; } str.MakeLower(); // check extension if (str.Right(2) != ".h") return; // make UNIX-style slashes str.Replace('\\', '/'); for (int i=0; i<m_includes.GetSize(); ++i) { const CString& path = m_includes[i]; int pos = str.Find(path); if (pos == -1) continue; // check to be a valid file name DWORD attr = GetFileAttributes(str); if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) return; // remove extra path part str.Delete(0, pos + path.GetLength()); if (str[0] == '/') str.Delete(0); // create c-style #include string CString include; include.Format(L"#include \"%s\"\r\n", str); // put it on the clipboard CopyToClipboard(include); break; } }
BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { char code_text[255] = ""; patch_addrs = FindPatchAddrs(); if(!patch_addrs[0] || !patch_addrs[1]) { MessageBoxA(hwndDlg, "Something went wrong, try loading a .exe file first...", "Error!", MB_ICONERROR); EndDialog(hwndDlg, 0); } else { unsigned int patch_dword1 = 0x88900100 ^ info_byte1; unsigned int patch_dword2 = 0x88900100 ^ info_byte2; sprintf(code_text, "lea edi, dword ptr ds:[%s+0x%X]\r\nmov dword ptr ds:[edi],0x%X\r\nlea edi, dword ptr ds:[%s+0x%X]\r\nmov dword ptr ds:[edi],0x%X", register_used, patch_addrs[0], patch_dword1, register_used, patch_addrs[1], patch_dword2); SetDlgItemTextA(hwndDlg, IDC_EDT_CODE, code_text); } } return TRUE; case WM_CLOSE: { EndDialog(hwndDlg, 0); } return TRUE; case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_BTN_COPY: { char code_text[255] = ""; GetDlgItemTextA(hwndDlg, IDC_EDT_CODE, code_text, 255); CopyToClipboard(code_text); } return TRUE; } } return TRUE; } return FALSE; }
// // Label - Handles Ctrl combination key presses. // static void EZ_label_CtrlComboKeyDown(ez_label_t *label, int key) { char c = (char)key; switch (c) { case 'c' : case 'C' : { if (LABEL_TEXT_SELECTED(label)) { // CTRL + C (Copy to clipboard). int selected_len = EZ_label_GetSelectedTextSize(label) + 1; char *selected_text = (char *)Q_malloc(selected_len * sizeof(char)); EZ_label_GetSelectedText(label, selected_text, selected_len); CopyToClipboard(selected_text); break; } } case 'v' : case 'V' : { // CTRL + V (Paste from clipboard). char *pasted_text = ReadFromClipboard(); EZ_label_AppendText(label, label->caret_pos.index, pasted_text); break; } case 'a' : case 'A' : { // CTRL + A (Select all). label->select_start = 0; label->select_end = label->text_length; label->int_flags |= label_selecting; EZ_label_SetCaretPosition(label, label->select_end); label->int_flags &= ~label_selecting; break; } default : { break; } } }
void CPanelMessages::OnMessagesCopyAll( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CPanelMessages::OnMessagesCopyAll - Function Begin")); #ifdef wxUSE_CLIPBOARD wxInt32 iIndex = -1; wxInt32 iRowCount = 0; OpenClipboard(); iRowCount = m_pList->GetItemCount(); for (iIndex = 0; iIndex < iRowCount; iIndex++) { CopyToClipboard(iIndex); } CloseClipboard(); #endif wxLogTrace(wxT("Function Start/End"), wxT("CPanelMessages::OnMessagesCopyAll - Function End")); }
//------------------------------------------------------------------------------------------------- MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); SondeLabel = centralWidget()->findChild<QLabel*>("SondeLabel"); SondeDirection = centralWidget()->findChild<QLabel*>("SondeDirection"); SondeDirectionUnit = centralWidget()->findChild<QLabel*>("SondeDirectionUnit"); SondeDistance = centralWidget()->findChild<QLabel*>("SondeDistance"); SondeDistanceUnit = centralWidget()->findChild<QLabel*>("SondeDistanceUnit"); LandingLabel = centralWidget()->findChild<QLabel*>("LandingLabel"); Direction = centralWidget()->findChild<QLabel*>("Direction"); DirectionUnit = centralWidget()->findChild<QLabel*>("DirectionUnit"); Distance = centralWidget()->findChild<QLabel*>("Distance"); DistanceUnit = centralWidget()->findChild<QLabel*>("DistanceUnit"); NormalArea = centralWidget()->findChild<QWidget*>("NormalArea"); if(NormalArea != NULL) { Latitude = NormalArea->findChild<QLabel*>("Latitude"); Longitude = NormalArea->findChild<QLabel*>("Longitude"); AscentDescent = NormalArea->findChild<QLabel*>("AscentDescent"); CopyButton = NormalArea->findChild<QPushButton*>("CopyButton"); if(CopyButton != NULL) { QString styleSheet = "QPushButton { background-color: rgba(0, 0, 0, 0%); }"; CopyButton->setStyleSheet(styleSheet); QObject::connect(CopyButton, SIGNAL (clicked()), this, SLOT (CopyToClipboard())); } } else { AscentDescent = NULL; CopyButton = NULL; } CurrentPhase= Position::PHASE_STARTUP; }
/** * Copy tile area into clipboard. * * @param tile Northern tile of the area to copy. * @param flags Command flags. * @param p1 Various bits: * \li bits 0..1 [2] - clipboard buffer index * \li bits 2..31 [30] - [ unused ] * @param p2 Various bits: * \li bits 0..5 [6] - width of area to copy * \li bits 6..11 [6] - height of area to copy * \li bits 12..31 [20] - [ unused ] * @param text Unused. * @return The cost of this operation or an error. */ CommandCost CmdCopyToClipboard(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { /* clipboard is available only in a sigle player game and only to the local company */ if (_networking || !IsLocalCompany()) return CMD_ERROR; /* extract and validate clipboard buffer index */ uint index = GB(p1, 0, 2); if (index >= NUM_CLIPBOARD_BUFFERS || index == INSTANT_COPY_PASTE_BUFFER) return CMD_ERROR; /* calculate and validate source area */ TileArea src_area(tile, GB(p2, 0, 6), GB(p2, 6, 6)); CommandCost ret = ValParamCopyPasteArea(src_area); if (ret.Failed()) return ret; /* copy to clipboard only when executing (DC_EXEC) */ if (flags & DC_EXEC) CopyToClipboard(GetClipboardBuffer(index), src_area); /* return the cost */ return CommandCost(INVALID_EXPENSES, 0); }
void DisplayVariableDlg::OnMenuSelection(wxCommandEvent& e) { wxTreeItemId item = m_treeCtrl->GetSelection(); if (item.IsOk() && !IsFakeItem(item)) { if (e.GetId() == XRCID("tip_add_watch")) { wxString fullpath = DoGetItemPath(item); clMainFrame::Get()->GetDebuggerPane()->GetWatchesTable()->AddExpression(fullpath); clMainFrame::Get()->GetDebuggerPane()->SelectTab(DebuggerPane::WATCHES); clMainFrame::Get()->GetDebuggerPane()->GetWatchesTable()->RefreshValues(); } else if (e.GetId() == XRCID("tip_copy_value")) { wxString itemText = m_treeCtrl->GetItemText(item); itemText = itemText.AfterFirst(wxT('=')); CopyToClipboard( itemText.Trim().Trim(true) ); } else if (e.GetId() == XRCID("edit_item")) { DoEditItem(item); } } }
void CPanelMessages::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CPanelMessages::OnMessagesCopySelected - Function Begin")); #ifdef wxUSE_CLIPBOARD wxInt32 iIndex = -1; OpenClipboard(); for (;;) { iIndex = m_pList->GetNextItem( iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); if (iIndex == -1) break; CopyToClipboard(iIndex); } CloseClipboard(); #endif wxLogTrace(wxT("Function Start/End"), wxT("CPanelMessages::OnMessagesCopySelected - Function End")); }
//--------------------------------------------------------------------------- void __fastcall TFileSystemInfoDialog::CopyClick(TObject * Sender) { TInstantOperationVisualizer Visualizer; TComponent * Item = dynamic_cast<TComponent *>(Sender); assert(Item != NULL); TPopupMenu * PopupMenu = dynamic_cast<TPopupMenu *>(Item->Owner); assert(PopupMenu != NULL); TListView * ListView = dynamic_cast<TListView *>(PopupMenu->PopupComponent); assert(ListView != NULL); UnicodeString Text; for (int Index = 0; Index < ListView->Items->Count; Index++) { TListItem * Item = ListView->Items->Item[Index]; if (Item->Selected) { Text += FORMAT(L"%s = %s\r\n", (Item->Caption, Item->SubItems->Strings[0])); } } CopyToClipboard(Text); }
void CDlgEventLog::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) { wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopySelected - Function Begin")); #ifdef wxUSE_CLIPBOARD wxInt32 iIndex = -1; wxInt32 iRowCount = 0; // Count the number of items selected for (;;) { iIndex = m_pList->GetNextItem( iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); if (iIndex == -1) break; iRowCount++; } OpenClipboard( iRowCount * 1024 ); // Reset the position indicator iIndex = -1; for (;;) { iIndex = m_pList->GetNextItem( iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); if (iIndex == -1) break; CopyToClipboard(iIndex); } CloseClipboard(); #endif wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopySelected - Function End")); }
String DisplayDirector::FunctionCall(String function, String arg, StyleScriptable* target) { if (function == "actionAllowed") { bool result = false; arg = target->Eval(arg).trim(); if (arg == "Save()") result = IsDirty(); else if (arg == "Undo()") result = (lastAction != sentinalAction); else if (arg == "Redo()") result = (lastAction->NextAction() != NULL); else if (arg == "Copy()" || arg == "Cut()") result = (selection && selection->CanCopy()); else if (arg == "Paste()") result = (selection && selection->CanPaste() && !System::GetClipboardText().empty()); else if (arg.startsWith("doc-source.")) { arg = arg.substr(11, arg.length() - 11); return docSource->FunctionCall("actionAllowed", arg, target); } return (result ? "true" : ""); } else if (function == "Undo") Undo(); else if (function == "Redo") Redo(); else if (function == "Save") Save(); else if (function == "Copy") CopyToClipboard(); else if (function == "Paste") Paste(); else return StyleScriptable::FunctionCall(function, arg, target); return String(); }
/********************************************************************** * Functions *********************************************************************/ BOOL CALLBACK IH_DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: { g_HWND=hwndDlg; EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_INLINE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_COPY), FALSE); } return TRUE; case WM_HELP: { char id[10]=""; sprintf(id, "%d", IDS_HELPINLINE); SetEnvironmentVariableA("HELPID", id); SetEnvironmentVariableA("HELPTITLE", "Inline Help"); DialogBox(hInst, MAKEINTRESOURCE(DLG_HELP), hwndDlg, DlgHelp); } return TRUE; case WM_BROWSE: { strcpy(g_szFileName, (const char*)wParam); //Retrieve the directory of the file. int i=strlen(g_szFileName)-1; int j=0; while(g_szFileName[i]!='\\') { i--; j++; } strncpy(g_szTargetDir, g_szFileName, strlen(g_szFileName)-j-1); //Retrieve stuff. EnableWindow(GetDlgItem(g_HWND, IDC_BTN_INLINE), FALSE); EnableWindow(GetDlgItem(g_HWND, IDC_BTN_COPY), FALSE); SendDlgItemMessageA(g_HWND, IDC_EDT_OEP, EM_SETREADONLY, 0, 0); //Enable change of OEP... DragAcceptFiles(g_HWND, FALSE); g_FileIsDll=IH_Debugger(g_szFileName, &g_TargetData, IH_DebugEnd_Callback, IH_ErrorMessageCallback); } return TRUE; case WM_DROPFILES: { //Get the dropped file name. DragQueryFileA((HDROP)wParam, 0, g_szFileName, 256); //Retrieve the directory of the file. int i=strlen(g_szFileName)-1; int j=0; while(g_szFileName[i]!='\\') { i--; j++; } strncpy(g_szTargetDir, g_szFileName, strlen(g_szFileName)-j-1); //Retrieve stuff. EnableWindow(GetDlgItem(g_HWND, IDC_BTN_INLINE), FALSE); EnableWindow(GetDlgItem(g_HWND, IDC_BTN_COPY), FALSE); SendDlgItemMessageA(g_HWND, IDC_EDT_OEP, EM_SETREADONLY, 0, 0); //Enable change of OEP... DragAcceptFiles(g_HWND, FALSE); g_FileIsDll=IH_Debugger(g_szFileName, &g_TargetData, IH_DebugEnd_Callback, IH_ErrorMessageCallback); } return TRUE; case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_BTN_INLINE: { NoFocus(); if(!(g_TargetData.EmptyEntry)) { MessageBoxA(hwndDlg, "You need to specify the place to start the inline...", "N00B!", MB_ICONERROR); return TRUE; } char patch_filename[256]=""; patch_filename[0]=0; OPENFILENAME ofstruct; memset(&ofstruct, 0, sizeof(ofstruct)); ofstruct.lStructSize=sizeof(ofstruct); ofstruct.hwndOwner=hwndDlg; ofstruct.hInstance=hInst; if(!g_FileIsDll) ofstruct.lpstrFilter="Executable files (*.exe)\0*.exe\0\0"; else ofstruct.lpstrFilter="Executable files (*.dll)\0*.dll\0\0"; ofstruct.lpstrFile=patch_filename; ofstruct.nMaxFile=256; ofstruct.lpstrInitialDir=g_szTargetDir; ofstruct.lpstrTitle="Save file"; if(!g_FileIsDll) ofstruct.lpstrDefExt="exe"; else ofstruct.lpstrDefExt="dll"; ofstruct.Flags=OFN_EXTENSIONDIFFERENT|OFN_HIDEREADONLY|OFN_NONETWORKBUTTON|OFN_OVERWRITEPROMPT; GetSaveFileName(&ofstruct); if(!patch_filename[0]) { MessageBoxA(hwndDlg, "You must select a file...", "Warning", MB_ICONWARNING); return TRUE; } CopyFileA(g_szFileName, patch_filename, FALSE); SetPE32Data(patch_filename, 0, UE_OEP, g_TargetData.EmptyEntry-g_TargetData.ImageBase); long newflags=(long)GetPE32Data(patch_filename, g_TargetData.EntrySectionNumber, UE_SECTIONFLAGS); SetPE32Data(patch_filename, g_TargetData.EntrySectionNumber, UE_SECTIONFLAGS, (newflags|0x80000000)); IH_GenerateAsmCode(g_codeText, g_TargetData); CopyToClipboard(g_codeText); MessageBoxA(hwndDlg, "1) Open the file you just saved with OllyDbg\n2) Open Multimate Assembler v1.5+\n3) Paste the code\n4) Modify the code to do something with the Security DLL\n5) Save the patched file with OllyDbg\n6) Enjoy!", "Instructions", MB_ICONINFORMATION); } return TRUE; case IDC_EDT_FREESPACE: { char free_temp[10]=""; GetDlgItemTextA(hwndDlg, IDC_EDT_FREESPACE, free_temp, 10); sscanf(FormatTextHex(free_temp), "%X", &(g_TargetData.EmptyEntry)); } return TRUE; case IDC_BTN_COPY: { NoFocus(); if(g_codeText[0]) { IH_GenerateAsmCode(g_codeText, g_TargetData); CopyToClipboard(g_codeText); MessageBoxA(hwndDlg, "Code copied to clipboard!", "Yay!", MB_ICONINFORMATION); } else MessageBoxA(hwndDlg, "There is no code to copy, please load a file first...", "Error!", MB_ICONERROR); } return TRUE; case IDC_BTN_PLUGINS: { NoFocus(); PLUGFUNC PluginFunction; HINSTANCE PLUGIN_INST; char total_found_s[5]=""; char plugin_name[100]=""; char plugin_dll[100]=""; char dll_to_load[256]=""; char temp_str[5]=""; int total_found=0; GetPrivateProfileStringA("Plugins", "total_found", "", total_found_s, 4, sg_szPluginIniFilePath); sscanf(total_found_s, "%d", &total_found); if(total_found) { HMENU myMenu=0; myMenu=CreatePopupMenu(); for(int i=1; i!=(total_found+1); i++) { sprintf(temp_str, "%d", i); GetPrivateProfileStringA(temp_str, "plugin_name", "", plugin_name, 100, sg_szPluginIniFilePath); AppendMenuA(myMenu, MF_STRING, i, plugin_name); } POINT cursorPos; GetCursorPos(&cursorPos); SetForegroundWindow(hwndDlg); UINT MenuItemClicked=TrackPopupMenu(myMenu, TPM_RETURNCMD|TPM_NONOTIFY, cursorPos.x, cursorPos.y, 0, hwndDlg, 0); SendMessage(hwndDlg, WM_NULL, 0, 0); if(!MenuItemClicked) return TRUE; sprintf(temp_str, "%d", (int)MenuItemClicked); GetPrivateProfileStringA(temp_str, "plugin_dll", "", plugin_dll, 100, sg_szPluginIniFilePath); sprintf(dll_to_load, "plugins\\%s", plugin_dll); PLUGIN_INST=LoadLibraryA(dll_to_load); if(!PLUGIN_INST) MessageBoxA(hwndDlg, "There was an error loading the plugin", plugin_dll, MB_ICONERROR); else { PluginFunction=(PLUGFUNC)GetProcAddress(PLUGIN_INST, "PluginFunction"); if(!PluginFunction) MessageBoxA(hwndDlg, "The export \"PluginFunction\" could not be found, please contact the plugin supplier", plugin_dll, MB_ICONERROR); else { if(!g_TargetData.ImageBase) g_TargetData.ImageBase=0x400000; ShowWindow(GetParent(hwndDlg), 0); PluginFunction(PLUGIN_INST, hwndDlg, g_TargetData.SecurityAddrRegister, sg_szAKTDirectory, g_TargetData.ImageBase); ShowWindow(GetParent(hwndDlg), 1); FreeLibrary(PLUGIN_INST); SetForegroundWindow(hwndDlg); } } } else { HMENU myMenu=0; myMenu=CreatePopupMenu(); AppendMenuA(myMenu, MF_STRING|MF_GRAYED, 1, "No plugins found :("); POINT cursorPos; GetCursorPos(&cursorPos); SetForegroundWindow(hwndDlg); TrackPopupMenu(myMenu, TPM_RETURNCMD|TPM_NONOTIFY, cursorPos.x, cursorPos.y, 0, hwndDlg, 0); } } return TRUE; case IDC_EDT_OEP: { char temp_oep[10]=""; GetDlgItemTextA(hwndDlg, IDC_EDT_OEP, temp_oep, 10); sscanf(temp_oep, "%X", &(g_TargetData.OEP)); } return TRUE; } } return TRUE; } return FALSE; }
void MyLineEdit::slotCopyVector() const { CopyToClipboard(); }
/*------------------------------------------------------------------------ Procedure: HandleCommand ID:1 Purpose: Handles all menu commands. Input: Output: Errors: -------------------------------------------------------------------------- Edit History: 06 Oct 2003 - Chris Watford [email protected] - Removed entries that crashed OCaml - Removed useless entries - Added Save ML and Save Transcript ------------------------------------------------------------------------*/ void HandleCommand(HWND hwnd, WPARAM wParam,LPARAM lParam) { char *fname; int r; switch(LOWORD(wParam)) { case IDM_OPEN: fname = SafeMalloc(512); if (OpenMlFile(fname,512)) { char *buf = SafeMalloc(512); char *p = strrchr(fname,'.'); if (p && !stricmp(p,".ml")) { wsprintf(buf, "#use \"%s\";;", fname); AddLineToControl(buf); } else if (p && !stricmp(p,".cmo")) { wsprintf(buf, "#load \"%s\";;", fname); AddLineToControl(buf); } free(buf); } free(fname); break; case IDM_GC: AddLineToControl("Gc.full_major();;"); break; case IDCTRLC: InterruptOcaml(); break; case IDM_EDITPASTE: Add_Clipboard_To_Queue(); break; case IDM_EDITCOPY: CopyToClipboard(hwnd); break; // updated to save a transcript case IDM_SAVEAS: fname = SafeMalloc(512); if (GetSaveName(fname,512)) { SaveText(fname); } free(fname); break; // updated to save an ML file case IDM_SAVE: fname = SafeMalloc(512); if (GetSaveMLName(fname,512)) { SaveML(fname); } free(fname); break; // updated to work with new history system case IDM_HISTORY: r = CallDlgProc(HistoryDlgProc,IDD_HISTORY); if (r) { AddLineToControl(GetHistoryLine(r-1)); } break; case IDM_PRINTSU: // Removed by Chris Watford // seems to die // CallPrintSetup(); break; case IDM_FONT: CallChangeFont(hwndMain); break; case IDM_COLORTEXT: ProgramParams.TextColor = CallChangeColor(ProgramParams.TextColor); ForceRepaint(); break; case IDM_BACKCOLOR: BackColor = CallChangeColor(BackColor); DeleteObject(BackgroundBrush); BackgroundBrush = CreateSolidBrush(BackColor); ForceRepaint(); break; case IDM_EDITUNDO: Undo(hwnd); break; /* Removed, really not very useful in this IDE case IDM_WINDOWTILE: SendMessage(hwndMDIClient,WM_MDITILE,0,0); break; case IDM_WINDOWCASCADE: SendMessage(hwndMDIClient,WM_MDICASCADE,0,0); break; case IDM_WINDOWICONS: SendMessage(hwndMDIClient,WM_MDIICONARRANGE,0,0); break; */ case IDM_EXIT: PostMessage(hwnd,WM_CLOSE,0,0); break; case IDM_ABOUT: CallDlgProc(AboutDlgProc,IDD_ABOUT); break; default: if (LOWORD(wParam) >= IDEDITCONTROL && LOWORD(wParam) < IDEDITCONTROL+5) { switch (HIWORD(wParam)) { case EN_ERRSPACE: ResetText(); break; } } break; } }