|
If you need to scroll the controls at the bottom into view, then create all the controls on the main dialog, and increase/decrease the height of the dialog in a loop using SetWindowPos() .
this is this.
|
|
|
|
|
I've done this by dinamically hiding\disabling set of controls + resize of the dialog itself. If your extra portion is in the middle, this would need some efforts to reposition other controls, but I have done this too before.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
|
Thanks Igor. I'll check these out.
Mark
|
|
|
|
|
What do you think if I implement my classes in .h files instead of dividing the declarations in .h files and the implementation in .cpp?
Is this a bad programming style or it will bother the compiler?
|
|
|
|
|
For me it seems strange,
I know that AppWizard makes the reverse for CAboutDlg of
a single/multidocument app
It inserts the declaration in .cpp before the implementation
I think it's better the usual way
|
|
|
|
|
it wont bother that much the compiler if you do it correctly.
however, it is a bad habit to do so.
we generally put into headers only declarations, other includes, class definitions, and the implementation code into deparated .cpp files...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20]
|
|
|
|
|
toxcct wrote: it wont bother that much the compiler if you do it correctly.
It doesn't bother the compiler, but it bothers the linker.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hello,
It's a bad (C/C++) programming practice and it will bother the linker if you include the header in more than one place. (Multiple defined symbols...). Besides that, if you place all your code in header files (no *.cpp file(s)) you'll not be able to create object files and executable code...
If you are talking about templates (I assume you are not), then you have to put all the code in a *.inl document or in the header file.
Hope this helps you.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
bad idea, if you change the implementation all file dependant on that header file will be recompiled.
Also, I don't think the debugger will be able to step in the code.
anyway, bad idea, I sure others will give you other reasons why.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
Hello i am using datagrid control in Vc++.net.
when i set a float value to a cell, it returns the fol error.
my code is
***********
Datagrid->set_Item(1,1,System::Convert::ToSingle(textBox1->Text) );
Error
********
error C2664: 'void System::Windows::Forms::DataGrid::set_Item(int,int,System::Object __gc *)' : cannot convert parameter 3 from 'float' to 'System::Object __gc *'
The datagrid columns are of float type.
otherwise if i use toString function,
Datagrid->set_Item(1,1,System::Convert::ToSingle(textBox1->Text) );
it compiles well but, returns runtime error, cannot convert from target type to primitive type..
Pls help me
Salai
|
|
|
|
|
Hi to all,
I've got a big problem with the code below
CWorkRecordset::CWorkRecordset(CDaoDatabase* pdb)
: CDaoRecordset(pdb)
{
//{{AFX_FIELD_INIT(CWorkRecordset)
m_lUser = 1;
m_lCode = 0;
m_lDept = 0;
m_lWork = 0;
m_lSource = 0;
m_oStartTm = COleDateTime::GetCurrentTime();
m_nFields = 6;
//}}AFX_FIELD_INIT
m_nDefaultType = dbOpenDynaset;
}
The problem occours during the creation of the obj,
and only if:
- I'm running in debug mode
- The PC where Visual C++ Professional 6.0 (no service pack) is installed has Win XP as OS
Program crashes when it execute:
m_oStartTm = COleDateTime::GetCurrentTime();
If I run in release mode, no crash occours
If I run in debug/release mode in a Win 2000 PC, no problem
The state of obj m_oStartTm is "valid" before assignment
Can anybody help me?
Thanks in advance
Cristian
|
|
|
|
|
Have you stepped into COleDateTime::GetCurrentTime() to see what is causing the crash?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Have you stepped into COleDateTime::GetCurrentTime() to see what is causing the crash?
As I try to step into using F11 the program crashes, the debug window says:
Debug assertion failed!
File: winctrl5.cpp
line: 189
Before calling that function obj m_oStartTm.dt = 0.0000 & m_oStartTm.status = valid
I don't understand...
|
|
|
|
|
misturas wrote: File: winctrl5.cpp
line: 189
Hmm, this is inside of the CDateTimeCtrl::GetTime() method. Can you set a breakpoint in it and then check the call stack once that breakpoint is reached? I'm curious how you got there from COleDateTime::GetCurrentTime() .
Another suggestion would be to change the initialization to:
m_oStartTm = COleDateTime(0); and see what that produces.
Also, what does CWorkRecordset::DoFieldExchange() look like?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
So, using m_oStartTm = COleDateTime(0); causes a compiling error(0);
DoFieldExchange is:
pFX->SetFieldType(CDaoFieldExchange::outputColumn);
DFX_Long(pFX, _T(cRSsbUser), m_lUser);
DFX_Long(pFX, _T(cRSsbCode), m_lCode);
DFX_Long(pFX, _T(cRSsbDept), m_lDept);
DFX_Long(pFX, _T(cRSsbWork), m_lWork);
DFX_DateTime(pFX, _T(cRSsbDateHour), m_oStartTm);
DFX_Long(pFX, _T(cRSsbSource), m_lSource);
where cRSsbUser is the name of a access table column
And finally, if I set a breakpoint in winctrl5.cpp, when i run the debug Visual C++ disable that brakpoint
Now in italy is quite late, i think I'll go sleepin an hour, if i apologize if i don't reply immediately
Thanks in advance, tomorrow i will try again
-- modified at 16:34 Thursday 1st December, 2005
|
|
|
|
|
misturas wrote: So, using m_oStartTm = COleDateTime(0); causes a compiling error(0);
What about this instead:
m_oStartTm = (DATE) 0; Even if this does pacify the compiler, I feel the underlying problem still exists. I just created a test program with a class derived from CDaoRecordset , and an Access table having a date/time column. The constructor looked liked yours and I got no assertion. At this point, I would suggest you do the same thing, and then start adding bits and pieces of code until the problem shows up. Make sense?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: What about this instead:
m_oStartTm = (DATE) 0;
Even if this does pacify the compiler, I feel the underlying problem still exists. I just created a test program with a class derived from CDaoRecordset, and an Access table having a date/time column. The constructor looked liked yours and I got no assertion. At this point, I would suggest you do the same thing, and then start adding bits and pieces of code until the problem shows up. Make sense?
I apologize if i reply only now, I had problems with internet connection
I just want to ask if you have the same configuration I submit in my first msg, because if I use win 2000 I have no problem!
|
|
|
|
|
I am using Windows XP SP2.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hello, I searched this message board and I did not find anything about changing the color of the scrollbar in my edit box so I decided to ask. In my dialog box I have 4 edit boxes and I want to modify the style of the scrollbar (CSS does this in webdesign). See an example here of CSS scrollbar style modification
|
|
|
|
|
Problem Context: I am writing 2 functions in a dll namely "Fun1" and Convert(thread function).
I am creating a thread within a Function "Fun1" which is called from a tool.
The code for this as follows:
Fun1(Long lChannelNos )
{
HANDLE h1;
NumberOfChn(/*declared at file level of long type*/) = (long)lChannelNos ;
LPDWORD dwTh ;
LPVOID data ;
data = (void *)NULL ;
h1= CreateThread(NULL, // default security attributes
0, // use default stack size
Convert, // thread function
data, // argument to thread function
0 , // use default creation flags
dwTh) ; // returns the thread identifier
if(h1 == NULL)
{MessageBox((HWND)hDIAdemWndGet(),"Failed to create thread","Failure
Thread",MB_OK);
return ;
}
CloseHandle(h1);
return ;
}
DWORD WINAPI Convert(LPVOID lpTh)
{
Here I create linked list, dynamically on heap, using pointers to structure of data type given below.
Thus depending on size of "NumberOfChn",(any value between 1 to 200) the memory requirement varies.
For NumberOfChn = 1 the linked list would consume memory of 40503 bytes(40.5Kb).
}
Problem facing:
1) For NumberOfChn = 1 to 10 (any value) I do not get any error after executing function "Fun1". But if I happens to close the tool, the following error is received
Error: Debug assertion failed
Program: c:\Program Files\National Instruments\Diadem 9.1\Diadem.exe
(This is the Tool from which i make call to "Fun1")
File : dbgheap.c
Line:1011
Expression: _CrtIsValidHeapPointer(pUserData)
2) If the value of NumberOfChn goes beyond 15 it gives
MEMORY ACCESS VIOLATION error.
thats all....
waiting for any solution.
typedef struct tag_VECTOR
{
char lpszVectorDescription[5] ; //1) Vector description as a variable length string.
char lpszVectorName[7] ; //2) Vector name as a variable length string.
char lpszEquation[5] ; //3) Equation as a variable length string. I read but ignore this value.
long int lNoOfPoints ; //4) Number of points in vector as a four-byte integer.
long int lNoOfBytes ; //5) Number of bytes in each point, either four or eight for single and double precision. The GM Safety Lab data uses single precision.
long int lBinaryFlag ; //6) Binary flag as four-byte integer, always set to one.
float lpDataValue[10000] ; //7) The four or eight byte binary, floating-point data values. The total number of bytes in this section is the product of the values read in four and five, above.
}VECTOR, *LPVECTOR;
//**************************************************************************************************************
//The request description is made up of the channel name, anomaly error (if any), channel description,
//channel number, units, filter, and file name. For example:
//aa001a, ANOMALY = Data Affected by Accelerometer Rotation, CTR FRT C/MBR ON SENSOR LONGITUDINAL ACCEL, G'S, Channel = 123, Units = G's, Filter = 1000, File = c12001a
//To model this sequence I am writing following structure
//**************************************************************************************************************
typedef struct tag_REQUEST_DESCRIPTION
{
char lpszChannelName[25] ; //1) Channel name and is assigned as Request name
char lpszAnomalyError[20] ; //2) Anaomaly Error if any.
char lpszChannelDescription[25] ; //3) Channel Description
char lpszChannelNumber[4] ; //4) Channel Number
char lpszUnits[15] ; //5) Channel units
char lpszFilter[10] ; //6) Filter
char lpszFileName[15] ; //7) FileName
}REQUEST_DESCRIPTION, *LPREQUEST_DESCRIPTION ;
//***************************************************************************************************
// Request Structure: This structure is used to emulates "Requests" section of ABF file.
//***************************************************************************************************
typedef struct tag_REQUEST
{
REQUEST_DESCRIPTION RequestDescription ; //1) Request description as a variable length string.
char lpszRequestName[35] ; //2) Request name as a variable length string.
char lpszRequestNameRe[35] ; //3) Request name, repeated, as a variable length string. I read but ignore this value.
char lpszTotalDescription[240] ; //4) Total description is string formed by concating all elements of "RequestDescription" element
tag_REQUEST *NextRequest ; //5) This points to next request of same data type. If no next request is available it is NULL
LPVECTOR lpVector ; //6) This points to vector
}REQUEST, *LPREQUEST;
//****************************************************************************************************
// Data Type Structure: This structure is used to emulate "Data Types" section of ABF file
//****************************************************************************************************
typedef struct tag_DATA_TYPE
{
char lpszDataTypeDescription[25] ; //1) Data Type description as a variable length string.
char lpszDataTypeName[25] ; //2) Data Type name as a variable length string.
long int lDefaultTimeDataType ; //3) Flag indicating if this is the one and only default time Data Type. This is a four-byte integer,1 = true, 0 = false. At most only one Data Type in each file may set this to true.
long int lNoOfRequests ; //4) Number of requests as a four-byte integer. This number denotes the number of channels, in given data set, of same data type
long int lNoOfComponents ; //5) Number of components as a four-byte integer.
tag_DATA_TYPE *NextDataType ; //6) This points to next data type.
LPREQUEST lpRequest ;
}DATA_TYPE,*LPDATA_TYPE ;
|
|
|
|
|
Amol Ravatale wrote: Here I create linked list, dynamically on heap, using pointers to structure of data type given below.
Are you using new and delete for this?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes I am using new and delete for this.
|
|
|
|
|
Show the code that adds to, and deletes from, the list.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|