SlideShare a Scribd company logo
1 of 7
Using Clipboard and Data Copy 
for IPC in Windows 
Describes using two simplest techniques of 
IPC in Windows: Clipboard and Data Copy 
Compiled By: 
B. Vinoth Raj 
Senior Software Engineer 
Mindfire Solutions
IPC using Clipboard 
 Loosely coupled exchange medium 
 For data exchange, applications agree on the data format 
 Data can be shared between processes on same computer 
or unrelated processes on a network 
 Windows API functions used are: 
OpenClipboard(), EmptyClipboard(), SetClipboardData(), 
CloseClipboard() and GetClipboardData()
IPC using Clipboard (cont.) 
 Before copying data one opens the clipboard using 
OpenClipboard() 
 Emtpy the clipboard using EmptyClipboard() to clear 
existing contents 
 Set data using SetClipboardData() function in a specified 
format 
 Close the clipboard using CloseClipboard() function 
 Read the data using GetClipboardData() function in 
another process
IPC using Clipboard (cont.) 
 Before copying data one opens the clipboard using 
OpenClipboard() 
CString sData(_T("Sample data")); 
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, (sData.GetLength() + 1) * 
sizeof(WCHAR)); memcpy(GlobalLock(hMem), sData, sData.GetLength() * sizeof(WCHAR)); 
GlobalUnlock(hMem); 
OpenClipboard(); 
EmptyClipboard(); 
SetClipboardData(CF_UNICODETEXT, hMem); 
CloseClipboard(); 
· GlobalAlloc function is used because the system takes 
ownership of the memory passed to the clipboard
IPC using Data Copy 
 Use WM_COPYDATA windows message to share data 
 SendMessage() API function used to send data 
 COPYDATASTRUCT structure used to send data 
SendMessage(hwnd, // Handle to destination window 
WM_COPYDATA, // Message to send to destination window 
(WPARAM)wparam, // Handle to window passing the data 
(LPARAM)lparam); // Data (pointer to COPYDATASTRUCT) 
 The data sent is read-only for the receiving application 
 Works only for processes running on same computer
IPC using Data Copy (cont.) 
 Code Usage 
CString sMsg(_T("Hello this message is from WM_COPYDATA")); 
COPYDATASTRUCT data; 
data.dwData = 1; 
data.cbData = sMsg.GetLength()*sizeof(WCHAR); 
data.lpData = &sMsg; 
HWND destWnd = FindWindow(_T("WinClassName"), _T("WindowName")); 
SendMessage(destWnd, WM_COPYDATA, (WPARAM)(HWND)hwnd, (LPARAM)(LPVOID)&data); 
Receiving application should implement the WM_COPYDATA message in its message loop: 
case WM_COPYDATA: 
PCOPYDATASTRUCT pcData; 
pcData = (PCOPYDATASTRUCT) lParam; 
CString* sRecvMsg = pcData->lpData; 
break;
Thanks!

More Related Content

What's hot

Cloud storage: the right way OSS EU 2018
Cloud storage: the right way OSS EU 2018Cloud storage: the right way OSS EU 2018
Cloud storage: the right way OSS EU 2018Orit Wasserman
 
Exploiting rateless codes in cloud storage systems
Exploiting rateless codes in cloud storage systemsExploiting rateless codes in cloud storage systems
Exploiting rateless codes in cloud storage systemsieeepondy
 
Monitoring your shiny new docker environment
Monitoring your shiny new docker environmentMonitoring your shiny new docker environment
Monitoring your shiny new docker environmentSamuel Vandamme
 
RedisConf 2019 Netflix Dyno
RedisConf 2019 Netflix DynoRedisConf 2019 Netflix Dyno
RedisConf 2019 Netflix DynoKishore Kasi
 
GIS on Rails by Oleksandr Kychun
GIS on Rails by Oleksandr Kychun GIS on Rails by Oleksandr Kychun
GIS on Rails by Oleksandr Kychun Pivorak MeetUp
 
