|
Navigate to the home page of Code Project.
Click on the Desktop Development.
Here you will find links to all types of controls.
|
|
|
|
|
There are lots of samples on the MSDN[^] web site. Try and do your own research first.
MVP 2010 - are they mad?
|
|
|
|
|
I'm working on an application that will be used to program an external hardware item via the USB port. In addition I am going to allow remote access via the internet to my program. That way the hardware can be programmed remotely.
I have the USB working locally and am ready to start the remote access code. I have done remote access in the past so it won't be any big deal to implement.
But now the customer has decided they want the application to be written in C++/CLI. The main reason is they like the looks of Windows Forms. They also like the idea of the child form being locked inside the parent form and the way graphics can be displayed. I could probably do the same thing in MFC with some extra work.
I haven't done any C++/CLI programming. I have 3 questions. Will USB and Windows Sockets be relatively easy to implement using C++/CLI? And is there a long learning curve for C++/CLI. If I use C++/CLI how much trouble will it be for the end user to install the application? With MFC I would just send them a statically linked exe file and there wouldn't be any installation.
Comments, suggestions?
|
|
|
|
|
Using C++/CLI has the side effect of the .Net framework becoming a dependency, which will then need to be redistributed and installed on every PC.
The learning curve is not so much, especially for C++/CLI.
But I recommend you understand how the .Net garbage collector works so that you can write programs that run efficiently.
But you will have the extra overhead of doing an interop with unmanaged code especially the USB part.
The reasons for the change do not look convincing to me for a shift from unmanaged to managed.
This is because dialogs in Windows look the same irrespective of the language used to develop it.
Like you said you may need to do a little extra work with MFC.
You should look at the MFC feature pack which brings cool looking UI programming capability to MFC.
It can be downloaded here - Visual C++ 2008 Feature Pack Release[^]
Here are a few articles to get you started -
MFC Feature Pack Tutorial – Part 1 – Getting started[^]
MFC Feature Pack: An Introduction[^]
MFC Feature Pack for VS 2008 and 2010[^]
|
|
|
|
|
The good thing about C++/CLI is that you can still use MFC!
This is how you do it:
1. Create a new MFC project
2. Open the project's Properties dialog
3. Set the project to support the CLR
Now you can mix MFC programming with managed code.
|
|
|
|
|
Superman, thanks for the comments. I will look at the feature pack to see what it offers.
Richard, I am reading Ivor Horton's Visual C++ 2008 book. In the book he says you can mix managed and unmanaged code but he says you really shouldn't do it unless absolutely necessary. Plus he says there is extra overhead involved in managing the communications between the two.
Other comments will be welcomed as I am looking for as much input as possible.
|
|
|
|
|
OK, I'm making a small ShellEx. The point is to right-click-drag-and-copy files from one folder to another, but only certain files. I've been using The Complete Idiot's Guide to Writing Shell Extensions - Part IV[^] as a starter.
After I'm finished sorting the files, I use CopyFile. It all compiles fine, but when I use it, it gives me an error about access to the file(s) being denied. It appears that it triggers WinXP's DEP. I'm quite stumped on this one. It would help if I could debug the thing, but it doesn't want to be debugged, apparently.
Is there a better way to copy files/folders than CopyFile? Is there a way to debug my app?
|
|
|
|
|
|
Hi All,
I want to instrument a C++ program by entering probes inside every block.
But i m finding it difficult for single statement condition statements without braces.Eg
If(x==2)
stmt;
Else
stmt1;
I want to put braces in the program so that i can insert my probes in them.
|
|
|
|
|
The solution is simple: just put braces in!
|
|
|
|
|
It sounds like a real pain, but it also sounds like you already know exactly what you have to do to accomplish this. I don't think there is an easier way.
You do realize that the probes you are inserting will impact your program and make the source code more cluttered difficult to deal with and maintain correctly.
Have you looked at different profiling tools? Perhaps there is one that would be an easier answer for your needs.
|
|
|
|
|
Visual Studio 2008 (not sure of 2005) has a built-in feature to instrument and optimize applications.
Check if this is suitable for you.
You will find this under the menu option Build -> Profile Guided Optimization
|
|
|
|
|
Hi All,
I want to disable the mosue movement in a MFC view application if the control is in an edit box and user entering data in the edit box. I want to get back the mouse movement once user presses enter key in the edit box, can anybody tell me how can I do this in MFC view application
|
|
|
|
|
why?
it seems to be counter-productive in a multi-application OS like windows.
This signature was proudly tested on animals.
|
|
|
|
|
I have multiple modeless dialog with each dialog have some edit box controls on it. So when user entering data in to an edit box of modeless dialog and at the same time if user moves the mouse away from that modeless dialog the focus is changing from the edit box to parent window which is making wrong values to be set in the edit box. So I want to disable this mouse movement until the user done with data entry into the edit box. yeah it seems like counter-productive but the requirment is like that
|
|
|
|
|
This is exactly why you should use a modal dialog in this instance.
MVP 2010 - are they mad?
|
|
|
|
|
While I'm not sure how good an idea it is, perhaps you want to look into mouse capture. See here and here. You could try to capture the mouse on first character entered into the control and release it on tab or enter. I'm still not confident that this won't be misunderstood by users and frustrate them.
Edit: Richard's response is better. Listen to him.
modified on Friday, January 22, 2010 12:33 PM
|
|
|
|
|
Simply moving the mouse should not change the focus state of the dialog and/or edit box currently being edited.
Me think you have a bad design (as other wrote), at least the way you update your values.
This signature was proudly tested on animals.
|
|
|
|
|
You might want to rethink this. It is an unusual approach and will be misunderstood by users. Having the mouse cursor disappear or become unresponsive will be interpreted by many users as a program hang. Some will respond by bringing up task manager to kill your program. Others will reboot their computer to get things working again. Neither is a good thing. (Yesterday I was trying to help a user who is using some buggy, no longer supported legacy software. He would have done ;exactly this ;with no hesitation.)
Perhaps you could validate the data at some point and notify the user if it is invalid. You could even set focus back to the offending control.
|
|
|
|
|
I am trying to change the working directory of a MFC application after
the application execution begins.
Chdir or setcurrentdirectory doesnot work for a MFC application.
Can anyone suggest how i can do this?
|
|
|
|
|
SetCurrentDirectory works in MFC.
Check if your path is valid.
Also you could use GetLastError after the failure of the function.
If the path is OK then some relevant code snippet about your problem could also help us to find the problem.
Regards,
|
|
|
|
|
|
Hi all,
I have a binary image (white objects and black background). I want to find the nearest white pixel for every black pixel of the image. How can implement it in c++.
Thanks in advance,
Franckesh
|
|
|
|
|
And what is your doubt about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
One possibility:
Making desired black pixel as center of your search and then exploring the pixels around, if not found increasing in 1 your search radius and try again, when you have a hit in white, getting its coordinates and making the modul of the vector from point A to B to get the distance.
But by all means:
Starting code and reading this[^]
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|