06-21-2006 04:54 PM
06-22-2006 02:26 PM - edited 06-22-2006 02:26 PM
Message Edited by mvr on 06-22-2006 02:27 PM
06-22-2006 05:46 PM
Hello,
I apologize that this isn’t working out for you. I am unfamiliar with “OGL” and couldn’t find those functions in the CVI libraries I have open… In either case, would it be possible for you to attach a small snippet of code which reproduces the problem? I could be a problem with CVI in which case we’ll need to find a workaround for you. What version of CVI are you using? I want to say I’ve seen a similar issue with CVI 7.1 and the plots appeared when we resized the image received from the function call.
Please let me know how I can help!
06-23-2006 03:19 AM
To help Ian in his problem I asked me if I can simulate the Print Screen key. Unfortunately it seems this key is not available with ordinary FakeKeystroke function, so I had to run into Windows API to find a solution.
The result of my attempts are as follows: basically it is necessary to create the correct queue of keyboard events to send to SendInput funcion (specifically Alt and PrintScreen keys).
#define _WIN32_WINNT 0x0401
#include "windows.h"
int line = 0;
char msg[512];
DWORD written, error = 0;
INPUT *lpI = NULL;
// Function for copying the panel to clipboard
//UINT SendInput (
// UINT nInputs, // count of input events
// LPINPUT pInputs, // array of input events
// int cbSize // size of structure
//);
lpI = calloc (2, sizeof (INPUT));
lpI[0].type = INPUT_KEYBOARD;
lpI[0].ki.wVk = VK_MENU;
lpI[1].type = INPUT_KEYBOARD;
lpI[1].ki.wVk = VK_SNAPSHOT;
if (!SendInput (2, lpI, sizeof (INPUT))) {
error = GetLastError (); line = __LINE__;
goto Error;
}
//----
Error:
if (error) {
//DWORD FormatMessage (
// DWORD dwFlags, // source and processing options
// LPCVOID lpSource, // message source
// DWORD dwMessageId, // message identifier
// DWORD dwLanguageId, // language identifier
// LPTSTR lpBuffer, // message buffer
// DWORD nSize, // maximum size of message buffer
// va_list *Arguments // array of message inserts
//);
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, msg, 511, NULL);
sprintf (msg, "%s\nRow %d", msg, line);
MessagePopup ("Error", msg);
}
The only problem is that the INPUT structure required by SendInput function is defined in winuser.h only after an #if (_WIN32_WINNT > 0x0400) statement, that's why I added this statement at the very beginning of my code: nevertheless there is no warning on this fact in the SDK. I tried modifying the simple.prj sample in samples\userint\custstrl\cviogl adding a button with the code I exposed here and found no problem in it, but remains a *big* question mark on that #define I had to add to the project: will it affect other functions in the software in an unpredictable way? I cannot answer this question maybe someone else can...
06-26-2006 09:18 AM