[WebMuses] Big data dla zdezorientowanych
[WebMuses] Big data dla zdezorientowanych[WebMuses] Big data dla zdezorientowanych
[WebMuses] Big data dla zdezorientowanychPrzemek Maciolek
 
Groovy reactive streams
Groovy reactive streamsGroovy reactive streams
Groovy reactive streamsadam1davis
 
OpenNebula Conf: 2014 | Lightning talk: Managing Docker Containers with OpenN...
OpenNebula Conf: 2014 | Lightning talk: Managing Docker Containers with OpenN...OpenNebula Conf: 2014 | Lightning talk: Managing Docker Containers with OpenN...
OpenNebula Conf: 2014 | Lightning talk: Managing Docker Containers with OpenN...NETWAYS
 
Approaches for duplicating Kubernetes Storage with Gluster
Approaches for duplicating Kubernetes Storage with GlusterApproaches for duplicating Kubernetes Storage with Gluster
Approaches for duplicating Kubernetes Storage with Glustermountpoint.io
 
Knot.x - reactive web integration platform
Knot.x - reactive web integration platformKnot.x - reactive web integration platform
Knot.x - reactive web integration platformKnot.x Team
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik TambekarPratik Tambekar
 
Apache Cassandra Lunch #67: Moving Data from Cassandra to Datastax Astra
Apache Cassandra Lunch #67: Moving Data from Cassandra to Datastax AstraApache Cassandra Lunch #67: Moving Data from Cassandra to Datastax Astra
Apache Cassandra Lunch #67: Moving Data from Cassandra to Datastax AstraAnant Corporation
 

What's hot (14)

Cloud storage: the right way OSS EU 2018
Cloud storage: the right way OSS EU 2018Cloud storage: the right way OSS EU 2018
Cloud storage: the right way OSS EU 2018
 
Netflix Data Benchmark @ HPTS 2017
Netflix Data Benchmark @ HPTS 2017Netflix Data Benchmark @ HPTS 2017
Netflix Data Benchmark @ HPTS 2017
 
Exploiting rateless codes in cloud storage systems
Exploiting rateless codes in cloud storage systemsExploiting rateless codes in cloud storage systems
Exploiting rateless codes in cloud storage systems
 
Monitoring your shiny new docker environment
Monitoring your shiny new docker environmentMonitoring your shiny new docker environment
Monitoring your shiny new docker environment
 
RedisConf 2019 Netflix Dyno
RedisConf 2019 Netflix DynoRedisConf 2019 Netflix Dyno
RedisConf 2019 Netflix Dyno
 
GIS on Rails by Oleksandr Kychun
GIS on Rails by Oleksandr Kychun GIS on Rails by Oleksandr Kychun
GIS on Rails by Oleksandr Kychun
 
[WebMuses] Big data dla zdezorientowanych
[WebMuses] Big data dla zdezorientowanych[WebMuses] Big data dla zdezorientowanych
[WebMuses] Big data dla zdezorientowanych
 
Groovy reactive streams
Groovy reactive streamsGroovy reactive streams
Groovy reactive streams
 
OpenNebula Conf: 2014 | Lightning talk: Managing Docker Containers with OpenN...
OpenNebula Conf: 2014 | Lightning talk: Managing Docker Containers with OpenN...OpenNebula Conf: 2014 | Lightning talk: Managing Docker Containers with OpenN...
OpenNebula Conf: 2014 | Lightning talk: Managing Docker Containers with OpenN...
 
Approaches for duplicating Kubernetes Storage with Gluster
Approaches for duplicating Kubernetes Storage with GlusterApproaches for duplicating Kubernetes Storage with Gluster
Approaches for duplicating Kubernetes Storage with Gluster
 
Dynomite - PerconaLive 2017
Dynomite  - PerconaLive 2017Dynomite  - PerconaLive 2017
Dynomite - PerconaLive 2017
 
Knot.x - reactive web integration platform
Knot.x - reactive web integration platformKnot.x - reactive web integration platform
Knot.x - reactive web integration platform
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Apache Cassandra Lunch #67: Moving Data from Cassandra to Datastax Astra
Apache Cassandra Lunch #67: Moving Data from Cassandra to Datastax AstraApache Cassandra Lunch #67: Moving Data from Cassandra to Datastax Astra
Apache Cassandra Lunch #67: Moving Data from Cassandra to Datastax Astra
 

