|
Thanks but... i am very veryyy new in C++ and i need i little more help...
|
|
|
|
|
|
|
thanks... this really help :->
|
|
|
|
|
PaloukiLook wrote:
thanks
My Pleasure
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi,
I have a vstudio.net application with a main window and many windows a user may or may not open. These are modeless dialog Windows. How can I store the position, size, etc., of all the Windows that are opened when I close the application. The user may have any number of Windows opened, or may decide to close some. If the user opens the application file again...I want all the windows that were opened to reappear in the same positions and size, etc., on the desktop. I dont want to use the registry, but hope that I can use serialization.
Thanks.
Jerry
|
|
|
|
|
I've always used GetWindowPlacement for this, but I always saved it to the registry as binary data. Writing a serialization routine for the WINDOWPLACEMENT struct shouldn't be too hard.
I found this sample on MSKB, don't know if it uses registry or not.
MDIRest.exe Saves and Restores Window Size & Position
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Hello every 1
If i had a (string Date_Time; ) and it stroe date and time like that
xx/xx/xxxx xx:xx:xx all in 1 string
the first 10 char are the date , then a space , the 8 char of time
any way , i wana make a new string which have only the date..( string Date;)
so i need a string which read from string Date_Time; until the first space..
i was trying
cin.getline(Date,' ');
but it did not work
Waiting for your replies,
ANA BAHY
|
|
|
|
|
you can read one character at a time: put everything before the first space into the 'date' and everything after the space but before the end of the line into the 'time'.
or, you can read the whole line, search the string for the space and then use string::substr to extract the 'date' and the 'time' substrings.
or, you can read the whole string and use something like string::erase to chop off the 'time' part of the string : str.erase(10);
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks for the help , but i am not good at all , so could u help me a littile bet more??
now i have a s
String Date_Time;
if i used cout<
|
|
|
|
|
If you know the date will always be 10 characters, use the substr function.
<br />
std::string dateTime = "2000/10/31 12:00";<br />
std::string dateOnly = dateTime.substr(0, 10);<br />
substr(m, n) will return n characters starting at the m zero-based character.
if you're using MFC, use CString::Left. (or Mid)
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Hi,
Windows Explorer uses nice selection-rectangles. I want to use them in my ListView control, too (I do not use MFC).
How can I do that?
|
|
|
|
|
Change text and background color to imply selection.
Use DrawFocusRect()
|
|
|
|
|
Thanks for your answer, but my question should refer to the rectangle you drag with the mouse when you select multiple items. The standard listview just shows a grey border, but Windows Explorer fills this rectangle transparently with the selection color.
|
|
|
|
|
If your control is owner drawn, then you get that 'transparent' effect by changing the background color prior to drawing the text. The 'grey frame' you see by default is the DrawFocusRect.
If you mean the outline of the folders as they are dragged, then I think there is an interface for creating the bitmap mask used for the 'drag image'.
|
|
|
|
|
I did not mean the selection of the icons, but the rectangle you draw with your mouse.
Perhaps a picture can say more than thousand words.
By the way, the control is not owner drawn.
|
|
|
|
|
I really wish I could help you more, but I do not know what else to do. I briefly searched for some interface to create a draggable image or change the hilighting, but everything I found seemed to require owner drawing.
|
|
|
|
|
|
Hello friends,
Im working on a big VC++ project consisting of several .c and .h files.
Now I had included a new library which is written in C++ with many .hpp and .cpp files.
Now the main program, is a mixture of both c and c++ code and Im getting some errors when complied.
If this main program is main.c , Its unable to recognize "Class" in the first header file included and also its showing some >100 syntax errors which refers to C:\programfiles\microsoft visual studio\vc98\include\iosfwd directory.
If this is written as .cpp,
Its showing >100 syntax errors,where I couldnt find any error when its .c
Can anyone gimme an idea,how to deal with this?
Thanx in advance.
Regards.
|
|
|
|
|
don't use C++ code in .C files, and don't #include headers that use C++ code in .C files.
the compiler compiles .C files as C and that means any C++ code it sees while compiling a .C file is just syntax errors.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
prgr wrote:
Can anyone gimme an idea,how to deal with this?
You need to use extern to Specify Linkage[^]
Here's an example:
#ifdef __cplusplus
extern "C" {
#endif
int c_func_in_c_file(int someParm);
int c_func_in_c_file2();
#ifdef __cplusplus
}
#endif
#include "cFunctions.h"
#include "cppFunctions.h"
int c_func_in_c_file(int someParm)
{
return someParm + c_func_in_cpp_file();
}
int c_func_in_c_file2()
{
return 42;
}
#ifdef __cplusplus
extern "C"
{
#endif
int c_func_in_cpp_file();
#ifdef __cplusplus
}
int cpp_func_in_cpp_file();
#endif
#include "cppFunctions.h"
#include "cFunctions.h"
extern "C" int c_func_in_cpp_file()
{
return cpp_func_in_cpp_file() + c_func_in_c_file2();
}
int cpp_func_in_cpp_file()
{
return c_func_in_c_file2();
}
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I have to read and store data in a series of unsigned short variables in Shared Memory.
Now these variables are scaled and I need to convert them into their proper units. I display them as either float or integers.
For example for one variable:-
Max Val = 0.999969
Min Val = -1.000000
Least Sig Bit = 0.000030517578 = scaleFactor1.
So what I do is:-
unsigned short currentField = *(unsigned short *) fieldPtr;
float scaleFactor1 = (float)GetScalingFactor(scaleFactorStr);
float rescaledDataEng = currentField * scaleFactor1;
This works OK (rescaledDataEng ) for positive numbers, but for negative numbers it fails, e.g. I get for -0.44 the incorrect value displayed as (rescaledDataEng = 1.560028).
Are they a neat soultion to this problem other than adjusting for out of range data.
if(rescaledDataEng > maxValue) rescaledDataEng = -(1 -(rescaledDataEng - maxValue)); Also I dont think that I store the data (negative value corectly) when writing to the Sared Memory:-
*(unsigned short *) fieldPtr = (unsigned short)(fEngValue/m_fScalingFactor);
For example for one variable:-
Max Val = 179.999
Min Val = -180.000
Least Sig Bit = 0.005493 = m_fScalingFactor.
I enter -20 and 159.01 is displayed.
Any suggestions please as the more I look at the problem the more confused I get.
|
|
|
|
|
How can you read in negative values into an unsigned variable? e.g.
unsigned short currentField = *(unsigned short *) fieldPtr;
You can never have currentField = -0.44 or -20 and have correct results.
|
|
|
|
|
This may help to show the problem:-
For example for one variable:-
Max Val = 179.999
Min Val = -180.000
Least Sig Bit = 0.005493 = m_fScalingFactor.
I enter 20 and 20.00 is displayed; i.e. 20/0.005493 = 3640.9976 is stored
(0E38 Hex)
When I come to display the value I do the following:-
Get the value (0E38) and re-scale it = 0E38 * m_fScalingFactor = 20.00.
Works fine!
But for this example:-
Max Val = 179.999
Min Val = -180.000
Least Sig Bit = 0.005493 = m_fScalingFactor.
I enter -20 and 159.01 is displayed.
How to handle negative numbers?!?
grahamfff
|
|
|
|
|
Additionally, you can use below formula to scale any value from one range to another:
a = (q - p)/(s - r)*(b - r) + p
if you'd like to convert value of b belonging to range (r,s) to value a belonging to range (p,q).
|
|
|
|