cdc

MFC中CDC的使用 绘图(三)

时光总嘲笑我的痴心妄想 提交于 2020-01-01 01:31:58
5.清屏 Windows没有提供专门的清屏函数,可以调用CWnd的下面两个函数调用来完成该功能: void Invalidate(BOOL bErase = TRUE); void UpdateWindow( ); 或调用CWnd的函数 BOOL RedrawWindow( LPCRECT lpRectUpdate = NULL, CRgn* prgnUpdate = NULL, UINT flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE ); 来完成。 例如(菜单项ID_CLEAR的事件处理函数): CDrawView::OnClear() { // 调用OnDraw来清屏 //Invalidate(); //UpdateWindow( ); RedrawWindow( ); } 也可以用画填充背景色矩形的方法来清屏,如: RECT rect; GetClientRect(&rect); pDC->FillSolidRect(&rect, RGB(255, 255, 255)); 6.在控件上绘图 可以在对话框资源中放置图片控件,并对其类型属性选Frame。可在对话框的绘图消息响应函数OnPaint或其他函数中,用CWnd类的函数GetDlgItem: CWnd* GetDlgItem( int nID ) const;

绘图、GDI、颜色及字体

旧街凉风 提交于 2020-01-01 01:28:51
1,任何时候当程序需要直接在屏幕或打印机上绘图的时候,都需要调用GDI函数,GDI函数包含了一些用于绘制图形、位图以及文本的函数。 2,Windows的设备环境是GDI的关键元素,它代表了物理设备。每一个C++设备环境对象都有与之对应的Windows设备环境, 并且通过一个32位类型的HDC句柄来标识。 3,MFC库设备环境类基类CDC包含了绘图所需要的所有成员函数,并且几乎所有派生类只有构造函数和析构函数不同(CMetaFileDC类除外)。 对于显示器来说,常用的派生类有CClientDC 和 CWindowDC,而对其它设备(如打印机或内存缓冲区),则可以构造一个基类CDC的对象。 对于显示器和打印机设备环境对象来说,应用程序框架会直接将句柄附在对象上;而对其它设备环境(如内存设备环境), 为了将对象与句柄相联系,在构造完对象之后,还必须调用一个成员函数(进行初试化)。 4,CClientDC类 和 CWindowDC类 如果构造CClientDC对象,则设备环境的映射区域限于客户区域,不能在客户区域外绘图。原点(0,0)在客户区左上角。 如果创建CWindowDC对象,则设备环境的映射区域为整个窗口(包括标题栏、状态栏、窗口边框等)。原点(0,0)在整个窗口的左上角。 注意: 1)视图窗口没有非客户区域. 2)视图窗口覆盖在框架窗口之上。 3)在《》中的内容

GDI 总结三: CImage类使用

我只是一个虾纸丫 提交于 2020-01-01 01:23:53
前言 CImage类是基于GDI+的。可是这里为什么要讲归于GDI? 主要是基于这种考虑: 在GDI+环境中,我们能够直接使用GDI+ ,没多少必要再使用CImage类 可是,假设再GDI环境中,我们要想使用GDI+,有点麻烦。还得增加头文件。增加启动GDI+的代码和关闭GDI+的代码,显得太罗嗦了。GDI 的CBitmap 处理功能又有局限,仅仅能处理BMP格式的图片。 怎么办?这时。我们便可使用CImage类,由于这个类本身封装了GDI+得使用环境,所以无需我们手动设置,简化了我们的操作。 同一时候。又能够利用GDI+中强大的图片处理功能,及能够简便的与CBitmap对象进行转换 ,大慷慨便了在GDI环境下。进行各种图片处理工作 。 事实上,将其称作 GDI/ GDI+ 混合编程,这样才更确切些。 为什么引入CImage类? CBitmap 类仅仅能处理BMP格式的图片,很受限。 而CImage能够处理JPGE GIF BMP PNG多种格式图片,扩展了图片处理功能 且能与CBitmap 进行转换( 由于所加载的位图句柄都是HBITMAP,所以可相互转换),因此引入CImage类进行图像处理 CImage provides enhanced bitmap support, including the ability to load and save images in JPEG

RT-Thread USB虚拟串口收发调试

