I am having an MFC Dialog class called CDataFilesDialog
inheriting from CDialog
I have a global object of this dialog named dlg;
I am doing a dlg.DoModal() from a WMCOMMAND message handled by wndproc of my win32 application. I am trying to mix MFC and WIn32
Under Windows, I try to open file which name contains apostrophe or some letters in language other than English. In these cases fopen or CreateFile (from W32 library) fail to open it. How should I do that task? Wide character type, wfopen or defining UNICODE don't help. The functions say the file doesn't exist.
Well, maybe. I read the name of file from another text file which is windows media player list (.wpl). E.g. I can't open file named "Baby,_I’m_Not_Sure_If_This_Is_Love.mp3" but this "05 - Cold Hearts.mp3" can be opened. There may be issue with encoding characters in the list but how it is possible that some files can be opened and others cannot from the same list. Of course, all files are playable by WMP.
Afterwards you must still check for entities as noted in my above post. Even when the WPL file does not use entities for non-ASCII characters it uses them for the reserved characters (quot, amp, apos, lt, and gt).
Definitely, it helped at least in half a problem. The rest lays in XML entities like &_amp_; (without underscore). I think I should treat them manually.
Generally, mbstowcs won't help. I had to use win32 function where I can define more encoding standards.
I just created a file with that name and I was able to open it with another application. As I said before, I suspect the issue is something else. Are you sure that your path is correct when you try to open the file?
Write a C
Program to find the survivor in a "7 up" game.
In the game, a group of people stand in a circle,and start counting from1in a clockwise direction.
The person who has to say "7" goes out, and the person next to him starts counting from1 again.
This goes on until only one person remains, and he is survivor. Your goal is,
given the size of the group find out the place(Index) in which a person has to stand for him to become the survivor
But note that you won't get an answer for this kind of request. This is not a code writing service. Try it yourself. If you then get stuck at some point, show what you have tried so far (code snippets), describe the problem, and you might get valuable help.
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
I have a very general question on database migration. Am pretty new to database development and have no ideas at all, so please bear with me.
I am working on a VC++ MFC application using Visual Studio. This has a Oracle backend database.
There's a table called T_SIGN_IN that has the following columns,
............and so on...
Now as part of a new feature enhancement, we want to create a new table called T_SIGN_LOG and migrate some of the existing column data from T_SIGN_IN.
For e.g., we want to move data from USR_ID, USR_LAST_LOG_IN and USR_LAST_LOG_OFF to the new table.
How can this be achieved?
I hear that there're 2 ways of achieving this.
1. Stored Procedures.
2. C++ function.
Can someone give me a example of how this can be done via the above 2 approaches? Code snippet will be great!
And also, which is the best way of doing it?
I am trying to build and use my first DLL. After editing in the source code and building the Debug directory contains the .dll, the .lib and four additional files. A console app is created in the same solution but another project and built without referencing the dll. The .dll and .lib are copied to the solution directory. In the console app I added:
Ctl-F7 produces a successful compile. A build produces this error.
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl Get_Text_For_Error_Code(unsigned long,wchar_t *,unsigned int)" (__imp_?Get_Text_For_Error_Code@@YAXKPA_WI@Z) referenced in function _wmain E:\CODE\Common_Utilities\Test_Get_Text_For_Error_Code\Test_Get_Text_For_Error_Code.obj Test_Get_Text_For_Error_Code
After some searches my latest attempt to fix is by: Right click solution -> Properties -> Linker -> General -> Additional Library Directories
There I edited in the path to the DLL. No help.
This is my first DLL attempt and I strongly suspect there is something simple I have missed. Please point me in the right direction.
At link time you need to include the .lib file, which contains the exports from the build of the library. The .dll file is only used at run time whan the system loader gets all the separate modules into the program's address space. Did you follow the guide at Walkthrough: Creating and Using a Dynamic Link Library (C++)[^]?
I had not found that one, but went through it. I read the instructions, adapted the steps to my solution as I understand them, and the project in the same solution that used the DLL worked perfectly. That is cool.
However, I noted something. From that walkthrough web page is this:
To use in the app the math routines that you created in the DLL, you must reference it. To do this, select the MyExecRefsDll project in Solution Explorer, and then on the menu bar, choose Project, References. In the Property Pages dialog box, expand the Common Properties node, select Framework and References, and then choose the Add New Reference button. For more information about the References dialog box, see Adding references in Visual C++ projects.
When I arrived at the dialog to add a reference the only allowed option was the DLL in the same solution. I created another solution in another directory to test using the DLL from another directory and solution. I navigated to same place within the IDE and the new solution with:
right click solution -> References -> Add New Reference
The response is "No items found." The dialog offers no method of discovering a DLL somewhere else on the computer. There is still something simple I am missing.
How does one specify an arbitrary DLL to use as a procedure or class resource?
Edit: From the new solution I tried this: in the dot cpp file, console app, I added this line:
You are still (not surprisingly) missing an important part of this. When you create a DLL the build (more specifically the linker) creates two files.
The first file is the DLL itself which contains the actual code that you want to call when your program is run. This file is only ever needed at run time, it has no part in the linking process when creating your executable.
The second, equally important, is the .LIB file, which contains the names and offsets of the exported functions. This second file is the one that you must add to your project in order for the linker to satisfy all the __delspec(dllimport) declarations. So when you add to the Additional library directories the path to your library, you also need to add the name of the .LIB file to the Additional Dependencies part of the Input section in the Linker properties.
Of course, you could save yourself much of this pain by creating a static library rather than a dll, but that is probably an exercise for another day.
Last Visit: 31-Dec-99 18:00 Last Update: 9-Aug-22 1:24