Similar to Ipc clipboard and data copy

IPC mechanisms in windows
IPC mechanisms in windowsIPC mechanisms in windows
IPC mechanisms in windowsVinoth Raj
 
Windows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingWindows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingOliver Scheer
 
Intercepting Windows Printing by Modifying GDI Subsystem
Intercepting Windows Printing by Modifying GDI SubsystemIntercepting Windows Printing by Modifying GDI Subsystem
Intercepting Windows Printing by Modifying GDI SubsystemPositive Hack Days
 
Intercepting Windows Printing by Modifying GDI Subsystem
Intercepting Windows Printing by Modifying GDI SubsystemIntercepting Windows Printing by Modifying GDI Subsystem
Intercepting Windows Printing by Modifying GDI SubsystemPositive Hack Days
 
Beginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksJinTaek Seo
 
Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Anil Madhavapeddy
 
HadoooIO.ppt
HadoooIO.pptHadoooIO.ppt
HadoooIO.pptSheba41
 
Samsung WebCL Prototype API
Samsung WebCL Prototype APISamsung WebCL Prototype API
Samsung WebCL Prototype APIRyo Jin
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingMax Kleiner
 
Borland star team to tfs simple migration
Borland star team to tfs simple migrationBorland star team to tfs simple migration
Borland star team to tfs simple migrationShreesha Rao
 
Mobile applications using tcp (1)
Mobile applications using tcp (1)Mobile applications using tcp (1)
Mobile applications using tcp (1)Nainita Thakkar
 
PyModESt: A Python Framework for Staging of Geo-referenced Data on the Coll...
PyModESt: A Python Framework for Staging of Geo-referenced Data on the Coll...PyModESt: A Python Framework for Staging of Geo-referenced Data on the Coll...
PyModESt: A Python Framework for Staging of Geo-referenced Data on the Coll...Andreas Schreiber
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limitsDroidcon Berlin
 
.net programming using asp.net to make web project
 .net programming using asp.net to make web project .net programming using asp.net to make web project
.net programming using asp.net to make web projectKedar Kumar
 
Interprocess communication with C++.pdf
Interprocess communication with C++.pdfInterprocess communication with C++.pdf
Interprocess communication with C++.pdfDimitrios Platis
 
Glomosim adding routing protocol
Glomosim   adding routing protocolGlomosim   adding routing protocol
Glomosim adding routing protocolKathirvel Ayyaswamy
 
Hacking Windows IPC
Hacking Windows IPCHacking Windows IPC
Hacking Windows IPCgueste041bc
 

Similar to Ipc clipboard and data copy (20)

IPC mechanisms in windows
IPC mechanisms in windowsIPC mechanisms in windows
IPC mechanisms in windows
 
Windows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async ProgrammingWindows Phone 8 - 3.5 Async Programming
Windows Phone 8 - 3.5 Async Programming
 
Intercepting Windows Printing by Modifying GDI Subsystem
Intercepting Windows Printing by Modifying GDI SubsystemIntercepting Windows Printing by Modifying GDI Subsystem
Intercepting Windows Printing by Modifying GDI Subsystem
 
Intercepting Windows Printing by Modifying GDI Subsystem
Intercepting Windows Printing by Modifying GDI SubsystemIntercepting Windows Printing by Modifying GDI Subsystem
Intercepting Windows Printing by Modifying GDI Subsystem
 
Beginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeks
 
Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)Mirage: ML kernels in the cloud (ML Workshop 2010)
Mirage: ML kernels in the cloud (ML Workshop 2010)
 
HadoooIO.ppt
HadoooIO.pptHadoooIO.ppt
HadoooIO.ppt
 
Samsung WebCL Prototype API
Samsung WebCL Prototype APISamsung WebCL Prototype API
Samsung WebCL Prototype API
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
 
