Ron
October 13th, 2002, 12:55 PM
Nice !!
try the "code" ubb tag for formatting code :smile:
-Ron
Mark F
October 13th, 2002, 12:55 PM
I know there are many serial based plugins for Girder. Many have hardcoded the number and names of the devices they support. Others allow any name to be entered into an edit field or whatever. I came across a snipette of code that allows you to fill a dropdown list box with the names of ONLY the devices available on the current system and wanted to share it with the population, at large. It uses MFC but could be adapted to use Win32 calls pretty easily. Enjoy.
void FillDeviceListFromRegistry(CComboBox& List)
{
// empty the list
List.ResetContent();
// open the key for serial devices
CRegKey RegKey;
if (RegKey.Create(HKEY_LOCAL_MACHINE,CString("HARDWAREDEVICEMAPSERIALCOMM")) == ERROR_SUCCESS)
{
int index = 0;
char ValueName[REGBUFFSIZE];
unsigned long szValueName;
unsigned char Data[REGBUFFSIZE];
unsigned long szData;
szValueName = REGBUFFSIZE;
szData = REGBUFFSIZE;
// add each device name to the list
while (RegEnumValue(RegKey.m_hKey,index,&ValueName[0],&szValueName,NULL,NULL,&Data[0],&szData) == ERROR_SUCCESS)
{
List.AddString((LPCTSTR)CString(Data));
index++;
szValueName = REGBUFFSIZE;
szData = REGBUFFSIZE;
}
}
}
EDIT: Thanks, Ron.:smile:
_________________
Mark F
<font size=-1>[ This Message was edited by: Mark F on 2001-05-26 00:01 ]</font>
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.