我与影子孤独终老i 提交于 2019-12-24 01:11:19
学习过程中参考博文: 记录——基于 RT-Thread 实现 USB 虚拟串口 但是遇到了两个问题: 1.串口有设备,但是不能发送; 2.串口能发送但不能接收; 第一个问题,是因为rtt的usb虚拟串口默认启用了RTS和DTR(终端准备好接收): static rt_err_t _interface_handler ( ufunction_t func , ureq_t setup ) { struct vcom * data ; RT_ASSERT ( func != RT_NULL ) ; RT_ASSERT ( func -> device != RT_NULL ) ; RT_ASSERT ( setup != RT_NULL ) ; data = ( struct vcom * ) func -> user_data ; switch ( setup -> bRequest ) { case CDC_SEND_ENCAPSULATED_COMMAND : break ; case CDC_GET_ENCAPSULATED_RESPONSE : break ; case CDC_SET_COMM_FEATURE : break ; case CDC_GET_COMM_FEATURE : break ; case CDC_CLEAR_COMM_FEATURE : break ;

file:/// to http:// communication via IFrame

六眼飞鱼酱① 提交于 2019-12-22 08:57:54
问题 Maybe some of you could have ran into the same problem i did. Imagine you have a file on your machine: file:///c:\test.html And you have an IFrame inside of this file. You need to indicate whether the IFrame contents are loaded or no. Bacically, what we have here: 1. location, href, or any other property is inaccessible from file:/// to http:///, or backwards. 2. you can't fire event from the browser window in iframe, or in opposite direction, unfortunately. Does this problem have a solution?

SQL Server 2008 Change Data Capture, who made the change?

ⅰ亾dé卋堺 提交于 2019-12-22 04:09:13
问题 I asked a question on SOF a week or so ago about auditing SQL data changes. The usual stuff about using triggers came up, there was also the mention of CDC in SQL Server 2008. I've been trying it out today and so far so good, the one thing I can't see it supports is keeping a track of who actually made the change. Who executed the statement? I'm interested to know if anyone has used CDC for auditing and how you kept track of who made the change? 回答1: I altered the CDC table directly using:

cdc_acm : failed to set dtr/rts - can not communicate with usb cdc device

↘锁芯ラ 提交于 2019-12-21 04:49:11
问题 I was trying to enumerate usb cdc device using pic24fj128gb206. Device seems to be enumerated properly. But when I connect my device to Linux PC, I am getting the below warning message from kernel. cdc_acm 1-8.1.6.7:1.0: failed to set dtr/rts And this message will repeat when I try to connect using screen. screen /dev/ttyACM9 115200 And I am not able to communicate with my device from PC [ Ubuntu, 14.04 ] When analysing the data using wireshark, it looks like USB communication is fine until,

How to list all attached USB devices in Visual C++

久未见 提交于 2019-12-18 17:33:32
问题 In Short: I need to detect hotplug events of my USB CDC device by PID/VID and get the corresponding virtual COM port which was created by Windows in Visual C++ and in the end create a dll. I have a USB CDC device which I need to be notified of when connected/disconnected on Windows. My approach is to use RegisterDeviceNotification and an "invisible" Window to receive WM_DEVICECHANGE notifications. This part is working so far. Now as far as I found out I need to get the list of USB devices

Android USB host read from device

萝らか妹 提交于 2019-12-18 10:08:51
问题 I'm trying to get some data out of a USB device connected to my Android phone that is on host mode. I'm able to send data to it, but reading fails. I've looked at several examples and tried all I could but I don't have any experience in USB communication, although by now I know a little, and I've been stuck on this longer that I care to admit. I'm not very familiar with the endpoint configuration, but I know is that my device uses a CDC type communication method and both the output (from

How to implement Change Data Capture (CDC) using apache spark and kafka?

倾然丶 夕夏残阳落幕 提交于 2019-12-13 08:59:38
问题 I am using spark-sql-2.4.1v with java 1.8. and kafka versions spark-sql-kafka-0-10_2.11_2.4.3 and kafka-clients_0.10.0.0. I need to join streaming data with meta-data which is stored in RDS. but RDS meta data could be added/changed. If I read and load RDS table data in application , it would be stale for joining with streaming data. I understood ,need to use Change Data Capture (CDC). How can I implement Change Data Capture (CDC) in my scenario? any clues or sample way to implement Change