Borland star team to tfs simple migration
Borland star team to tfs simple migrationBorland star team to tfs simple migration
Borland star team to tfs simple migration
 
Mobile applications using tcp (1)
Mobile applications using tcp (1)Mobile applications using tcp (1)
Mobile applications using tcp (1)
 
PyModESt: A Python Framework for Staging of Geo-referenced Data on the Coll...
PyModESt: A Python Framework for Staging of Geo-referenced Data on the Coll...PyModESt: A Python Framework for Staging of Geo-referenced Data on the Coll...
PyModESt: A Python Framework for Staging of Geo-referenced Data on the Coll...
 
CGI.ppt
CGI.pptCGI.ppt
CGI.ppt
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limits
 
.net programming using asp.net to make web project
 .net programming using asp.net to make web project .net programming using asp.net to make web project
.net programming using asp.net to make web project
 
srgoc
srgocsrgoc
srgoc
 
Interprocess communication with C++.pdf
Interprocess communication with C++.pdfInterprocess communication with C++.pdf
Interprocess communication with C++.pdf
 
Open MPI
Open MPIOpen MPI
Open MPI
 
Glomosim adding routing protocol
Glomosim   adding routing protocolGlomosim   adding routing protocol
Glomosim adding routing protocol
 
Hacking Windows IPC
Hacking Windows IPCHacking Windows IPC
Hacking Windows IPC
 

Recently uploaded

How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Recently uploaded (20)

How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

Ipc clipboard and data copy

  • 1. Using Clipboard and Data Copy for IPC in Windows Describes using two simplest techniques of IPC in Windows: Clipboard and Data Copy Compiled By: B. Vinoth Raj Senior Software Engineer Mindfire Solutions
  • 2. IPC using Clipboard  Loosely coupled exchange medium  For data exchange, applications agree on the data format  Data can be shared between processes on same computer or unrelated processes on a network  Windows API functions used are: OpenClipboard(), EmptyClipboard(), SetClipboardData(), CloseClipboard() and GetClipboardData()
  • 3. IPC using Clipboard (cont.)  Before copying data one opens the clipboard using OpenClipboard()  Emtpy the clipboard using EmptyClipboard() to clear existing contents  Set data using SetClipboardData() function in a specified format  Close the clipboard using CloseClipboard() function  Read the data using GetClipboardData() function in another process
  • 4. IPC using Clipboard (cont.)  Before copying data one opens the clipboard using OpenClipboard() CString sData(_T("Sample data")); HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, (sData.GetLength() + 1) * sizeof(WCHAR)); memcpy(GlobalLock(hMem), sData, sData.GetLength() * sizeof(WCHAR)); GlobalUnlock(hMem); OpenClipboard(); EmptyClipboard(); SetClipboardData(CF_UNICODETEXT, hMem); CloseClipboard(); · GlobalAlloc function is used because the system takes ownership of the memory passed to the clipboard
  • 5. IPC using Data Copy  Use WM_COPYDATA windows message to share data  SendMessage() API function used to send data  COPYDATASTRUCT structure used to send data SendMessage(hwnd, // Handle to destination window WM_COPYDATA, // Message to send to destination window (WPARAM)wparam, // Handle to window passing the data (LPARAM)lparam); // Data (pointer to COPYDATASTRUCT)  The data sent is read-only for the receiving application  Works only for processes running on same computer
  • 6. IPC using Data Copy (cont.)  Code Usage CString sMsg(_T("Hello this message is from WM_COPYDATA")); COPYDATASTRUCT data; data.dwData = 1; data.cbData = sMsg.GetLength()*sizeof(WCHAR); data.lpData = &sMsg; HWND destWnd = FindWindow(_T("WinClassName"), _T("WindowName")); SendMessage(destWnd, WM_COPYDATA, (WPARAM)(HWND)hwnd, (LPARAM)(LPVOID)&data); Receiving application should implement the WM_COPYDATA message in its message loop: case WM_COPYDATA: PCOPYDATASTRUCT pcData; pcData = (PCOPYDATASTRUCT) lParam; CString* sRecvMsg = pcData->lpData; break;