Hi all, I would like to convert this C file into .lua so I can make a YAC listener in AMS
can anyone please help?
H file
C fileCode://{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by YACTextSend.rc // #define IDI_APP 101 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 102 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
Code:/* YAC: Yet Another Caller ID Program - YAC Text Send Sample Program * Copyright (C) 2002 Jensen Harris (jensen@sunflowerhead.com) * http://www.sunflowerhead.com * * YAC is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any * later version. * * YAC is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with YAC; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * File: YACTextSend.c * Version: 1.0 * Last Modified: 11 September 2002 * * COMMENTS * This program illustrates how you can communicate with YAC from your own * code. Although the sample program below is in C, it could have just as * easily been in Visual Basic, Delphi, or even C#. * * In order to send text through YAC, the YAC server must be running on * your computer. The steps necessary to communicate with YAC are: * * 1) Find the YAC message window. This window has the class name * "YACMainWindow". If this window is not present, then YAC is not * running. * * 2) Fill out a COPYDATASTRUCT structure with your string (max 300 chars) * and the number of bytes. * * 3) Send YAC a WM_COPYDATA message with a pointer to your COPYDATASTRUCT * struct as lparam. YAC handles this message and will format, display, * and broadcast your message to all listeners. * */ #include <windows.h> #define MAX_CHARS 300 int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { HWND hwnd; COPYDATASTRUCT cds; TCHAR szText[MAX_CHARS]; ZeroMemory(szText, sizeof(szText)); ZeroMemory(&cds, sizeof(cds)); // Find the YAC hidden window to send the message to hwnd = FindWindow("YACMainWindow", NULL); // If we didn't get a window handle back, YAC must not be running. if (!hwnd) return -1; // Grab the text from the command line strncpy(szText, lpCmdLine, MAX_CHARS - 1); // Fill out the COPYDATASTRUCT structure to pass to YAC cds.cbData = (DWORD)(strlen(szText) * sizeof(TCHAR)); cds.lpData = (void *)szText; // Send the packed message to YAC SendMessage(hwnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cds); return 0; }

