|
IDE shuold generate stdafx.pch first.
to achive that, select stdafx.cpp and change precompileheader option
to create one. (maybe /Yc)
|
|
|
|
|
I tried, the option /Yc can generate the .pch file.
After that I changed /Yc to /Yu , it got
compiling error.
Also, in an MFC project, the .pch file will be generated automatically
either when I delete the .pch file or I change stdafx.h, without using
/Yc but /Yu .
I seems a little compicated.
|
|
|
|
|
Hi
I am looking for an easy way to create GUI for my application. User needs to draw dots on a plane with 3 available colours. The program will then remember the coordinates/position of these dots and let the user inpute few parameters for each dot.
This will be a GUI for a computer simulation program, an interface for setting parameters of that simulation.
Can anyone advise an easy, fast way to program it? I can write a code in Visual Studio or some other IDE.
|
|
|
|
|
I think the easiest would be to create a MFC application and use GDI to draw the points (you can use CDC::Ellipse[^] for instance). But if you are completely new to MFC, I suggest you learn MFC from the start (using a book or online tutorial).
|
|
|
|
|
I don't know anything about MFC, that's why I'd rather avoid learning it to save my time. I am looking for some control that can be used to draw shapes, but I can't find it. I know that there are such components in Java in Netbeans and now I'm looking for something similar.
|
|
|
|
|
Member 4124956 wrote: I am looking for some control that can be used to draw shapes
That's rather vague. What are you looking for exactly ?
Anyway, even if you find such a control you will still need to learn some basic stuff with MFC. You'll have that problem with whatever you will choose: a minimum knowledge of the framework you are using is always needed.
|
|
|
|
|
In Java I used a panel or sth (I can't remember terminology) which I could add to my window, and I could draw what I wanted in that panel. I could easilly check the color, position etc of everything what I painted just using the object properties, functions.
I will check what it exactly was.
|
|
|
|
|
In Java we can use jPanel, jColorChooser and classes:
java.awt.Color
java.awt.Graphics
to obtain such a GUI. This function shows the simplicity of that solution:
private void jPanel1MousePressed(java.awt.event.MouseEvent evt) {
int X = evt.getX();
int Y = evt.getY();
Graphics gr = jPanel1.getGraphics();
gr.setColor(jColorChooser1.getColor());
gr.fillOval(X, Y, 10, 10);
}
Is there anything similar in C++?
|
|
|
|
|
Hi,
im using RemoveDirectoryW() ...the problem is..
RemoveDirectoryW(L"c:\\test\\testing");
the above deletes the folder testing but when....
the path to delete is present in two LPCWSTR"s then how can i add them ie...
LPCWSTR lpPath1=L"c:\\temp\\folder1\\";
LPCWSTR lpPath2=L"testing\\tester";
i need to pass the combination of the above to RemoveDirectoryW()(finally i should delete tester).....Please let me know how can i do this....
|
|
|
|
|
Not sure what you're trying to do. Do you want to delete a directory that has sub-directories? Could you re-phrase your request a bit?
|
|
|
|
|
Yes i will .....
I need to delete a folder named "Test" which is present in the folder TEMP(Environment variable)...
im able to get the path of TEMP using...
WCHAR buffer[1042]={'\0'};
DWORD size=1042;
::GetEnvironmentVariableW(L"TEMP",(LPWSTR)buffer,size);
CString csPath;
csPath=buffer;
im able to get the path of TEMP in csPath... now i have to delete the folder Test which is inside that TEMP folder....
When i use RemoveDirectoryW() i need to pass the path(in LPCWSTR) to Test folder....so please help me to attain this....
|
|
|
|
|
|
To concatenate the two strings, you could use something like this:
LPCWSTR lpPath1=L"c:\\temp\\folder1\\";
LPCWSTR lpPath2=L"testing\\tester";
std::basic_string<WCHAR> strPath = lpPath1;
strPath += lpPath2;
RemoveDirectoryW(strPath.c_str());
This requires a #include <string> . Note that I'd recommend generic text mappings (with _T , etc.) instead of just using Unicode directly.
|
|
|
|
|
Thanks for ur support....
May i know how to achieve this if lpPath1 is a Cstring.....
|
|
|
|
|
CString strPath1 = _T("c:\\temp\\folder1\\");
CString strPath2 = _T("testing\\tester");
CString strPath = strPath1 + strPath2;
RemoveDirectory(strPath);
|
|
|
|
|
Sorry i mean to say if only lpPath1 is Cstring and lpPath2 is LPCWSTR then how can i add them and pass to RemoveDirectoryW() Please let me know.....
|
|
|
|
|
If you're compiling in Unicode mode, it's basically just the same:
CString strPath1 = _T("c:\\temp\\folder1\\");
LPCWSTR lpPath2 = L"testing\\tester";
CString strPath = strPath1 + lpPath2;
RemoveDirectoryW(strPath);
|
|
|
|
|
Hi,
sorry it"s deleting thanks.....
modified on Saturday, March 21, 2009 9:59 AM
|
|
|
|
|
Hi,
How can i get the value of Environment variables(user variables)..thru a sample ....
Please help me out....
|
|
|
|
|
TCHAR varValue[32767];
GetEnvironmentVariable(_T("PATH"), varValue, 32767);<pre>
<code>varValue</code> will (after the call) contain the path for your account.
<div class="ForumSig">Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p</div>
|
|
|
|
|
Thanks for ur reply...suppose using this...
TCHAR varValue[32767];
GetEnvironmentVariable(_T("TEMP"), varValue, 32767);
if get the path of TEMP in varValue...how can i create a folder named "Testing" under that TEMP folder...using CreateDirectoryW()
|
|
|
|
|
Here is another way to do it...
CString directory = "";
directory = getenv ( "ProgramFiles");
CString newDirectory(directory + "\\EnvFolder" );
BOOL createDirEnv = CreateDirectory(newDirectory, NULL);
|
|
|
|
|
wchar_t varValue[32767];
GetEnvironmentVariableW(L"TEMP", varValue, 32767);
wchar_t testingDir[32767];
PathCombineW(testingDir, varValue, "Testing");
CreateDirectoryW(testingDir, 0);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I am writing an application, which required unicode conversion, but I am facing some problem with SLOVAK characters.
For example, I face the problem for character ď , whose value is ď
for conversion, I did the following:
string strNum = "271";
wchar_t lpszUcode[1];
lpszUcode[0] = atoi(strNum.c_str());
int nCodePage = 1252;
int iBuffLen = WideCharToMultiByte(nCodePage, NULL, lpszUcode, 1, NULL, 0, NULL, NULL);
char* buffer = new char[iBuffLen + 1];
WideCharToMultiByte(nCodePage, NULL, lpszUcode, 1, buffer, iBuffLen, NULL, NULL);
buffer[iBuffLen] = 0;
string strRes = buffer;
It returns with the value d rather than ď .
can somene pl. sugeeset the solution for this.
Regards
Tough Time Never last, but Tough People do.
|
|
|
|
|
Vineet Kumar wrote: int nCodePage = 1252;
Code page 1252 doesn't contain that character, so it translates to the nearest equivalent that is in hte code page - which is "d".
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|