|
i think you must add the DLL.dll,DLL.lib and DLL.exp in your's Project directory.
Regards,
Eli
|
|
|
|
|
Hello everyone:
Nowadays,i want to make a formview,which can popup and fit the client area when a message is sent. howerver, i don't know how to create it use a function like DoModal() of modal dialog .
i am sooooo confused now.is there anyone who can help me?anything will be appreciated ,especially some samples or articles.thankx in advance
|
|
|
|
|
A formview is a full client window project, it will get started when you run the project. You want a formview as a child window of an existing view ? Why ? Do you need toolbars or something else that a dialog can't offer you ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i have create a formview inherited from CDialog,and i use myFormView.DoModal()to create it.however,the dialog can'tbe a full client window and the controls on it can't be used either.what can i do with that , sir?
thanks in advance!
|
|
|
|
|
I don't believe you're supposed to call DoModal on a FormView, it's meant to be a view, not a dialog. Create a new project inherited from FormView.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I’m creating a tool with MFC that uses both split views and Property pages (tabbed Dialogs). My problem is this, when a make a change in one view’s property page I want to have it effect what is displayed, without having to press a button, in the other views active property page. I know this can be done but for some reason I’m drawing a complete blank on how to do this.
|
|
|
|
|
I'm going to be modifying an existing Visual C++ GUI. Currently the GUI is one honking big form that fills more than a whole screen and is loaded with separate menus, scroll boxes, displays, etc.
Is there a simple approach to separating out the sub GUIs of a form like this? For example, is there some way to "cut and paste" existing portions of the form, or to breaking out parts of the form to be separate GUIs?
Or am I stuck with recreating new GUIs from scratch?
Thanks for any help.
|
|
|
|
|
I believe that you can drag and select a range of controls in your project, cut, and then paste onto a new form.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, there!
Recently I want to build my project from command line.
Below is the example from MSDN Library
msdev MyProject.dsp /MAKE "MyProject – Win32 Debug" /REBUILD
To test I create a simple SDI project test.dsp by using the MFC AppWizard.
Then under the dos command window I type:
msdev test.dsp /MAKE "test – Win32 Debug" /REBUILD
But the msdev response with the following error:
Warning: ignore unkown project: test - Win32 Debug
Error: There is no valid targets to build.
I check the test.dsp file, the content are as follow:
===========================================================
!IF "$(CFG)" == "test - Win32 Release"
.....
!ELSEIF "$(CFG)" == "test - Win32 Debug"
.....
# Begin Target
# Name "test - Win32 Release"
# Name "test - Win32 Debug"
# Begin Group "Source Files"
....
===========================================================
I did see anything missing, it's standard application
generated by the wizard.
Is there anybody know what's wrong with my approach?
Any comment and feedback are greatly appreciated.
Best Regards,
Wayne King
|
|
|
|
|
Are you running this from the command line in the same folder that the test.dsp file is in ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your quick response. Yes, I run the command from the same folder that the test.dsp is in. By the way, my OS is Windows 2000 with Service Pack4. I also try it with my Laptop which installed with a WindowsXP, both got the same error.
[Of course, I need to set the proper path for the DOS command to find the MSdev.exe and other compiler tools].
Any further comments?
Regards,
Wayne King
|
|
|
|
|
Yeah, I thought your error message meant it must have found the dsp. I've never done this before, but if I was doing it now, I'd simplify the string that's being checked for ( after making a backup ) and then seeing what happened from there. I'd also look in the IDE to see if it shows you the string that it uses to do a build ( from memory, it does show you that somewhere in the project settings ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Check inside the IDE, the string is there.
Thank you very much for your comments. Change the dsp contents won't work. Just try that, it casue the MSdev to crash. But to my surprise, after crash(It just crash the MSdev without affecting the system) I simple close the crash application. Restore my dsp and re-try the command line complie again, it works fine.
I have no idea why It behave like this. I need to try it again on my Laptop see what will happen then.
Best Regards,
Wayne King
|
|
|
|
|
I really need some help to simply move a Unicode filename into an array. The only way I know how to read files is by doing a system call.
Is there some way to just supply a directory like C:\temp and get the filenames into an array in Unicode format?
Please help I've spent countless time looking how to do this.
Thanks
|
|
|
|
|
Look at FindFirstFileW() and FindNextFileW()
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"
|
|
|
|
|
I had been playing around with FindFirstFileW but couldn't get it work. Here's the code I've dabbled using.
Does anyone have a link or small clip of code including #includes that works?
//THIS CODE DOESN'T WORK
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
WIN32_FIND_DATAW FindFileData;
LPCWSTR lpFileName = (const unsigned short *) "*";
HANDLE hFind;
ofstream outfile("new.txt");
hFind = FindFirstFileW(lpFileName, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
printf ("Invalid File Handle. GetLastError reports %d\n",
GetLastError ());
return (0);
}
else
{
printf ("The first file found is %s\n", FindFileData.cFileName);
while (FindNextFileW(hFind, &FindFileData) != 0)
{
printf ("Next file name is %s\n", FindFileData.cFileName);
outfile << FindFileData.cFileName << endl;
}
FindClose(hFind);
return (1);
}
}
|
|
|
|
|
stvprg wrote:
LPCWSTR lpFileName = (const unsigned short *) "*"
That's the problem. You're assigning a non-unicode string constant to a unicode string pointer. You need to use a true unicode string:
LPCWSTR lpFileName = L"*";
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"
|
|
|
|
|
Thank you, that L"*" suggestion really worked well. That solved the problem with getting the file handle that FindFirstFileW returns.
I tried all yesterday using TCHAR, turning binary write mode on/off and all sorts of unconventional programming methods to put FindFileData.cFileName into an array and/or file without success.
Try not to laugh but the closest I came to writting something close to unicode text with iostream was from the following code.
TCHAR tch = ' ';
int x=0;
while ((tch=FindFileData.cFileName[x])!=0)
{
outfile.put(FindFileData.cFileName[x++]); }
outfile << endl;
I've even tried outfile.put(tch) and outfile << etc every way I could imagine to try to write this to a file. I got alot of interesting files and even some close ones where the ascii chars read okay but the unicode multilangual chars were wrong, probably because they were being truncated or cut from a 4 3 2 byte into a 1 byte char.
I'm trying to write a simple console program.
How can I get the unicode TCHAR written onto a file using ofstream? Or is there a simpler way of doing this.
|
|
|
|
|
stvprg wrote:
How can I get the unicode TCHAR written onto a file using ofstream? Or is there a simpler way of doing this.
Use wofstream , which is the unicode version of ofstream , and then you can just write unicode characters as you would normal characters with a standard ofstream .
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"
|
|
|
|
|
I am developping a special software in Visual C++.
The algoritm-result consists of several rectangular solids (packs).
These packs should now be represented graphically.
I have the data of the coordinates (x,y,z) of the corners of all the packs that should be represented. The packs can be have different sizes, but have all rectangular surfaces. There can be a unlimited number of packs in the result.
The surfaces of each pack must be presented in an own color.
So I look for a dll or for an OpenGL / Glut / C++-Sourcecode that manages the 3D-presentation automatically out of the coordinate-data (input) of each pack. The dll / code must handle automatically the coverage of a pack by other packs, so that only the sight of a special perspective is shown.
The user must be able to spin / turn / rotate the whole sight to any direction (all axis of rotation).
I am sure that this problem has been solved already by other developpers. But where can I found such a dll / Sourcecode ? Can anybody give me an advice please ?
|
|
|
|
|
Google for Nehe. His OpenGL tutorials probably contain all the code you need to do this, as well as a sample C++ MFC project that's set up for OpenGL.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i have this header for my class file and then .....
#include<vector>
using namespace std;
class bigNumber;
bigNumber operator +(const bigNumber& lhs, const bigNumber& rhs);
bigNumber operator -(const bigNumber& lhs, const bigNumber& rhs);
bigNumber operator *(const bigNumber& lhs, const bigNumber& rhs);
ostream& operator<< (ostream& ostr, const bigNumber& t);
istream& operator>> (istream& istr, bigNumber& t);
class bigNumber{
public:
bigNumber();
bigNumber(const string & s);
bigNumber(vector<int> v);
friend bigNumber operator +(const bigNumber& lhs, const bigNumber& rhs);
friend bigNumber operator -(const bigNumber& lhs, const bigNumber& rhs);
friend bigNumber operator *(const bigNumber& lhs, const bigNumber& rhs);
friend ostream& operator<< (ostream& ostr, const bigNumber& t);
friend istream& operator>> (istream& istr, bigNumber& t);
private:
vector<int> digits;
void reverse ();
};
i have these member functions coded so far but i need help with the input operator
bigNumber::bigNumber(){
}
bigNumber::bigNumber(const string& s){
for(int i= 0; i < s.length();i++)
digits.push_back(s[i] - '0');
}
bigNumber::bigNumber(vector<int> v){
for(int j = 0; j < v.size(); j++)
digits.push_back(v[j]);
}
bigNumber operator +(const bigNumber& lhs, const bigNumber& rhs){
return 0;
}
bigNumber operator -(const bigNumber& lhs, const bigNumber& rhs){
return 0;
}
bigNumber operator *(const bigNumber& lhs, const bigNumber& rhs){
return 0;
}
ostream& operator<< (ostream& ostr, const bigNumber& t){
for(int k = 0; k < (t.digits).size();k++)
ostr << t.digits[k];
return ostr;
}
istream& operator>> (istream& istr, bigNumber& t){
istr >> t.digits;
return istr;
}
when i leave the input operator like it is i get an error saying
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::vector<int,class std::allocator<int=""> >' (or there is no acceptable conversion)
i dont know how to fix this and i am really pressed for time can someone please help me?
|
|
|
|
|
You can't do that. You need to iterate through the vector as you did for the output stream and pass each object through.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
char d;
if(istr >> d && isdigit(d))
t.digits.push_back(d - '0');
istr >> noskipws;
while(istr >> d && isdigit(d))
t.digits.push_back(d - '0');
istr >> skipws;
how come i keep getting the vector before added to the next vector if i input two numbers
??
|
|
|
|
|
d - '0' is a hack. Use atoi(d) instead.
What's going wrong ? Have you tried stepping through the code ? Why are you setting skipws instead of checking what the value of the flag is before you start ( so that you never change the state of the stream ) ? Why are there no brackets in the above code ? I'd expect you to just use a while loop for the entire code, not have the if at the start, and I'd expect all of the above code to be within the while loop, so if the first character is not a digit, none of it would run.
Christian Graus - Microsoft MVP - C++
|
|
|
|