|
You should be able to enter xcoord1,80 in the watch window to see all 80 elements of your array. Assuming you have managed to clear the OMF error problem.
I would recommend getting the book Debugging applications by John Robbins which gives lots of hints etc on how to get he most from your code and the IDE debugger.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
Hi
I'm currently working on a DLL in pure Win32API, i.e. with no MFC support.
Now I have one question:
I need to create a ListBox with multiple columns (like MFCs CListCtrl).
Is this possible in Win32 API?
With CreateWindow() I can create a simple ListBox (like MFCs CListBox), however it does not support multiple columns
How can I create such a ListCtrl?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The listctrl is part of the common contrls library so you must include the standard inclusion file commctrl.h.
Also make sure the common controls lib in linked into your program. comctl32.lib
Allpcaitions that use common controls (SDK) must call InitCommonControlsEx() before using any common control.
In your case:
INITCOMMONCONTROLSEX cc;
cc.dwSize = sizeof(INITCOMMONCONTROLSEX);
cc.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&cc);
Common controls are created like built in "BUTTON" or "EDIT" windows.
Using List View Controls - Under your help files
hwndLV = CreateWindow(WC_LISTVIEW, "",
WS_CHILD | VS_REPORT | LVS_EDITLABELS, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, hwndParent, NULL, g_hinst, NULL);
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
hi, i need create an atribute from a managed cv++ class in a unmanaged vc++ class.
Anyone knows why?
thanks in advance.
Salamanca 2002 Capital Cultural Europea, Visitala
|
|
|
|
|
Hello Friends,
In fact I do not know that template definition must be made inside the class. Is it really necessary?.
But, unfortunately I have encountered much more difficult problem with other template functions as described below.
I have five overloaded functions in a class as shown below:
template <typename r,="" class="" c,="" typename="" t1="">
RPC::ParamList runMethod(RPCServer &instance, R (C::*methodPtr)(T1)
, const RPC::ParamList ¶ms)
{
RPC::ParamList results;
zinc_assert(params.size( ) == 1);
// Convert params
T1 arg1;
zinc_assert(params[0].type == RPC::typeOf(arg1));
fromString(arg1, params[0].value);
// Invoke method
C *cl = dynamic_cast<c *=""> (&instance);
zinc_assert(cl);
R result = (cl->*methodPtr)(arg1);
// Package results
RPC::Parameter r;
r.type = RPC::typeOf(result);
r.value = ::toString(result);
results.push_back(r);
return results;
}
template <typename r,="" class="" c,="" typename="" t1,="" t2="">
RPC::ParamList runMethod(RPCServer &instance, R (C::*methodPtr)(T1, T2)
, const RPC::ParamList ¶ms)
{
RPC::ParamList results;
zinc_assert(params.size( ) == 2);
// Convert params
T1 arg1;
zinc_assert(params[0]->type == RPC::typeOf(arg1));
::fromString(arg1, params[0]->value);
T2 arg2;
zinc_assert(params[1]->type == RPC::typeOf(arg2));
::fromString(arg2, params[1]->value);
// Invoke method
C *cl = dynamic_cast<c *=""> (&instance);
zinc_assert(cl);
R result = (cl->*methodPtr)(arg1, arg2);
// Package results
RPC::Parameter *r = new RPC::Parameter;
r->type = RPC::typeOf(result);
r->value = ::toString(result);
results.push_back(r);
return results;
}
// Partial template function overload for vector argument
template <typename r,="" class="" c,="" typename="" t1="">
RPC::ParamList runMethod(RPCServer &instance
, R (C::*methodPtr)(vector<t1>)
, const RPC::ParamList ¶ms
)
{
RPC::ParamList results;
vector<t1> arg1;
{ // Convert params
zinc_assert(params[0]->type == RPC::ARRAY);
int stated_size;
::fromString(stated_size, params[0]->value);
zinc_assert(params.size( ) == stated_size + 1);
T1 t;
int i;
for (i = 1; i < stated_size + 1; ++i) {
zinc_assert(params[i]->type == RPC::typeOf(t));
::fromString(t, params[i]->value);
arg1.push_back(t);
}
}
// Invoke method
C *cl = dynamic_cast<c *=""> (&instance);
zinc_assert(cl);
R result = (cl->*methodPtr)(arg1);
// Package results
RPC::Parameter *r = new RPC::Parameter;
r->type = RPC::typeOf(result);
r->value = ::toString(result);
results.push_back(r);
return results;
}
// Partial template functin overload for vector result
template <typename r,="" class="" c,="" typename="" t1="">
RPC::ParamList runMethod(RPCServer &instance
, vector<r> (C::*methodPtr)(T1)
, const RPC::ParamList ¶ms
)
{
RPC::ParamList results;
zinc_assert(params.size( ) == 1);
// Convert params
T1 arg1;
zinc_assert(params[0]->type == RPC::typeOf(arg1));
::fromString(arg1, params[0]->value);
// Invoke method
C *cl = dynamic_cast<c *=""> (&instance);
zinc_assert(cl);
vector<r> result = (cl->*methodPtr)(arg1);
{ // Package results
RPC::Parameter *r = new RPC::Parameter;
r->type = RPC::ARRAY;
r->value = ::toString(result.size( ));
results.push_back(r);
vector<r>::iterator i = result.begin( );
vector<r>::iterator n = result.end( );
for (; i != n; ++i) {
r = new RPC::Parameter;
r->type = RPC::typeOf(*i);
r->value = ::toString(*i);
results.push_back(r);
}
}
return results;
}
// Partial template functin overload for vector argument & result
template <typename r,="" class="" c,="" typename="" t1,="" t2="">
RPC::ParamList runMethod(RPCServer &instance
, vector<r> (C::*methodPtr)(const vector<t1> &, const vector<t2> &)
, const RPC::ParamList ¶ms)
{
RPC::ParamList results;
vector<t1> arg1;
{ // Convert params
zinc_assert(params[0]->type == RPC::ARRAY);
unsigned int stated_size;
::fromString(stated_size, params[0]->value);
zinc_assert(params.size( ) > stated_size + 1);
T1 t;
unsigned int i;
for (i = 1; i < stated_size + 1; ++i) {
zinc_assert(params[i]->type == RPC::typeOf(t));
::fromString(t, params[i]->value);
arg1.push_back(t);
}
}
unsigned int arg2Idx;
::fromString(arg2Idx, params[0]->value);
arg2Idx += 1;
vector<t2> arg2;
{ // Convert params
zinc_assert(params[arg2Idx]->type == RPC::ARRAY);
unsigned int stated_size;
::fromString(stated_size, params[arg2Idx]->value);
zinc_assert(params.size( ) > stated_size + 1);
T2 t;
unsigned int i;
for (i = arg2Idx + 1; i < stated_size + arg2Idx + 1; ++i) {
zinc_assert(params[i]->type == RPC::typeOf(t));
::fromString(t, params[i]->value);
arg2.push_back(t);
}
}
// Invoke method
C *cl = dynamic_cast<c *=""> (&instance);
zinc_assert(cl);
vector<r> result = (cl->*methodPtr)(arg1, arg2);
{ // Package results
RPC::Parameter *r = new RPC::Parameter;
r->type = RPC::ARRAY;
r->value = ::toString(result.size( ));
results.push_back(r);
vector<r>::iterator i = result.begin( );
vector<r>::iterator n = result.end( );
for (; i != n; ++i) {
r = new RPC::Parameter;
r->type = RPC::typeOf(*i);
r->value = ::toString(*i);
results.push_back(r);
}
}
return results;
}
The following function calls are not getting resolved.It says no overload is matching.
1.
result = _server->runMethod(*this, &ClassifyDimensionServer::serverSyncDVals, params );
Where vector<dvalid> serverSyncDVals(const vector<dimensionid>&, const vector<string>&)
2.result = _server->runMethod(*this,&ClassifyDimensionServer::serverAutoGenDimension, params);
where DimensionId serverAutoGenDimension(DValId, string);
If you want complete details of each and every parameter I will be able to provide. Please let me know if there is something we need to take care of in VC60.
Is the following change correct?
//DValIds result = Client::runOnServer<dvalid>
// (*_client, *this, func, dimensionIds, dvalNames);
//' VC60 does not support explicit template arguments.
//' -Sarma - 08-Apr-2002
DValIds result = Client::runOnServer
(*_client, *this, func, dimensionIds,
dvalNames,(DValId)0);
The last argument is added as dummy argument to use all template arguments in parameters.
I shall be very thankful, if you please help me in this matter.
Thanks again,
-Sarma
|
|
|
|
|
Hello. I am stuck on my first
external function call.
Here is a short program:
// convert string to long double
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
char str1[] = "123.21";
long double _atold(const char *);
long double d = _atold(str1);
cout << d;
return 0;
}
My problem is using the _atold() library function, which is in the math.h file.
I have tried everything, and
get the link error -
unresolved external symbol "long double __cdecl _atold(char)" (?_atold@@YAOD@Z)
I would REALLY appreciate help
on this one. I could use
other methods, but I want to
get this working. Thanks
David
|
|
|
|
|
do you mean the function which convert a string to a double variable? It's atof().
example:
#include <stdio.h>
#include <strlib.h>
.....
char s[10] = "123.41"; double x;
x = atol(s);
printf("%f\n", x);
....
I didn't find any funciton defined as atold. There is atof, and atoi (to an integer) and atol (to a long value).
|
|
|
|
|
Hi Lucy,
thanks for the reply. I am learning
from The Waite Group OOP c++
just now. They require a string
be converted to Long Double,
not float, which I thought about
doing as a short cut. But here
is a clip from my math.h file:
#define _LD_COMPLEX_DEFINED
#endif
long double __cdecl acosl(long double);
long double __cdecl asinl(long double);
long double __cdecl atanl(long double);
long double __cdecl atan2l(long double, long double);
long double __cdecl _atold(const char *);
and at the bottom is _atold().
How can I use this?
char s[7] = "123.21"; long double d;
d = _atold(s);
cout << d;
This way, I get the error, undeclared identifier (_atold).
Thanks.
|
|
|
|
|
The function _atold() is defined only if you are compiling for _M_M68K (Mot. 68K)
is defined. Use atof()!
"Dirty hands lead to important discovery..." - Thomas Edison
|
|
|
|
|
Thanks Ernest,
but can I ask, how would one
convert a string to long double?
Would I need to use atof(), then
use a static cast to ld? I would
think there is a direct method.
Thanks for your help.
David
|
|
|
|
|
according to MS document, long double is equal to double. and atof() will convert a string to double. I think this is what you want for the assignment?
|
|
|
|
|
atof function does return a double value.
Try this ...
#include <stdlib.h>
#include <stdio.h>
#include <isostream.h>
using namespace std;
int main()
{
char str1[] = "123.21";
double d = atof(str1);
cout << d;
return 0;
}
|
|
|
|
|
thanks all. Very much appreciated.
|
|
|
|
|
does anyone knows how to use ScrollWindowEx?
c++ : my dream
|
|
|
|
|
Nope..no one uses ScrollWindowEx anymore...
I'm afraid your going to have to be more specific than that...
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I want to use the ScrollWindowEx to animate window, when scrolling.
i mean I can't use ScrollwindowEx do the same thing that scrollwindow do, if i change the last parameter to SW_SMOOTHSCROLL. it can't update the region scrolled.why not have a try? you can test the following code inyou application.
...
CRect rcClient;
GetClientRect(&rcClient);
ScrollwindowEx(100,0, &rcClient, &rcClient, NULL,NULL, SW_SMOOTHSCROLL);
...
c++ : my dream
|
|
|
|
|
Hi all,
This is my first post; I'm new to C++ so go easy on me.
I have two classes; and their functions include code that refer to the other:
i.e: Class X has code that uses a variable/function from Class Y and vice-versa. The classes are completely different, so it would not help to derive one off the other.
In Header.h:
------------------------------------------------------------
class X {
public:
int myint;
void doit(void);
};
void X::doit(void) {
printf("CY.myint = %i", CY.myint);
}
class Y {
public:
int myint;
void doit(void);
};
void Y::doit(void) {
printf("CX.myint = %i", CX.myint);
}
------------------------------------------------------------
In Main.CPP:
------------------------------------------------------------
#include "stdio.h"
#include "Header.h"
int main(void) {
class X CX;
class Y CY;
CX.myint = 100;
CY.myint = 200;
CX.doit();
CY.doit();
return 1;
}
------------------------------------------------------------
How can I get these classes to work together?
I can't put an 'extern class Y' before the 'class X' declaration, so how can I let the compiler know that the other class exists and will be declared?
Thanks!
Mike
|
|
|
|
|
Xds wrote:
int main(void)
{
class X CX;
class Y CY;
CX.myint = 100;
CY.myint = 200;
CX.doit();
CY.doit();
return 1;
}
I'm not sure about this but isn't it "wrong" to write 'class X CX'?
Isn't 'X CX' the right way!?
I can be wrong!!!!!!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Pretty sure it works either way, but in any case, that's not the problem.
Thanks!
Mike
|
|
|
|
|
You need to use a forward declaration of the class.
class Y ;
class X
{
void DoIt(Y& y) ;
} ;
class Y
{
} ;
You also cannot print out the content of CY in CX unless you pass a reference / pointer / copy of the object you want to print in as a parameter. The CX in main does not know anything about the CY:
#include "stdio.h"
#include "Header.h"
int main(void)
{
X CX;
Y CY;
CX.myint = 100;
CY.myint = 200;
CX.doit(CY);
CY.doit();
return 1;
}
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
That code wont't compile because in your doit methods you reference hard-coded instances.
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
Do you know an activex control able to show .gif files?
rechi
|
|
|
|
|
first, you need a GIF/LZW license. see www.unisys.com.
-c
"What the hell are you getting so upset about? I thought you didn't believe in God".
"I don't," she sobbed, bursting violently into tears, "but the God I don't believe in is a good God, a just God, a merciful God. He's not the mean and stupid God you make Him out to be".
-- Joseph Heller
Smaller Animals Software, Inc.
|
|
|
|
|
Use image.ocx...
Regards...
A couple of month agou in MSDN magazine, Paul Dilascia wrote a class for display those type of files....
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I'm pretty sure there is an article here on CP about that!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|