|
Completely newbie to this site (and Visual C++) so please be gentle if I am doing something wrong.
I am attempting to modify someone else's code and am not sure what I am doing wrong. The project setting indicated "not MFC" and "Win32 debug" which I didn't understand but couldn't find anything in the search. Without changing anything else, I just wanted to add a combo box with a list of items which can be selected. I dropped a combo box control on the dialog form and added 3 items to the data tab and recompile to see if the box displayed properly. The combo box is on the form but nothing is in the drop down list? What might I be doing wrong? I tried creating a new dialog project and the combo box is working fine. Any help would be appreciated.
David
|
|
|
|
|
dkyue92708 wrote: Completely newbie to this site (and Visual C++)
Why are you working on a production project if you are new to C++?
|
|
|
|
|
I am not working on any production project. I work with IP Security cameras and we provide sample C++ SDK to our customer as a courtesy and I am learning to support it. I am taking baby-steps and thought that it would be easy enough to add a simple combo box.
BTW, what would you recommend for me to 'come up to speed' quickly on C++/Visual C++?
|
|
|
|
|
dkyue92708 wrote: BTW, what would you recommend for me to 'come up to speed' quickly on C++/Visual C++?
That's a tough one. Everyone is different. Some people never "come up to speed". What is your background/experience?
|
|
|
|
|
I worked on embedded firmware maintenance for SCSI tape drives for two years using C, then moved to supporting test utilities for the same tape drives using C again. I briefly started learning C++ but seemed to have hard time with the OOP concept so I kinda know enough to be dangerous The trouble is I am in Sales Support now so I don't get to code very often but want to get back into it.
Anyway, do you have any suggestion for my original question as to why the data list for my combo box is not showing up (drop down box is empty)?
|
|
|
|
|
I believe Iain is correct but not having done any GUI stuff without MFC in... well a long time, I am not sure.
|
|
|
|
|
dkyue92708 wrote: "not MFC" and "Win32 debug" which I didn't understand but couldn't find anything in the search.
"not MFC" means just that. The project does not use MFC in its code. "Win32" refers to the target (as opposed to something like ATL) and "debug" means the project is compiled and linked with debugging support. "Release" doesn't include debug stuff like symbol information and optimizes the code.
dkyue92708 wrote: I dropped a combo box control on the dialog form and added 3 items to the data tab and recompile to see if the box displayed properly. The combo box is on the form but nothing is in the drop down list?
Did you actually drop the list down or just assume nothing is in it since nothing is displayed in the visible portion? If the data is there when you do open the drop-list, you need to select an item in your initialization in order to see data in the edit area upon startup.
Judy
|
|
|
|
|
Thanks for the explanation. I need to read more.
On the combo box, I actually clicked on the drop-down arrow and the box opened up but nothing is in it. I drop the same combo box in a new project (MFC AppWizard) and the list does show up. Thanks!
|
|
|
|
|
dkyue92708 wrote: The combo box is on the form but nothing is in the drop down list?
That's because you need to increase the height of the combobox. By default, it's too small.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks for the feedback but that's not it. I left-click on the combo box control on the form and adjusted the size already. When I click on the drop-down arrow on the form, a drop-down box does appear that is large enough to fit the 3 items I specified in the property data sheet but it is blank.
|
|
|
|
|
With VS6, comboboxes have two separate vertical sizing methods. One sets the height of an unexpanded control, while the other sets the height of an expanded control. If you are using VS200x, I'm not sure how it behaves.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The items in the data tab are stored as a specific resource type. When a dialog is created using MFC, one of the jobs of CDialog::OnInitDialog is to go looking for this specific resource type, and populate the combo box for you.
It may be in OnCreate (in hindsight I'm pretty sure it is), but that doesn't really change anything here.
As you're not using MFC, no code ever goes looking for the data in the resources to add to your combo box, so it remains empty.
To recap: The data tab in the resource editor is only of use if you're using MFC. You're not.
In your DlgProc for that dialog, you'll need to handle WM_INITDIALOG and add the data there. Whether you hard code the values, read them from string resources, do some digging and write a function to replicate what MFC does is up to you.
Good luck,
Iain.
|
|
|
|
|
Thanks so much for the insightful answer. It makes perfect sense now.
|
|
|
|
|
Hi.
I have to develop an application that it will run in some clients, (3 or 5 PC's) and it connects to a SQL database in a server PC.
I have some skills in MFC:-> and also I know how to connect and query, (also call a SP), a SQL database.
But, my question is:
is that all that I need to know to develop such application?.
I mean, there's something else to know or to care to develop a Client/Server app?.
I need just an orientation about that, maybe an article or something like that.
Thank you.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
For a two-tiered solution (client-RDBMS), that's pretty much all you need. Each client can just
connect to the SQL database server.
If you add a server tier (client-server-RDBMS), then you'd need to add communication between the
clients and that server.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: For a two-tiered solution (client-RDBMS), that's pretty much all you need. Each client can just
connect to the SQL database server.
As long as there are no firewall issues.
|
|
|
|
|
Yeah But the OP won't need to know any other "technologies" to hit that wall
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Ok, Mark.
But in which situations are needed a client-server-RDBMS solution?.
I just want to read and update data in a server database, (a remote server) from some few clients. Just that.
Thankx.
Demian.
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my telephone."
-Bjarne Stroustrup, computer science professor, designer of C++
programming language (1950- )
|
|
|
|
|
I'm no expert on database applications, but in my case, I chose 3-tier for the following reasons,
based on experience, not expertise:
Complete control over client server communication, including NAT/firewall traversal.
Complete control over user authentication.
Complete control over network security (encryption).
Generic database access from clients - I'm not bound to a specific RDBMS or data access framework.
DB connection management and pooling.
Here's an article that may be of interest: N-Tier Application Development
with Microsoft .NET[^]
It's a 3-part article but part one explains some reasons for n-tier solutions.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I was wondering if we could reset the semaphore count to 0 using any API. Is it possible? If yes, could anyone please tell me how?
Thank you,
AJ
|
|
|
|
|
Ajay L D wrote: I was wondering if we could reset the semaphore count to 0 using any API. Is it possible?
No.
You might want to read this article[^] on how to use semaphores and the difference between a mutex and a semaphore.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
As Roger stated, there is no way of doing that. The interesting point is that this even makes no sense (if we think a little bit deeper, of course). If it were possible, the whole schema of synchronization structure would worth nothing. Suppose, a thread holds a semaphore or a mutex by being sure that no other thread grabs it from itself... And what would happen if this were possible..?
--
=====
Arman
|
|
|
|
|
while (WaitForSingleObject(handle, 0) == WAIT_OBJECT_0);
(Assuming handle is the semaphore handle)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi all,
Please point me to any demo project which captures audio from any device e.g mike,etc and able to hear the captured audio using DiectShow.There are many examples but all are of video capture and display using DirectShow.
Thanks and Regards,
Mayank
|
|
|
|
|
The same principles apply to audio.
The difference is in the filters used. For capturing the audio from a device you can use the
Audio Capture Filter. For rendering (playing) the audio you can use the Audio Renderer (WaveOut)
Filter.
The "AudioCap Sample" included with the SDK is a good place to start
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|