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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct Tag: 236124
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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct 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: array of struct Tag: 236042
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: array of struct Tag: 236037
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: array of struct 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: array of struct Tag: 236026
where can I get mfc42.cab most new version?
where can I get mfc42.cab most new version?
I have update my vs6 by install sp6 of vs6. Now my mfc42.dll's version is
6.0.9782.0. Then I develop an activex control.
where can I get mfc42.cab most new version?
Now I need to download my control to client by embed it in webpage as well
as mfc42.cab.I got mfc42.cab
from http://activex.microsoft.com/controls/vc/mfc42.cab. I unpack it and
check,find
its mfc42's version is 6.0.8665.0 .
Where can I get the newest mfc42.cab ? What 's your advice ? Thank you very
much. Tag: array of struct Tag: 236022
snmpmgrrequest help needed ??. Please Advice
Hi,
I am new to VC and am developing a simple query tool.
I am worjing on windows using vc++ 6.0.
I want to query some oids in a remote machine using snmp.
i just went through msdn. i saw some API's like snmpmgropen,
snmpmgrrequest snmputilmemalloc ...
I am finding it very difficult to write a program using these.
I searched google for code sample on these APIs. what is given is
a explanation of these.
i could not find any C code using all these to get oids.
i would appreciate if anyone can just give me code samples or
pointers where they can be found on the net.
I also want to ask if these functions are thread safe.
I want to create many threads which query for these (for each ip)
and update a central database.
Thanks,
James Tag: array of struct Tag: 236021
[newbie] bsearch with case- sensitivity switching
Hi,
I'm currently using the bsearch function in one of my C++- projects. Now, as
bsearch is case sensitive - is there an equivalent that is NOT?
Thanks a lot
Peter Tag: array of struct Tag: 236020
Looking for two articles in msdn
1. The article that describes the memory structure of exe, dll, etc. from
0x00000000 up for a process.
2. "Calling All Members: Member Functions As Callbacks" by Dale Rogerson
Thanks! Tag: array of struct Tag: 236019
Questions of hyper-threading
What kinds of Windows systems support hyper-threading?
Can such hyper-threading be enabled/disabled?
How does it affect multi-threading programming in general?
Why do people say that "Hyper-Threading Technology-enabled processors can
improve overall application performance"?
What effects could be caused by presence of hyper-threading?
Thanks! Tag: array of struct Tag: 236012
Text Editing within the exact centre of a shape object
Hi,
Say i have a shape object that i have placed on the current view and i want
to edit text within this object by double clicking it. Currently i have done
this through
pDC->DrawText(m_text, textRect(), DT_WORDBREAK | DT_NOPREFIX);
where the textRect() is simply a rectangle created around the same size of
the shape and then deflated:
CRect SquareShape::textRect() const
{
CRect r(m_origin, CSize(m_width, m_height));
r.DeflateRect(8, 4, 3, 3);
return r;
}
The problem is that i want the text to be exactly in the middle of the shape
just like if i hit the centre justified button in MSWORD. Currently the text
will begin as left justified and at the top right corner of the textRect.
Does anyone know an easy way to get around this? Tag: array of struct Tag: 236010
Static Const Modifier
Just recently in my CompSci course at school, they've started using static
const int's and I'm not really sure why. Isn't it easier to just to use
consts for stuff like this.
- Ben Tag: array of struct Tag: 236004
Adding Strings Together
Is there an easy way to add char arrays together. I remember when I was
using the string.h library I was able to do something like:
string name="Ben",
mystring;
mystring = "My name is" + name + ".";
Then outputting my string would print "My name is Ben". Is there any easy
way to do this with char[]'s. I'd rather keep using these instead of adding
another library. Tag: array of struct Tag: 235999
LNK 2001 error with class static data member
I have 2 dll projects.
In one I have a class with a static data member:
within Agent.h:
class CAgent
{
private:
static CAgentMap m_oAgentMap;
CAgentMap & RefAgentMap() { return m_oAgentMap; };
public:
const CAgentMap & RefAgentMap() const { return m_oAgentMap; };
}
within Agent.cpp:
CAgentMap CAgent::m_oAgentMap;
etc.
The only reference to m_oAgentMap is within Agent.cpp through RefAgentMap().
This dll compiles and links with no errors.
An assoiciated dll which uses a CAgent derived class is providing a LNK2002
error when linking the lib from dll 1.
error LNK2001: unresolved external symbol "private: static class CAgentMap
CAgent::m_oAgentMap" (?m_oAgentMap@CAgent@@0VCAgentMap@@A)
Why would it try to resolve the static data member in the DLL 1?
--
Don Tag: array of struct Tag: 235997
Hello,
How can I create an array of structure ? the struct will be holding the
results of a query. any link or example ?
You can use dynamic arrays using new [] /delete [].
You can also use vectors as: std::vector<mystruct> lst;
HTH,
Elias
"ramsin" <jsmithmitra@yahoo.com> wrote in message
news:ec6LtkepEHA.3728@TK2MSFTNGP09.phx.gbl...
> 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
// Dynamic array
MyStruct *pMystructarray = new MyStruct[N];
// vector
std::vector<MyStruct> vecMystruct;
--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
"ramsin" <jsmithmitra@yahoo.com> wrote in message
news:ec6LtkepEHA.3728@TK2MSFTNGP09.phx.gbl...
> 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
>
>