what is forwarding function
Hi all:
I read a document. it says "Forwarding functions are to be inline.". what is
forwarding function.
thanks so much for answering.
win Tag: how to create a precompiled head file in VC Tag: 236294
Link time error
Linking...
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "class std::basic_ostream
<char,struct std::char_traits<char> > & __cdecl std::endl(class
std::basic_ostream<char,struct std::char_traits<char> > &)" (?
endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@
@1@AAV21@@Z) already defined in neoengine_static_debug.lib(core.obj)
(more but truncated)
Look like there is a conflict between threading models selected in my
application... does anyone know which switch I have to set?
Thanks
Jack Tag: how to create a precompiled head file in VC Tag: 236293
Complete Tutorial or Sample of MSLU
Dear All,
I wrote a Unicode Program with VC2003 on WinXP, I want my program to support
Win98 also. So, I find document and I know that MSLU can be my solution.
But I think it is not so easy for me. Therefore, I am seeking tutorial
document to teach me.
Does anyone know where can I get it?
Thanks.
Kevin Tang. Tag: how to create a precompiled head file in VC Tag: 236291
Size of int (once again, sorry)
Hi, sorry about the multiple posting, technical difficulties....
-----
What does exactly the size of the int datatype depends in C++?
Recenlty I've heard that it depends on the machine's type, i.e. on 16-bit
machines it's 16 bit, on 32-bit machines it's 32 etc.
Is this true? Is this true for _all_ C++ compilers? Tag: how to create a precompiled head file in VC Tag: 236288
typeid problem
hi, all:
I have a piece code like following:
list<Primitive*> m_primitiveList; //declared in head file
list<Primitive*>::iterator iter;
I have 2 classes inherited from primitive: Ellipse and Rectangle. then I
displayed primitive information from this list.
for(iter = m_primitiveList.begin(); iter != m_primitiveList.end(); iter++)
{
cout << "Primitive " << pos++ << ": " << typeid(**iter).name() <<
endl;
}
the output of these piece of code as follows:
Primitive 1: 7Ellipse
Primitive 2: 9Rectangle
I don't know why there is the number in the front of the class name?
thanks so much for answering.
win Tag: how to create a precompiled head file in VC Tag: 236287
'foo2' is correct in C++
Hello all,
I need to code a program where a function pointer '*fun1' is delivered as
input of function 'foo1'.
In standard C, 'foo1' is correct but foo2 gives the same result without
syntax error. I don't know whether 'foo2' is correct in C++.
Thank you for reading through it all and trying to help!
Gang-Gyoo JIN
-----------------------------------------
#include <stdio.h>
#include <math.h>
void foo1(float &x, float (*fun)(float x)){
x= x+(*fun)(x);
}
void foo2(float &x, float fun(float x)){
x= x+fun(x);
}
float fun1(float x){
return exp(-x);
}
void main(){
float x1= 0.0, x2= 0.0;
for(int j= 0; j < 10; j++) {
foo1(x1, fun1);
foo2(x2, fun1);
x1+= 0.1;
x2+= 0.1;
printf("%f %f\n",x1,x2);
}
} Tag: how to create a precompiled head file in VC Tag: 236274
combo box default value
I am using a combo box . It functions except it does not come up with the
top value of the list to be inside the visible rectangle area, that area is
blank. Can someone tell me how to have the top value appear in the combo
box? Tag: how to create a precompiled head file in VC Tag: 236272
Minimum pane size in a CSplitterWnd
Hello all,
I am using a CSplitterWnd. I would like to prevent the user from dragging
the splitter any closer than a certain distance from the edge of the window.
I found that CSplitterWnd::SetRowInfo() and CSplitterWnd::SetColInfo() allow
you to set a "minimum" size. However, it's not the case that the user can't
drag the splitter past this minimum. It's just that if he does so drag the
splitter, the window size will become 0.
Is there a way to do what I wish and pysically disallow the splitter to move
past a certain point?
Thanks,
Dave Tag: how to create a precompiled head file in VC Tag: 236263
problem with link list
Hello,
I'm using a CList in order to hold structure into a list. When I need to
read the very next node (next structure within the list) I see pointer value
changes but l I still see same information in previous node or stucture.
Any suggestions?
Thanks,
Smith
here is sample:
typedef struct pMyStruct{
LONG field0;
CString field1;
CString field2;
CString field3;
CString field4;
} pMyStruct;
POSITION pos = MyList.GetHeadPosition();
while(pos)
{
MyList.GetNext(pos);
AfxMessageBox(pMyStruct->field2);
} Tag: how to create a precompiled head file in VC Tag: 236248
Multiple threads using COM
I'm writing an ATL service which creates a COM object that is accessed from
two separate threads. I call CoInitialize before I call CreateInstance, when
I call CoInitializeEx and pass MULTITHREADED, I am unable to use the COM
object although CreateInstance returns S_OK.
The problem is when I create the second thread and try to use the shared COM
object (using critical sections), it fails, and I donâ??t know how to fix it.
How can I have two threads use the COM object?
Thanks
Mark Tag: how to create a precompiled head file in VC Tag: 236243
Unsatisfied forward declaration?
If I BUILD the code below, all works fine. But if I REBUILD the solution
at any time, the following errors are found in the WrapperCOMEXE.idl:
1) error MIDL2337 : unsatisfied forward declaration :
IQBEventCallBack
[Coclass 'MyWrapper' ] --> This error occurs within the
MyWrapper Coclass
definition at the line that reads: "[default] interface
IQBEventCallBack;"
2) warning MIDL2015 : failed to load tlb in importlib: :
sdkevent.dll -->
This warning occurs in the importlib statement that reads:
"importlib("sdkevent.dll");".
Here's the WrapperCOMEXE.idl code:
// EventWrapperCOMEXE.idl : IDL source for EventWrapperCOMEXE
//
// This file will be processed by the MIDL tool to
// produce the type library (EventWrapperCOMEXE.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
uuid(EFA60AF9-9F1E-4F2F-9AE2-1DFDCF7721F5),
version(1.0),
helpstring("EventWrapperCOMEXE 1.0 Type Library")
]
library EventWrapperCOMEXELib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("sdkevent.dll");
[
uuid(3892EADE-FB47-4C18-B296-F91035CE95BF),
helpstring("EventWrapperCOM Class")
]
coclass EventWrapperCOM
{
[default] interface IEventWrapperCOM;
};
};
Please help!
Mervin Williams Tag: how to create a precompiled head file in VC Tag: 236242
Binary searching
Hi,
I try to implement the following in C:
My application receives a buffer that is of type BYTE* and is filled with
both ANSI strings and binary content in between. Now, the problem is, that I
want to search for specific patterns in this buffer - _lsearch does this just
perfectly well.
Now, as the buffer also 'contains' strings (of course not in that format,
but by content) I want to do both case sensitive and case insensitive
searching on that.
As the buffer might contain NULL values I cannot use any typical string
function. Any ideas how to do that in a different way?
Thanks a lot
Peter Tag: how to create a precompiled head file in VC Tag: 236239
Ternary Search Trees
In making a ternary search tree to identify as fast as possible the type of
word passed in to the algorithm, for instance sp_help -> 1 (procedures),
select -> 2 (keywords), sysobjects -> 3 (system tables), I'm stuck on
deciding what type of comparison happens at each node.
Has anyone got any suggestions?
Do you think for the first level I could compare just the first characters
of the word passed in and the word at the 'current' node, or would it be more
likely to be a whole word comparison for each node?
If it would be a whole word comparison, what form would this take for best
performance?
Bearing in mind that each word will only ever return the same type, but more
than one word will have a certain type (i.e. the type will not be unique, but
the word will.) Tag: how to create a precompiled head file in VC Tag: 236236
sqrt() not working
Hi, I have the following code sample:
t = sqrt(discrim);
where discrim is equal 4. However, instead of returning 2 it will return an
incredibly large number or -1.n#IND00000000...
Any help would be greatly appreciated.
Sincerley,
Keith La Force Tag: how to create a precompiled head file in VC Tag: 236235
who has the EBook <windows internals>?
please send to : sjtuhuang@163.com
I was look for it's pdf for a long time
thanks Tag: how to create a precompiled head file in VC Tag: 236233
Can't determine cause of heap corruption or orphaned lock using cdb
Greetings,
I posted on this issue before, in a more complex environment, and
thought I had resolved what appeared to be an orphaned lock or heap
corruption in my application by removing a call to TerminateThread().
You can see the original thread here:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&safe=off&threadm=f867e9d7.0407151302.7f0882eb%40posting.google.com&rnum=2&prev=/groups%3Fq%3Dmarc%2Belliott%2Bpush%2Bdirection%26hl%3Den%26lr%3D%26ie%3DUTF-8%26c2coff%3D1%26safe%3Doff%26selm%3Df867e9d7.0407151302.7f0882eb%2540posting.google.com%26rnum%3D2
However, I am still experiencing this issue. When I launch my app
(particularly one which does a high number of calls to CreateProcess()
and creates runner threads for stdin/stdout/stderr the process hangs
or (more rarely) faults on closing Invalid Handle or something
similar. Sometimes I will get this problem after a single call to
CreateProcess().
I've been through the process spawning code a million times, but I
don't see anything untoward. I've enabled full page heap and the lock
verification layer, and although app verifier throws exceptions in
places that appear to be during access to invalid handles, etc, I
don't see anything otherwise meaningful and there are times where the
process still hangs and AppVerifier doesn't seem to notice anything's
wrong at all.
Question: What can I do to better isolate the problem using these
tools? I am able to repro on Win2K3, so I have access to the latest
AppVerifier switches, but am at a loss as to what usefulness I can get
out of them at this point.
Further details: This issue only appears on SMP boxes, and I have only
had success repro'ing it when multiple instances of the process are
running simultaenously. Whether that indicates some resource
contention or simply increases the statistical likelihood of the error
appearing is unclear.
Any suggestions from the cdb/windbg masters are heartily welcomed!
Regards,
Marc Tag: how to create a precompiled head file in VC Tag: 236231
Which memory allocator to use?
Hello all,
needing to allocate a large number of buffers (let's say 20.000 buffers of
sizes between 8 and 200 bytes), which method would you recommend:
1. malloc (slow from my tests)
2. dlmalloc (Doug Lea's malloc replacement)
3. other
Since there are so many ways to alloc buffers, which is the one you would
recommend in terms of performance (e.g. GlobalAlloc, LocalAlloc, IMalloc,
malloc etc.)
If your solution is a custom memory allocator, I need it to work on Win32
(e.g. Win9x included). I've done tests with dlmalloc and it seems pretty
fast. Perhaps an experience/advice of using it in the real-world would help.
Thanks.
Regards,
George Ionescu Tag: how to create a precompiled head file in VC Tag: 236229
Error parser for running make
I have an 'Extern Tool' that I use to run a gcc makefile from inside
of MSDEV 7.0
I am able to click on an error line and have the offending file
brought up in the editor, but I would like to be able to show the
errors in red.
Is there a way to modify this in msdev? Tag: how to create a precompiled head file in VC Tag: 236228
Toolbar button Text is not appearing
I have am MDI application I added a CToolBar object . I addd buttons to it
. but the SetButtonText function does not place the caption on that
buttons..
the code is below
m_wndToolBar.ModifyStyle(0, TBSTYLE_FLAT | TBSTYLE_TRANSPARENT);
m_wndToolBar.SetButtons(NULL, 9);
m_wndToolBar.SetButtonInfo(0, ID_TOOLBAR_TXTCHAT , TBSTYLE_BUTTON, 0);
m_wndToolBar.SetButtonText(0, LPCSTR("Test"));
Regards
Tony Tag: how to create a precompiled head file in VC Tag: 236226
__event fail when in precompiled header
In native C++
here is stdafx.h
#pragma once
#include <iostream>
#include <tchar.h>
[ event_source( native, optimize = speed, decorate = false ) ]
class CSourceToto
{
public:
__event void MyEvent(int nValue);
};
and main.cpp using precompiled header
#include "stdafx.h"
[event_source(native)]
class CSource
{
public:
__event void MyEvent(int nValue);
};
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
I got these errors !
main.cpp(11) : error C2011: '__EventingCriticalSectionStub' : 'struct' type
redefinition
main.cpp(11) : see declaration of '__EventingCriticalSectionStub'
main.cpp(11) : error C2953: '__eventingGetAddr' : template class has already
been defined
etc...
Anyone know how to solve this ? Tag: how to create a precompiled head file in VC Tag: 236225
accesing low level routines disk with vc++2005 express
Hello! I've done a small application in tasm, but I would like to migrate it
to VC++ 2005. I've got a problem, could I read/write in the floppy disk
using BIOS routines? And how?
I think something like:
asm {
mov ax,??
int ?? bios function
}
Could I do that with vc++ 2005 express ed.?
Thanks. Tag: how to create a precompiled head file in VC Tag: 236221
array of struct
Hello,
How can I create an array of structure ? the struct will be holding the
results of a query. any link or example ?
Thanks,
Smith Tag: how to create a precompiled head file in VC Tag: 236215
SetTimer / static pointer
Hi All,
Two questions.. one about SetTimer and the other one about a static
pointer....
I have a problem w/ the CWnd::SetTimer function. Maybe someone can give me
an insight. This question regards a Windows CE [3.0] device:
Let's say I have a timer running in my main dialog window started by
"SetTimer(ID, .. etc)" .. then, I display modally a new window on top of the
main one. In this one, I start a new timer by the same function
"SetTimer(ID, ...") where the ID of this timer in this newly displayed
window is different than the ID from the main window (even though the
documentation says that the IDs can be the same given that these timers are
ran in two different windows... but just to make sure.) What happens is that
sometimes the timer from the second window quits working (no WM_TIMER
message is generated for that window) IF the timeout values of the two
timers are the same. If they are different by even 2ms, the problem never
occurs but if they are the same, the problem can almost always be
reproduced. The weird thing is that if I start a 3rd timer, on a 3rd window
displayed modally, then the 2nd timer may start firing as well (this 3rd
timer would have a different timeout value than the other two), but as soon
as I kill this third timer, then the 2nd timer dies again...Note that the
SetTimer functions return success in all cases [for all 3 timers.]... Has
anyone experienced a problem like this ?
The second questions is this:
In a certain class, in the header file I have:
static CSomeObject* c_pTheObject();
Implemented as:
CSomeObject* TheClass::c_pTheObject()
{
static CSomeObject* pKeyPad = new CSomeObject;
return pKeyPad;
}
This is really simulating a "static" object which I want to make sure it is
actually created before I use it so whenever I need it (maybe in different
translation unit) I do something like:
TheClass::c_pTheObject()->SomeMethod(); this way, if the object is not
already created, then it is created before being used... if it is, it just
returns a pointer to the already existing object so everything is ok...
When deallocating it, I do something like:
delete TheClass::c_pTheObject();
Is this correct ?
I am thinking that using c_pTheObject() will return me a pointer to the
already existing object (as described above) and the delete statement will
delete the object that the pointer points to... I tested this approach by
checking if the destructor of the CSomeObject is being called when calling
the delete TheClass::c_pTheObject() and indeed it is called...
Thanks for any tips/suggestions. Tag: how to create a precompiled head file in VC Tag: 236211
HOWTO?: Function Pointer to Instance Member
Hello,
I need to form a function pointer to a function in an instance of a
class. The docs say that the way to call a member function from outside the
class is:
void (A::*p4)() = &A::f;
But doesn't that require the function to be Static? I would like to be able
to use an instance function.
Further, is it possible to make the function pointer so that its declaration
does not have to specify the class of the function I wish to call - can it
specify only the return type and parameter list?
I know this is complicated, thank you for reading through it all and trying
to help!
Thanks,
Rich
PS. The reason I want to make a pointer to an instance member is so that I
can call this function in a variety of different objects, generically. Tag: how to create a precompiled head file in VC Tag: 236204
Errors rebuilding solution
I am running into errors when I attempt to rebuild a project. To test,
download
and unzip this zip file (download DotNetEvents.zip to your PC from this
link:
https://developer.intuit.com/QuickBooksSDK/Resources/Samples.asp?id=96#DotNetEvents%20(VB.NET)%20(qbfc)%20(desktop)
to your machine (say to your Desktop) and add
the solution file to VS.NET 2003.
If you BUILD the solution, all works fine. But if you REBUILD the solution
at any time, the following errors are found in the WrapperCOMEXE.idl:
1) error MIDL2337 : unsatisfied forward declaration : IQBEventCallBack
[Coclass 'MyWrapper' ] --> This error occurs within the MyWrapper Coclass
definition at the line that reads: "[default] interface IQBEventCallBack;"
2) warning MIDL2015 : failed to load tlb in importlib: : sdkevent.dll -->
This warning occurs in the importlib statement that reads:
"importlib("sdkevent.dll");".
Any help would be greatly appreciated!
Thanks,
Mervin Williams Tag: how to create a precompiled head file in VC Tag: 236199
Problem returning string from DLL function
I have a function in a DLL which returns a std::string -
When I call it from my main program I'm getting exceptions after the call to
the function saying that the heap is broken.
I seem to remember a long time ago reading that there were problems sharing
STL objects between a main program and a DLL but I though this had been
fixed in vc.net 2003.
Is it likely that having a std::string as the return type of my function in
the DLL is the problem, and if so is there anything I can do to make it
work? Tag: how to create a precompiled head file in VC Tag: 236186
newbee: trouble w/ try{} catch{}
There is a tool that we use here at work. The guy that wrote it has since
quit and I was asked if I would like to take it over (I'm learning to
program and the co. supports that) with that said, the code is really messy
and rather than fix ir "correct" i have started to design a new version from
the ground up, I am still responsible for keeping the old one running until
I roll out the new one.
OK, so I have a crash that happens randomly and I have asked the people here
to send me their logs when they crash, I have narrowed it down to one
operation and I don't understand why it's happening. I just thought I could
wrap it in a try/catch and handle it from there.
Here is the code:
inline byte GetRecordTypeId(void* pV)
{
if(pV)
{
try
{
return *(byte*)pV;
}
catch(char* e)
{
theLog.WriteError(e, __FILE__, __LINE__);
}
}
return kRecordTypeUndefined;
}
However, this appears to do nothing. It still crashes just the same as if
there was no try block. From what I understand, the above code should have
worked fine. What am I missing?
For testing purpose I forced a crash in the code by setting the void* to an
int (pV = (void*)someInt;)
Any help or suggestions would be great.
Thanks! Tag: how to create a precompiled head file in VC Tag: 236167
Pixel location utility needed
Hello all,
Can anybody point me to a utility that will tell me the (x, y) coordinates
of the pixel pointed to by my mouse?
Thanks,
Dave Tag: how to create a precompiled head file in VC Tag: 236166
Visual C++ 6 and API
Hello.
Im from Chile and speak a little english, my question is how insert a
progressbar in an item of list-view using only API of Windows
(CreateWindowEx()...etc.).
Show me the source code or link to the page with the source code.
Thank you.
PD: I post this question in the LATAM Newsgroup, but without answers Tag: how to create a precompiled head file in VC Tag: 236163
method hiding
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C4A53A.DFC9D850
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
The 4th line in my main method in the code below does not compile.
Isn't there a way to overload a base class method in the derived class =
in C++?
I know C#, java and VB.NET allow this.
TIA
Sankar Nemani
class B
{
public:
void foo(){}
=20
};
class D: public B
{
public:
void foo(int i){}
};
void main()
{
B *b =3D new B();
D *d =3D new D();
b->foo();
d->foo(); //does not compile
}
------=_NextPart_000_0008_01C4A53A.DFC9D850
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.3790.186" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>The 4th line in my main method in the =
code below=20
does not compile.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Isn't there a way to overload a base =
class method=20
in the derived class in C++?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I know C#, java and VB.NET allow=20
this.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>TIA</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Sankar Nemani</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>class B<BR>{<BR>public:<BR> void=20
foo(){}<BR> <BR>};</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>class D: public =
B<BR>{<BR>public:<BR> void=20
foo(int i){}<BR>};</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>void main()<BR>{<BR> B *b =3D new=20
B();<BR> D *d =3D new=20
D();<BR> b->foo();<BR> <STRONG>d->foo(); //does not=20
compile<BR></STRONG>}</FONT></DIV></BODY></HTML>
------=_NextPart_000_0008_01C4A53A.DFC9D850-- Tag: how to create a precompiled head file in VC Tag: 236159
forcing malloc to use high addresses
Is there a way to force the malloc in VC++ 2003 to use addresses
above 0x12000000 for virtual memory ?
You dont want to know why. It has to do with fortran common
blocks.
Thanks,
Lynn Tag: how to create a precompiled head file in VC Tag: 236153
integer pointer values..convert to char
This is a multi-part message in MIME format.
------=_NextPart_000_0345_01C4A597.F923BC50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
i have a doubt..
if i have a integer pointer of 2 bytes and i want to fetch values of 1 =
byte 1 byte pointer incrementation is=20
possible???
ie operating like the character pointer??
--
------=_NextPart_000_0345_01C4A597.F923BC50
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>i have a doubt..</FONT></DIV>
<DIV><FONT size=3D2>if i have a integer pointer of 2 bytes and i want to =
fetch=20
values of 1 byte 1 byte pointer incrementation is </FONT></DIV>
<DIV><FONT size=3D2>possible???</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>ie operating like the character =
pointer??</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- =
</FONT></DIV></BODY></HTML>
------=_NextPart_000_0345_01C4A597.F923BC50-- Tag: how to create a precompiled head file in VC Tag: 236150
#pragma inside #define
Is there any way to put a pragma inside a #define?
I want to turn off function inlining for strlen, so something like
==============
#define STRLEN(x) \
#pragma optimize( "i", off )\
_tcsclen((x))\
#pragma optimize( "", on )
==============
would be nice, is there any way to do this kind of thing? Tag: how to create a precompiled head file in VC Tag: 236149
Want a function just like SetThreadLocale()!
Hi!
I want different String Table display in my projection.for example: If I
choose English String Table using English,if I choose Chinese String Table
using Chinese.So I make 3 String Table(English,Chinese,Japanese).
I write those code:
int iLang = 0;
switch(LanguageT)
{
case 0:
{
iLang = MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED),
SORT_DEFAULT);
SetThreadLocale (iLang);
}
break;
case 1:
{
iLang = MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_CHINESE_JAPANESE),
SORT_DEFAULT);
SetThreadLocale (iLang);
}
break;
case 2:
{
iLang = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_CHINESE_SIMPLIFIED),
SORT_DEFAULT);
SetThreadLocale (iLang);
}
break;
}
it's run natural, but the function SetThreadLocale() can't be used in win98
,is there any other function like SetThreadLocale() to solve this question?
Thanks in advance! Tag: how to create a precompiled head file in VC Tag: 236136
How to set images for CListCtrl subutems?
Hi,
is it possible to display an image from a CImageList
beneath a SubItem of a CListCtrl? All the documentation
I scanned just seems to speak of images in the first
column of a CListCtrl. But I want to have images for
SubItems, i.e. in the second, third etc. column of the
CListCtrl.
This --
LVITEM item2;
item2.mask = LVIF_TEXT | LVIF_IMAGE;
item2.iItem = iItem;
item2.iSubItem = 1;
item2.pszText = _T("Second column text");
item2.iImage = 2; // image #3 from CImageList
m_ctrlList.SetItem(&item2); // InsertItem was done before
-- doesn't seem to work! No image in the second column
(iSubItem==1).
Any help?
Tony Tag: how to create a precompiled head file in VC Tag: 236133
template friend function and LNK2019 errors
With VC++ .NET2003 I'm getting LNK2019 errors that I did not get with VC++ 6.
Specifically, I get the error for template functions declared as friends of
a class template. I have a feeling this is due to the new C++ conformance of
.NET2003, but I've yet been able to find information to correct my syntax.
Can someone please help. The relevant (I hope) code follows:
namespace string_t
{
template <class T>
class StringT
{
public:
friend StringT<T> operator + (const T * pszString, const StringT<T> &
String);
};
template <typename T>
StringT<T> operator + (const T * pszString, const StringT<T> & String)
{
StringT<T> Result;
return Result;
}
template class StringT<char>;
} // end namespace string_t
using string_t::StringT;
typedef StringT<char> String;
int _tmain(int argc, _TCHAR* argv[])
{
String First;
String Second;
Second = "String constant " + First;
return 0;
}
Thanks,
Brian Tag: how to create a precompiled head file in VC Tag: 236128
how to export this function?
hi, all
I wrote a dll, but , it does not work correctly.
I created a Regular DLL using shared MFC DLL in vc6 and exprots one function
// in mydll.cpp
CString __cdecl GetStringCode(CString str1, CString str2);
CString __cdecl GetStringCode(CString str1, CString str2)
{
//code.....
CString strRet = ........
return strRet;
}
// in mydll.def file
EXPORTS
; Explicit exports can go here
GetStringCode @1
// ----- Use it in another Dialog Based app
typedef CString (FAR __cdecl *PGetStringCode)(CString str1,CString str2);
HMODULE hLibrary;
hLibrary = LoadLibrary("win98type.dll");
if(hLibrary != NULL)
{
PGetStringCode pGetSC = (PGetStringCode)GetProcAddress(hLibrary,
"GetStringCode");
if(pGetSC != NULL)
{
CString str = pGetSC("1","2");
//Here, I debugged into the mydll, int function
GetStringCode(str1, str2), the str1="2" , str2="", this is not right.
FreeLibrary(hLibrary);
}
}
So how to export this function? What is wrong here?
Thanks Tag: how to create a precompiled head file in VC Tag: 236124
VC 7.2
I'm seeing references to VC 7.2 for the first time. What is this? Is it
7.1 with a service pack??? Tag: how to create a precompiled head file in VC Tag: 236119
using VC6 libs with VC7.1
Hi,
I got a problem here.
I have some libs compiled under VC6. I am trying to link to them using
.NET which has VC7.1. But I have the following linking errors:
error LNK2005: "public: __thiscall std::locale::locale(void)"
(??0locale@std@@QAE@XZ) already defined in
SOMEFILE.lib(SOMEOTHERFILE.obj)
error LNK2019: unresolved external symbol "void __cdecl
std::_Xlen(void)" (?_Xlen@std@@YAXXZ) referenced in function _$E30
error LNK2001: unresolved external symbol "void __cdecl
std::_Xran(void)" (?_Xran@std@@YAXXZ)
error LNK2001: unresolved external symbol "void __cdecl
std::_Xran(void)" (?_Xran@std@@YAXXZ)
From reading the web, it seems the errors are due to the compatability
between VC6 and VC7. The fundamental problem here is I don't have
access to sources and have access only to the VC6 libs.
Is there any workaround/solution to solve this problem?
Thanks a lot. Tag: how to create a precompiled head file in VC Tag: 236116
_CrtCheckMemory()
Hello all,
I would like to call _CrtCheckMemory() from a watch windows in VC++ 6.0.
However, it complains that the symbol is not found.
What do I need to do to make it possible to call this function and see its
output in the watch window?
Thanks,
Dave Tag: how to create a precompiled head file in VC Tag: 236113
const int
Hi group,
I got an error as :
error C2440: 'initializing' : cannot convert from 'const int' to 'struct
CFG_DATA_ELEMENT'
and it was becuase of not having "*" after CFG_DATA_ELEMENT.
Tha question is why the compiler points to a data type as "const int"! where
does this const int come from?
Can you explain this to me please?
Thanks,
JSmith Tag: how to create a precompiled head file in VC Tag: 236106
Strange behaviour of linker (vc++)
Hi,
I'm using visual studio 2003.
I have one workspace consisting of several projects (resulting in static
libs) and one project giving me an executable (this one depends on all
the other projects).
Now i've got one project that just has one c++ file like this:
-----
static int foo = somesingleton::instance().dosomething();
some other functions();
------
Neither my executable nor any other of the libs reference anything in
this c++ file.
Now my problem is that the linker does for some reason not link said
file into my binary. The static initialisation never happens.
If, however, I do reference something else from this file in some other
place then it gets linked in. To me it looks like the Linker tries to
get rid of unneeded symbols and does a horrible job at this (since this
symbol _is_ needed).
Any ideas on how to fix this? I do not want to reference anything from
this file in any of my other files, i just want to have it linked into
my executable.
I do not want to add autostart hacks to the crt.
kind regards Philip Tag: how to create a precompiled head file in VC Tag: 236085
Can objects have properties?
I'm using VC++ v8 beta. Haven't used VC++ for many years, v4.
Can I create properties in a plain old class (non-visual)? I've been
using Borland C++ Builder for many years. There, one can create
public properties with setter/getter functions that can set/get a
private variable as well as execute additional code which may change
the state of the object.
Thanks,
- Arnie Tag: how to create a precompiled head file in VC Tag: 236071
Template function parameters
I am trying to create a Template function that will take
differnet parameter types. However all my attempts have failed
can someone please tell me what I am doing wrong here is the code.
It seems to work when I pass integers however will not compile when
I have a float or double
I get this error when compiling
initializing : cannot convert from 'unsigned short *' to 'double'
I do not understand why it has unsigned short when I am passing
a double for the intData parameters
//function prototype
template <class Z>void StoreInArray(VARIANT* arr_rgElems,const
inDataType, Z inData, int intPosition);
//Test Calling this works
strcpy (strAsterisk, "*");
strTemp = A2BSTR(strAsterisk);
StoreInArray(rgElems,VT_BSTR, strTemp, intCounter++);
//this works
StoreInArray(rgElems,VT_I2, 99, intCounter++);
//I tried different many differnet ways but always get
//the same type of error when compiling
double tempX = 8.99
StoreInArray<double>(rgElems,VT_R8, tempX, intCounter++);
StoreInArray<double>(rgElems,VT_R8, (double)tempX, intCounter++);
StoreInArray(rgElems,VT_R8, (double)tempX, intCounter++);
//function
template <class Z> void StoreInArray(VARIANT* arr_rgElems,const
inDataType, Z inData, int intPosition){
COleDateTime myDateTime;
double douInData = inData;
VariantInit(&arr_rgElems[intPosition]);
arr_rgElems[intPosition].vt = inDataType;
switch (inDataType) {
case VT_BSTR:
arr_rgElems[intPosition].bstrVal = (BSTR) inData;
break;
case VT_I2:
arr_rgElems[intPosition].intVal = (int)inData;
break;
case VT_I4:
arr_rgElems[intPosition].intVal = (long)inData;
break;
case VT_R4:
arr_rgElems[intPosition].fltVal = (float)inData;
break;
case VT_R8:
arr_rgElems[intPosition].dblVal = (double)inData;
break;
case VT_DATE:
myDateTime = (time_t) *(long*)inData;
arr_rgElems[intPosition].date = (DATE)myDateTime;
break;
default:
break;
}
}
Thanks
nevlis Tag: how to create a precompiled head file in VC Tag: 236070
Excel Automation
Hi,
I'm new in Excel automation under VC++.net and I'm looking for some good
help about it.
Do you know some good web sites about it ?
as first step i would like to open an existing Excel file and to copy the
content of the 2nd sheet inside another file (that i've created before).
thanks a lot for help,
Maileen Tag: how to create a precompiled head file in VC Tag: 236068
VC7.1 compiler bug? mutable const
Hi: this is VC7.1. Could someone check VC8 beta?
int main()
{
mutable const int i = 8;
return 0;
}
c:\TEST\t6\t6\t6.cpp(11) : error C2071: 'i' : illegal storage class
so far so good... but this compiles:
template <typename T>
struct is_const
{
enum
{
value = 0
};
};
template <typename T>
struct is_const<const T>
{
enum
{
value = 1
};
};
int main()
{
int x1 = is_const< mutable const int >::value;
int x2 = is_const< const mutable int >::value;
return 0;
}
--
The set of solutions is never empty.
Two solutions together form a new problem.
-- Mycroft Holmes Tag: how to create a precompiled head file in VC Tag: 236065