Difference between revisions of "Start VNC server (Sample)"
(Created page with "{| class="wikitable" style="float:right; margin-left: 10px; background-color: #f9f9f9;" ! colspan="2" style="font-weight:bold; font-size:17px; font-family:Arial, Helvetica, sa...") |
|||
Line 2: | Line 2: | ||
! colspan="2" style="font-weight:bold; font-size:17px; font-family:Arial, Helvetica, sans-serif !important;; background-color:#ceceff;" | GUI_VNC_StartServer.c |
! colspan="2" style="font-weight:bold; font-size:17px; font-family:Arial, Helvetica, sans-serif !important;; background-color:#ceceff;" | GUI_VNC_StartServer.c |
||
|- |
|- |
||
− | | colspan="2" | [[File:GUI VNC StartServer.gif | |
+ | | colspan="2" | [[File:GUI VNC StartServer.gif | frame ]] |
|- |
|- |
||
| style="font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;" | File(s) required |
| style="font-weight:bold; font-size:12px; font-family:Arial, Helvetica, sans-serif !important;;" | File(s) required |
Latest revision as of 17:46, 21 April 2020
GUI_VNC_StartServer.c | |
---|---|
File(s) required |
|
Runs in simulation | Yes |
Runs on target | Yes |
Download | GUI_VNC_StartServer.c |
This sample shows how to start a VNC server using emWin.
Code
/*********************************************************************
* SEGGER Microcontroller GmbH *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2020 SEGGER Microcontroller GmbH *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V6.10 - Graphical user interface for embedded applications **
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with a license and should not be re-
distributed in any way. We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : GUI_VNC_StartServer.c
Purpose : Sample that demonstrates how a emWin VNC server can be
started.
Requirements: WindowManager - ( )
MemoryDevices - ( )
AntiAliasing - ( )
VNC-Server - (x)
PNG-Library - ( )
TrueTypeFonts - ( )
---------------------------END-OF-HEADER------------------------------
*/
#include "DIALOG.h"
#include "GUI_VNC.h"
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define TEXT "emWin VNC Sample"
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
static void _cbWin(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int Id, NCode;
char acBuffer[32];
switch(pMsg->MsgId) {
case WM_CREATE:
//
// Create a few widgets.
//
hItem = EDIT_CreateEx(10, 40, 80, 20, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_EDIT0, 20);
hItem = TEXT_CreateEx(10, 10, 150, 20, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_TEXT0, TEXT);
TEXT_SetFont(hItem, &GUI_Font16B_1);
hItem = BUTTON_CreateEx(100, 40, 80, 20, pMsg->hWin, WM_CF_SHOW, 0, GUI_ID_BUTTON0);
BUTTON_SetText(hItem, "Set Text");
break;
case WM_PAINT:
GUI_SetBkColor(GUI_WHITE);
GUI_Clear();
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id) {
case GUI_ID_BUTTON0:
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_EDIT0);
EDIT_GetText(hItem, acBuffer, sizeof(acBuffer));
hItem = WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0);
TEXT_SetText(hItem, acBuffer);
break;
}
break;
}
break;
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void MainTask(void) {
//
// Init emWin.
//
GUI_Init();
//
// Create a window.
//
WM_CreateWindowAsChild(0, 0, LCD_GetXSize(), LCD_GetYSize(), WM_HBKWIN, WM_CF_SHOW, _cbWin, 0);
//
// Start VNC server.
// Now, connect to the server with emVNC.exe and enter the IP of your target.
// In case you are running this sample in the simulation, enter the IP of your computer.
//
GUI_VNC_X_StartServer(0, 0);
while (1) {
GUI_Delay(100);
}
}
/*************************** End of file ****************************/