|
Does anyone know how to write code in vc++ to detect the number of com port in the system?
|
|
|
|
|
Maybe you can try writing a code to access the registry, and try enumerating the COMM ports from there.
go to: \HKEY_LOCAL_MACHINE\HARDWARE\SERIALCOMM
Try enumerating the COMM ports by searching the keys: "\Device\SerialX" (where X is a number from 0 to n).
|
|
|
|
|
Correction! Its \HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM
|
|
|
|
|
Hi there
Actually all com ports on your system have aregistry in System registry,by there name like COM1 , COM2 etc ,
so u have to just enumerate the registry using registry realted API's
like RegOpenKey
its entry is in HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\MultifunctionAdapter\5\SerialController this key path
what u can do make a string "COM" + integer 1 , 2 , 3
search this string using Registry API 's
when it matches that means that com port is present in ur system
Abhishek Srivastava
Software Engg (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
I want to skip a column in listview control but I can't. Can you help me.
Regard.
|
|
|
|
|
What do you mean by 'skip a column'?
|
|
|
|
|
I want to hide a column in a listview control.
|
|
|
|
|
Hi!
I have a problem. I'm joining a multicast group and recieves IP-streams in mpeg-2 format.I will save the streams to a buffer and compare the sequence number and see if there are some packets lost. If there is a packet loss I will save the buffer to a file.
I'm not sure, but I think I have to convert(?) mpeg-2 streams so I can watch the packets?
How do I compare sequence number? and if I have to convert, how?
Thanksful for your help,
|
|
|
|
|
Hi all,
Currently i am doing project for desinging graphics application with the help of GDI objects using MFC. In this application i use two tools like Unfilled rectangle and filled rectangle with different line stlyes. While selecting the unfilled rectangle, the rectangle will be drawn with current brush object. But i need to draw the rectangle with transparent brush. How can i do it. I can acheive it through the Draw3dRect function, but it doesn't support the differnt line stlyes. So please help me to solve this problem.
Prakash
|
|
|
|
|
You may be able to use the GetStockObject(HOLLOW_BRUSH) and select that into the DC to give internal transparent drawing.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hi,
My urgent requirement is to implement Stacked Dialog using ATL/VC++6.0 windowing classes. The implementation is similar to MFC's whcih is provided in the Codeguru site. Can any body tell me how to implement it? Sample code would be greatly helpful.
Thanks,
Sai.
Help Ever, Hurt Never
|
|
|
|
|
Are you using _beginthreadex to start the threads? Both functions store the last pseudorandom number in a per-thread data structure for all the CRT. If this structure hasn't been allocated, the first call the rand()/srand() allocates it. However, if you didn't use _beginthreadex, this pointer never gets freed.
So, if you ever use the CRT in a thread, use _beginthreadex. (If you ever use MFC in a thread, use AfxBeginThread().)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Is there any way to change id's in string table?
Thanks in advance.
Shin
|
|
|
|
|
Both VC 6.0 and 7.1 allow you to change the mnemonic (the IDS_... value) within the string table editor, and VC 7.1 also allows you to change the number that it is mapped to within the editor. I think for VC 6.0 you need to change the number within the resource.h file if you want to change the mapper resource number.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thanks.
I guess I have to change it one by one.
Regards,
shin
|
|
|
|
|
|
Does anyone have any ideas / sample code on how to upload a file using wininet from a C++ client application to a java servlet for processing.
|
|
|
|
|
You need to do a HTTP POST of your data to the servlet. This MSDN page[^] on wininet should provide pointers on how to begin with posting.
|
|
|
|
|
That is exactly what I want to do. What I don't understand is how to make the file part of the request object. I think I need to create a handle to the local file, read it into a buffer, then use the InternetWriteFile function to write the buffer to the Http request object. Is that right? Do you know of any code samples that would make this process clearer?
|
|
|
|
|
Hi,
I have a problem which I don't fully understand... I have main View class which creates a non-modal Property sheet containing 2 property pages (this works as a tabbed property window). All this works fine.
However, I need to call some public member functions in the parent View class from within the Property Pages (eg when the user adjusts a setting in the tabbed property palette, the changes are reflected in the main view). The minute I add the include for the View class header in the Property Page class, I can't compile; I guess it creates some sort of infinite loop (the definition of the parent class tries to process the definition of the child window class which in turn includes a definition of the parent).
How do I get around this?
Any help would be greatly appreciated.
Simon
|
|
|
|
|
Try forward declaring the parent class in the child's header file. Something like this:
// CChildDlg.h
class CParentView;
class CChildDlg
{
...
CParentView* m_pView;
};
and then #include the parent's header in CChildDlg.cpp where you can actually use the pointer.
Please note, some professor teaching OO design will tell you that this is a sign of a design with a high amount of coupling and thus bad. But I'm not a professor teaching OO design, so I'm not going to tell you that.
|
|
|
|
|
Thanks very much for the advice.
I totally take on board the bad OO vibes...to be honest this had occurred to me. However, how is this problem usually overcome? It must be fundamental to most applications? Few don't have little tool palettes appearing all over the show. Am I missing some well-known design technique to avoid coupling?
|
|
|
|
|
Put the #include in the .cpp file, and then put
class MyViewClass;
in the header file for the property page.
And read the FAQ, I'm sure it mentions this stuff.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Humm..
Here's a common solution I use to solve these types of problems: take each .cpp file you have and see what includes they make. Include, afterall, does nothing else than slap the entire file specified to the position where the command is. This is the easy way to think it.
Following this logic, if you want to avoid including a header file, you can always use the extern keyword. This word, when placed in front of a type, specifies that this type is declared in some other object module. The linker is then responsible to finding this declaration, and if you have the view class header included in any other .cpp file taking part in the linking process, the declaration of the class will be found.
Hence, just put a 'extern class CMyDerivedView' and include a 'CMyDerivedView* pParent' to the property page class. Make sure that the .cpp file of CMyDerivedView is partaking the build when using this solution.
Note that when you have a pointer to your class, you can always access the parent CView class of your view class by using the GetParent method (assuming the property pages are children of the view). This way, you can access the CView master class. Doing a 'DYNAMIC_DOWNCAST' from this pointer to your derived view class is then possible.
This means that in the most extreme case, all that is required is to put a 'extern class CMyDerivedView' in the property page .cpp file, and then using this method to access the parent view. However, this variable will remain global and may cause further problems down the road.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanks for the going to the trouble of writing that explanation Antti. The GetParent method was something I hadn't considered at all.
Thanks for time.
Simon
|
|
|
|