|
Hi,
I want to browse the list of port name to find the port com number of my serial gadget.
I found examples in DDK, but i want simple code to be integrated in my Visual C++ application.
Regards.
|
|
|
|
|
This should do the trick.
CString strPortName, strDesc;
CStringList slPorts;
unsigned long lNeeded = 0;
unsigned long lReturn = 0;
PORT_INFO_2* piPorts = NULL;
EnumPorts (NULL, 2, NULL, NULL, &lNeeded, &lReturn);
if (lNeeded > 0 && GetLastError () == ERROR_INSUFFICIENT_BUFFER)
{
piPorts = new PORT_INFO_2[1 + (lNeeded / 20)];
if (EnumPorts (NULL, 2, (BYTE*)piPorts, lNeeded, &lNeeded, &lReturn) != 0)
{
for (unsigned long nPort = 0; nPort < lReturn; nPort++)
{
strPortName = (char*) piPorts[nPort].pPortName;
strDesc = (char*) piPorts[nPort].pDescription;
strPortName.MakeUpper ();
strDesc.MakeUpper ();
if (strPortName.Left (3) == _T("COM") || strDesc == _T("COMMUNICATIONS PORT"))
slPorts.AddTail (strPortName);
}
}
delete [] piPorts;
}
codito ergo sum
|
|
|
|
|
Thanks for your answer.
I tested the code but the result is :
PortName = "COM16:"
MonitorName = "Moniteur Local"
Description = "Port Local"
But information that i want is like the Device Mange in panel control
Ports (COM & LPT)
--> "Gadget Serial" (COM16)
I want to trigge with Gadget Serial
Best Regards.
|
|
|
|
|
hi all i want to write the values inot database through ADO through Command variable but it gives error when i pass same values through stored procedure it works fine,here is the code
m_cptr->CommandText=(_bstr_t)"Insert into tbltemp(v1,v2,v3)values(@UserIp,@Pic,@WTime");<br />
m_cptr->Parameters->Append(m_cptr->CreateParameter(_bstr_t("@UserIp"),adVarChar,adParamInput,strIp.GetLength(),_bstr_t(strIp)));<br />
m_cptr->Parameters->Append(m_cptr->CreateParameter(_bstr_t("@Pic"),adLongVarBinary,adParamInput,obj.GetLength(),bpic));<br />
m_cptr->Parameters->Append(m_cptr->CreateParameter(_bstr_t("@WTime"),adVarChar,adParamInput,strTime.GetLength(),_bstr_t(strTime)));<br />
m_cptr->Execute(NULL,NULL,adCmdText);
but when execute method is throws exception called it gives error @UserIp
undeclared identifier
i tried to insert simple con.execute query method without command but it does not type cast teh bpic which contain image data and not insert in databse.
tell me how to do that.
Tasleem Arif
|
|
|
|
|
can antbody help me.how to make oledb connection?
from where to start?
i am new to database in vc
|
|
|
|
|
|
Thanks
modified 28-Sep-16 7:30am.
|
|
|
|
|
How many times in one day do you need to ask the same question in every forum posible?
2:56 16 Oct '06
CDO tool needed!!! - oliver_mak
Visual Basic / VB.NET (Programming Forums)
2:56 16 Oct '06
CDO tool needed!!! - oliver_mak
Web Development (Programming Forums)
2:56 16 Oct '06
CDO tool needed!!! - oliver_mak
C# (Programming Forums)
2:56 16 Oct '06
CDO tool needed!!! - oliver_mak
Collaboration / Testing (Programming Forums)
2:55 16 Oct '06
CDO tool needed!!! - oliver_mak
ASP.NET (Programming Forums)
2:54 16 Oct '06
CDO tool needed!!! - oliver_mak
Visual C++ / MFC (Programming Forums)
Maybe its just me, but I have no idea what your asking for.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Wow you have a report
|
|
|
|
|
I have been perusing through the message boards and noticed the same inane question repeated several times. Just went in to his recent messages to get that info, copied and pasted.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
|
Message Closed
modified 28-Sep-16 7:23am.
|
|
|
|
|
|
|
Use dependency walker, to see if all exported functions you can see in exported functions list. I know this is not going to help, but this is just to check whether everything is alright while exporting.
|
|
|
|
|
Well thanx for the reply Prasad.
I use dependency walker alot and if I could paste a pic here you would see that all the functions are displaying and looks correct.
I'm not using a class with all these functions, would there be like a limit on the amount of functions one can export. (Which I don't think would be the case) ??
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Quick google search suggest, problem occurs when newer version is required( function called is not present in dll).
Can you show how you called this function.
|
|
|
|
|
Ok, this is what I did in my test application (who's calling the dll).
Included the header file.
Under properties -> link added the .lib file.
Copied the .dll file to the root folder of the application.
<code>
bool retcode = fasle;
char* proc_name = "c:\\program files\\winamp\\winamp.exe";
retcode = createAProcess(proc_name);
if (retcode)
{
....
</code>
After all of this I receive the error mentioned earlier.
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
If this might help, I did a dumpbin /exports on the dll and the result is shown below:
File Type: DLL
Section contains the following exports for ElkoUtility32.dll
00000000 characteristics
45334FDA time date stamp Mon Oct 16 11:24:42 2006
0.00 version
1 ordinal base
34 number of functions
34 number of names
ordinal hint RVA name
14 0 00001740 CharacterAt
1 1 00001000 DllMain
15 2 00001750 authentication
32 3 00002920 changeIcon
16 4 00001950 controlPanelDlg
34 5 00002AD0 createAProcess
8 6 000013F0 createDSN
28 7 00002020 createMTPipeSrv
29 8 000021F0 createOLPipeSrv
22 9 00001C80 decryptAFile
21 A 00001C60 encryptAFile
33 B 00002A40 errorExit
5 C 00001210 error_out
12 D 00001590 fileHandler
20 E 00001C40 getWindowProcessId
25 F 00001D90 makeSlot
23 10 00001CA0 messageBeeper
24 11 00001D30 netValidate
27 12 00001E80 readSlot
30 13 000026A0 regEntry
31 14 00002860 regStartUp
18 15 00001B00 restartWindows
11 16 00001530 restoreWnd
10 17 00001430 seekProgram
9 18 00001410 showProgramVersion
19 19 00001B80 shutdown
2 1A 00001050 sqlconn
4 1B 000011D0 sqldisconn
7 1C 00001010 sqldsn
3 1D 000010E0 sqlexec
6 1E 00001290 sqltest
13 1F 000015F0 userNameSize
17 20 00001A00 validUserName
26 21 00001DE0 writeSlot
Summary
8D000 .data
2000 .rdata
2000 .reloc
1000 .rsrc
A000 .text
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
It looks ok.
I feel , you are missing something very simple. Just last try, make sure, you rebuild you dll with added functions. make sure you copy updated .lib and .dll in correct folder.
|
|
|
|
|
Thank you for the help Prasad, someone else gave me the same answer on the MSDN forum and I got it working.
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
cheers !
|
|
|
|
|
hi,
Since i am new to vc++ i want to know the entire procedures for using a tab control and progress bar in a dialog box.Starting from the initiallizing state till the working of progress bar and tab control using activex control in MFC.
I saw MSDN for reference but i dont know how to proceed with it.
Plz help me out,its v.urgent
Thanx in Advance,
zari
|
|
|
|
|
|
In a MFC active x control application , I have created a dialog box and placed a tab control in that now how to proceed???????????
zari
|
|
|
|