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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? 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: who has the EBook <undocumented windows NT>? Tag: 236065
How to get processor serial number?
Actually, first to find out if the processor has a serial number, then if it
is accessible and if so, what is it.
Also, how to get the processor type.
All that in C++ or do I have to go to ASM?
Thanks,
David Tag: who has the EBook <undocumented windows NT>? Tag: 236054
Global variables exported from a DLL
I read an article and it says about "exporting" global variables from a DLL.
What does it mean by "global" here? Are such variables exported from a DLL
visible from its clients? What's the purpose of "exporting" so-called
"global" variables from a DLL?
Thanks for your help! Tag: who has the EBook <undocumented windows NT>? Tag: 236053
CTreeCtrl
Hi,
I want to create a Tree,but the images of tree items are not int the same
size.I only see SetItemHeight(SHORT cyHeight),but this will change all tree
items' height; This does not meet my need.I hope that the item having big
image has taller ItemHeight,the item having small image has lower
ItemHeight.Can you please help me?Thanks a lot! Tag: who has the EBook <undocumented windows NT>? Tag: 236051
Message handling tutorial
Hello all,
Could someone please kindly point me to a good online tutorial that
addresses messaging, message maps, and the like? I'm quite confused on the
different categories of messages (Windows messages, control notifications
and command messages), which classes can handle which messages, etc... I'm
looking at all of this from an MFC perspective.
Thanks!
Dave Tag: who has the EBook <undocumented windows NT>? Tag: 236049
Sharing data between Main program and DLL
I asked a question about this a few hours ago but it was perhaps a bit
vague.
What I want to do is have a main c++ program which some plug-in DLLs which
are loaded at run time using LoadLibrary/GetProcAddress.
My main program has some "global" data which I want the DLL to be able to
access. How can this be done?
What I'd like to be able to do is have a class "MyClass" which has a
function getInstance() which returns a single instance all the time. But if
I use the same class in my DLL I'd like it to return the *same* instance of
the object.
What's the best way to achive this?
Is there a better place to ask for help on this? Tag: who has the EBook <undocumented windows NT>? Tag: 236048
Formatting a number with thousand separators
Hi all..
How can I convert a CString variable that is numeric to the corresponding
string with thousand and decimal separators?
I tried this:
if( IsNumeric(sText) )
{
LPTSTR lpszNumero = new TCHAR[sText.GetLength() + 20];
_tcsxfrm(lpszNumero, sText, sText.GetLength() + 19);
TRACE("%s", lpszNumero);
delete[]lpszNumero;
}
But with no success
Thanks in advance
Jaime Tag: who has the EBook <undocumented windows NT>? Tag: 236045
Simulate CTRL key for an internet app
Hello all,
I need to simulate sending a CTRL+Z key over the internet.
A Telnet server that I am trying to connect to via the app I'm writing
needs to receive the CTRL+Z for certain functions. How do I send it?
Thanks in advance.
Rico Tag: who has the EBook <undocumented windows NT>? Tag: 236044
Building a C / C++ Browser Helper Object (BHO) for control from VB app - possible?
Hello there,
As a VB coder I have previously had experience of writing some simple C
routines and making them into dll's that I could call from my VB program.
However, I now want to do something a bit more complicated because I want to
build a Browser Helper Object. When I last looked into this a few years ago,
it was possible, but more complicated to build one of these in VB, so now I
want to ask someone else to build me one in C and then I use it.
Therefore what I want to know is, will it be easy for me to have created a
C/C++ BHO that is there to monitor the activity of Internet Explorer (or
any other browsers) and report this activity via events (or some other way)
back to VB program that is running at the same time.
For a more detailed example. Lets say I want a BHO that monitors staff
website access and when they click on webpages. Therefore with each instance
of IE, a BHO is started that does the monitoring of the browser. Each time
an event occurs, it reports the event to a VB program that is also running
in memory. In the instance that the VB program is not actually running on
the same PC, the BHO just does nothing.
Please let me know if this is a feasible scenario.
Any help greatly appreciated.
Kind regards
Dave Tag: who has the EBook <undocumented windows NT>? Tag: 236042
how to embed a emf file into another emf file?
how to embed a emf file into another emf file?Use what function?
Thanks very much.
Stone Tag: who has the EBook <undocumented windows NT>? Tag: 236041
how to embed a emf file into another emf file?
how to embed a emf file into another emf file?Use what function?
Thanks very much.
Stone Tag: who has the EBook <undocumented windows NT>? Tag: 236039
how to embed a emf file into another emf file?
how to embed a emf file into another emf file?Use what function?
Thanks very much.
Stone Tag: who has the EBook <undocumented windows NT>? Tag: 236038
DLL accessing c+ singleton object in main application
I would like a DLL which is loaded using loadlibrary to be able to access
objects in my main program.
In my main program I can do MyClass::GetInstance() to get a reference to
single instance of the class which is created as a static object in the
class. I would like to be able to get a reference to this from the DLL
too... But calling this causes me to get a different object. Tje DLL has
it's own copy of the object, and would in fact have to in order to
compile...
What is the best way to achieve what I am trying to do?
(This is with VC++2003) Tag: who has the EBook <undocumented windows NT>? Tag: 236037
Multimedia timers - Win2K v.s. WinXP
Hello,
The following timer code works on my 3 WinXP machines but the call to
"timeSetEvent" returns NULL on my Win2K machine. Is there something wrong
with my code, my Win2K machine, or my Win2K OS?
#include <stdio.h>
#include <windows.h>
bool timerFlag0 = false;
void CALLBACK timer0(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD
dw2)
{
timerFlag0 = true;
}
int main()
{
MMRESULT wTimerID;
wTimerID = timeSetEvent(5000, 0, timer0, 0, TIME_PERIODIC |
TIME_KILL_SYNCHRONOUS);
if (wTimerID == NULL)
{
printf("timeSetEvent failed\n");
return 1;
}
for (;;)
{
if (timerFlag0)
{
timerFlag0 = false;
printf("Got event\n");
}
}
return 0;
}
Thanks,
Ray Mitchell Tag: who has the EBook <undocumented windows NT>? Tag: 236031
a layer component
Hi,
I would like to create an application which uses the same technique than
HTML regarding layers.
for example, i will have a form on which i have an image (bmp, jpeg,
gif,..) as background.
On this form, I will use a component which works like a layer. It mean
that i will display some texts, other images and so on in this layer,
and when i will use scrollbar(s), all components displayed by this layer
component will move up/down or left/right.
is there a such component available in VS.net ?
thanks a lot,
Maileen Tag: who has the EBook <undocumented windows NT>? Tag: 236027
GetProcAddress with symbol length of 62 = RtlFreeHeap invalid address.
Whenever my .exe opens itself as a library, and tries to GetProcAddress with a
symbol length of 62 I receive the following:
HEAP[contest.exe]: Invalid Address specified to RtlFreeHeap( 00140000,
0012F700 )
Unhandled exception at 0x77f767cd in contest.exe: User breakpoint.
It only happens with the 62 char length symbol. Why is this happening? Is it
only my system? Can someone confirm that it happens on their system as well?
(run in Debug mode in VC++ or under gdb)
----
#include <stdio.h>
#include <windows.h>
typedef int (*MYPROC)(LPTSTR);
VOID doIT(HINSTANCE hinstLib, LPCSTR str) {
MYPROC ProcAdd;
printf( "TRY: %d %s\n", strlen(str), str);
ProcAdd = (MYPROC) GetProcAddress(hinstLib, str);
printf( "RES: %d\n", ProcAdd );
}
int main(int argc, const char* argv[])
{
HINSTANCE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
int i;
char self[1024];
strcpy(self, argv[0]);
if (strstr(self, ".exe") == NULL)
strcat(self, ".exe");
hinstLib = LoadLibrary(self);
if (hinstLib != NULL)
{
char buf[100];
for (i = 0; i < 100; i++)
buf[i] = 'A';
for (i = 1; i < 75; i++) {
buf[i-1] = 'A';
buf[i] = '\0';
doIT(hinstLib, buf);
}
fFreeResult = FreeLibrary(hinstLib);
}
} Tag: who has the EBook <undocumented windows NT>? Tag: 236026