From: Rafael M. <so...@gm...> - 2007-12-19 18:57:56
|
Hi Jessica. Can you, for start, list what is on "HARDWARE\\DEVICEMAP\\SERIALCOMM" in your computer? Regards Rafael On 19/12/2007, Jessica Chen <jes...@gm...> wrote: > > Hi, thanks for ur email, Rafael. > > I researched myself. > I wrote a code. I will list it as follows. > The problem seems it can recognize the real serial com port (Com 1 in my > computer, registry). > But on my computer, I have a USB->serial com port (Com 7 in my computer, > registry). > The code cannot recognize the USB->serial com port. > Is there any experienced persons can give any idea about that? > > #include <windows.h> > #include <stdio.h> > #include <tchar.h> > > int main(void) > { > char *strSerialList[256]; > HKEY hKey; > > if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, > TEXT("HARDWARE\\DEVICEMAP\\SERIALCOMM"), > 0, > KEY_READ, > &hKey) != ERROR_SUCCESS) > { > return -1; > } > > int i=0; > CHAR Name[25]; > UCHAR szPortName[25]; > LONG Status; > DWORD dwIndex = 0; > DWORD dwName; > DWORD dwSizeofPortName; > DWORD Type; > dwName = sizeof(Name); > dwSizeofPortName = sizeof(szPortName); > > do > { > Status = RegEnumValue(hKey, dwIndex++, Name, &dwName, NULL, &Type, > szPortName, &dwSizeofPortName); > if((Status == ERROR_SUCCESS) || (Status == ERROR_MORE_DATA)) > { > strSerialList[i] = (char*)(szPortName); > i++; > } > } while((Status == ERROR_SUCCESS) || (Status == ERROR_MORE_DATA)); > RegCloseKey(hKey); > > for(int j=0;j<i;j++) > { > printf("%s\n",strSerialList[j]); > } > > return 0; > } > > > On Dec 19, 2007 12:34 PM, Rafael Menezes <so...@gm...> wrote: > > > You can send mails. Can you search on google? > > > > http://www.google.com.br/search?hl=pt-BR&q=c%2B%2B+com+port&meta= > > > > > > http://www.google.com.br/search?num=30&hl=pt-BR&q=c%2B%2B+serial+port&meta > > = > > > > > > On 19/12/2007, Jessica Chen <jes...@gm...> wrote: > > > > > is there anyone have the experience for writing code of getting the > > > serial port info from windows? > > > can u give me an sample code? > > > > > > > > > > > > ------------------------------------------------------------------------- > > > SF.Net email is sponsored by: > > > Check out the new SourceForge.net Marketplace. > > > It's the best place to buy or sell services > > > for just about anything Open Source. > > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > > > > > > _______________________________________________ > > > Dev-cpp-users mailing list > > > Dev...@li... > > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > > > > > > > > > > -- > > Regards > > Rafael Menezes > > > -- Regards Rafael Menezes |