|
You can detect all installed com ports by looking in the registry under HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM"
Forever Developing
|
|
|
|
|
Not sure if this will help but if you look in the registry
HKLM\SYSTEM\CurrentControlSet\Services\Serial\Enum
Gives a list of serial devices and a count!?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I think I've found another key that may help me:
HKEY_LOCAL_MACHINE\Hardware\deviceMap\SerialCOMM
and there is a list of (I think) all the serial port of my machine (virtual or not). Do you think this is a valid key (present on all computers) ?
Know, I want to retrieve the names (COM1, COM3, ...) but I don't know how to do this ? I can retrieve the number of 'values' but how can I retrive their values (I don't know the names of these keys...)
Any idea ?
Thanks
|
|
|
|
|
You can enumerate the registry by using
RegEnumValue
Check you local MSDN help files for more info
Forever Developing
|
|
|
|
|
Ok thanks, I will take a look.
This is the first time I use the registry so if you can point me to an article or something that describes how to use it correctly that would be nice
(In the MSDN, there is no doc about that, just the different functions and what they do )
|
|
|
|
|
Here is a code project artical on the subject
http://www.codeproject.com/useritems/serial_portsenum_fifo.asp
Forever Developing
|
|
|
|
|
Yup, they are available on Win2003, XP and W2K at least.
It appears that the names of the keys will be \Device\Serial<n>
where <n> is a number from 0 upwards! If you read the number of devices from the Enum of the serial section (as i described above) then you could loop round reading the device map names as you have found (altering <n> for each iteration of the loop).
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hi Friends,
What is the difference between global variable & static global variable?
Consider C and C++ .
VikramS
|
|
|
|
|
vikrams wrote:
What is the difference between global variable & static global variable?
I never knew there was one...or that anyone would use the static modifier on a global variable.
How do I print my voice mail?
|
|
|
|
|
hm.. as I remember, if you use static on a global variable, it is only visible in this single cpp file for the linker.
|
|
|
|
|
Hello Vikrams,
A global variable and a static global variable are both global variables. That is, they are not defined in the context of any C++ class. Examples :
int g_int = 0;
static int g_static_int = 0;
The difference between a global variable and a static global variable is that the global variable can be accessed in any CPP file while the static global variable can only be accessed within the CPP file in which it is defined.
Example :
source1.cpp :
int g_int = 0;
static int g_static_int = 0;
void func1()
{
...
g_int = 20; // OK !
...
}
void func2()
{
...
g_static_int = 35; // OK !
...
}
source2.cpp :
extern int g_int;
extern int g_static_int;
void func3()
{
...
g_int = 81; // OK !
...
}
void func4()
{
...
g_static_int = 19; // Not OK ! You will get a linking error.
...
}
-Bio.
|
|
|
|
|
Well.. I got it. Thanx a lot.
VikramS
|
|
|
|
|
hi,
I m using DirectSfow to Priview Video .
and in hardware i m using Tv Tunner Card.
wt are the Video streaming rates/ frequencies .
does these are of DirectShow then wt they are , and how can i change.
does it depends on TV Tunnver Card setting
thanx
Regards.
|
|
|
|
|
Query the output pin on the source filter you're using, to find out what media type it is using.
It's all in the DirectShow documentation.
Jon
#include <beer.h>
|
|
|
|
|
Hi All,
What I am trying to do is, when a button is pressed in my application, it opens a browser that looks very similiar to the Windows XP F11 Theatre view except that it has the menu and the status bar would be down the bottom.
To this end I thought I would a IWebBrowser2 object, find the applicable toolbars in the rebar control and move them to where I want them to go.
Here is what I have so far:
HRESULT hr = CoCreateInstance(CLSID_InternetExplorer,
NULL,
CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2,
(void**)&m_pWebBrowser2);
hr = m_pWebBrowser2->QueryInterface(IID_IWebBrowserApp,(void**)&m_pIEApp);
long hIE;
// get a window handle so we can resize and show the browser window.
hr = m_pWebBrowser2->get_HWND(&hIE);
hr = m_pWebBrowser2->put_AddressBar(true);
hr = m_pWebBrowser2->put_StatusBar(true);
hr = m_pWebBrowser2->put_MenuBar(true);
hr = m_pWebBrowser2->put_ToolBar(true);
// use CWnd to make showing the window etc easy
m_wndWebBrowser.Attach((HWND)hIE);
m_wndWebBrowser.ShowWindow(SW_SHOWMAXIMIZED);
//REBAR CONTROL
//Find Rebar Control
CWnd* workerWnd;
CWnd* rebarWnd;
bool foundPersonalBar = false;
long childcount = 0;
UINT searchState = GW_CHILD;
while(!foundPersonalBar)
{
workerWnd = m_wndWebBrowser.GetWindow(searchState);
searchState = GW_HWNDNEXT;
childcount = workerWnd->GetWindowedChildCount();
if(childcount != 1)
continue;
rebarWnd = workerWnd->GetTopWindow();
if(!rebarWnd)
continue;
childcount = rebarWnd->GetWindowedChildCount();
if(childcount <= 3)
continue;
foundPersonalBar = true;
}
At this point rebarWnd is the rebar that I need (ie. the parent to the toolbar, menubar, etc) but I am not sure where to go from here.
The problems I am finding are:
- I cannot determine which of the child toolbars is the address bar, which is the menu bar, etc, etc
- How to move them
This will probably be a very easy thing to do but I am fairly inexperienced in this kind of programming.
Any help would be appreciated.
|
|
|
|
|
I have a program with multiple doc/view in order to read STL files. If I just open the file and then close the file again and again, I can’t open any window finally, even opening a pop-up menu in another process is unavailable. I think that there must be a resource leakage, but I don’t know how to detect a resource leakage. Thanks for your help!
|
|
|
|
|
If you are using the CRT, you can enable CRT leak detection and then dump a report on exit. It will then list all your leaks.
A better solution is to use some type of leak detection software, but the generally cost money.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks for your help. I will try it.
|
|
|
|
|
Hi all,
I am trying to compile a sample project. However, I got this messages:
d:\C++ EXAMPLE\Chart2_src\CodeGuru\GuiLib\ChartDll\DataSeries.cpp(865): error C2668: 'atan' : ambiguous call to overloaded function
I cannot find atan() function used in the code, what's happened? Did anyone face similar problem before? The following is the source which caused this error...
<br />
<br />
<br />
void CDataSeriesArray::DrawData(CMemDC* pDC, C2DScale* pScale) {<br />
<br />
m_pDC = pDC;<br />
m_pScale = pScale;<br />
<br />
<big> int nY = (int)(m_pScale->m_yDepth*sin(D2R(m_pScale->m_dVertRotation)));<br />
int nX = (int)(m_pScale->m_yDepth*sin(D2R(m_pScale->m_dHorzRotation)));</big><br />
<br />
blah...<br />
blah...<br />
blah...<br />
Any help is appreciated!
Help! I need somebody help!
Would you please help me?
|
|
|
|
|
What is the definition of D2R() ?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Heh, it better be defined as
((x)*PI)/180
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I agree, but that's the only thing I can think of that would cause his problem with atan()...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
While it is assumed that D2R is "degree to radian," it is also likely that D2R includes the use of PI, which can be defined as 4.0 * atan (1.0). In that case, you could get an error involving atan. I assume you have #include math.h?
You could also just assign PI a value of 3.14159 etc, depending upon the accuracy you need, if it is indeed used in D2R.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hello,
I am having problems creating queues and I would like code, non-MFC, but pure C++ that allows a user to insert data into a queue and then display it all when they are done. Just a simple command line program. I know to use classes.
Thank you for reading.
-Ryan M.
|
|
|
|
|
Why don't you have a look at the STL queue class? Sure beats writing your own
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|