What does the -MT option really do?
Hi,
Is there a difference in code generation when you have -MT enabled?
If I have some libraries compiled with no -MT, and some with, what are the
possible problems I might have? If I have compiled everything with -MT, but at
the end I force to link with `libc' is this going to work?
Thanks,
Manu Tag: vc bug? Tag: 218004
Help needed on how to use CString ....
I'm starting some c++ programming again after being away from it for awhile,
and now I can't get anything to work. I'm working in Visual C++, and I want
to use CString in a simple console application. When I'm trying to do that,
I get this error : LINK : fatal error LNK1104: cannot open file
"nafxcwd.lib"
What is this file ? I don't have one on my computer, and the msdn help for
CString doesn't say anything about it, so where does the error come from ?
Something to do with the compiling ?
TIA Tag: vc bug? Tag: 218002
Join the VC++ Team at the PDC!
Hello, and greetings from the Visual C++ team at Microsoft! We would like
to invite you to join us at the Microsoft Professional Developers Conference
2003, in Los Angeles October 26th through 30th! We'll be talking about our
plans for the future of Visual C++ and about Microsoft's ongoing commitment
to C++.
The conference is nearly sold out, so don't wait to register. You can find
information about the conference at http://msdn.microsoft.com/events/pdc/.
It is another opportunity to voice your opinions directly to the people who
create the product! If you plan to attend PDC and would meet with the
Visual C++ team privately, please let me know!
April Reagan
Release Manager
Visual C++ .NET
Voice: 425-706-9811
http://msdn.microsoft.com/visualc Tag: vc bug? Tag: 217993
How to discover if an input string is unicode or ansi???
Hello,
having an application that receives input from users I'd need to be able to
discover if an input string is unicode or ansi and this since on w9x and wME
unicode is not supported (unless the Microsoft Layer for Unicode is
available on the client). Is there a way to discover if a provided input
string is unicode or ansi?
Regards,
Bob Rock Tag: vc bug? Tag: 217990
Where to put an object, Imported files
I am putting together a library of usefull functions that
I'd like to include in other projects. I have the
following "set" object that I wan't do define in this
library.
set<char> set_numeric; // declared in a .h file
set_numeric.insert('0');
set_numeric.insert('1');
...
set_numeric.insert('9');
What I've been trying to figure out is where to put the
initialization for the object. I tried putting it in
a .cpp file but there isn't an entry point to the file to
cause the object to initialize with the values.
Any pointers.
Craig Tag: vc bug? Tag: 217984
What is the counter part of CreateControl?
If an ActiveX control is created/linked dynamically via
CreateControl, what should I do to release it?
If I don't do anything, the app will exit without calling
the destructor of the control. Tag: vc bug? Tag: 217979
SysStringByteLen sometimes is 2x what it should
In my visual basic routine, I am calling a C++ dll that (at one point) has
to convert my bstr (VB string) to char. I have discovered that after a
while (???) the length of the value in the string is exactly 2x what is
should be. I am not sure what is causing this because I allocate all of
these strings thru visual basic. According to the "help" on
sysStringByteLen the value returned can be either the length of the string
or (if re-allocated) the allocated length of the string. It is not clear
what is going on. Maybe an expert here can tell me how to avoid this
problem. In the mean time I changed my code from
===from this====
b = SysStringByteLen(tdoa[i].srcvrnum2);
for(j=0;j<=b;j++) tde[i].rcvrname2[j] = tdoa[i].srcvrnum2[j];
====to this====
wchar_t wt;
b = SysStringByteLen(tdoa[i].srcvrnum2);
for(j=0;j<=b;j++){
wt = tdoa[i].srcvrnum2[j];
tde[i].rcvrname2[j] = wt;
if (wt == 0)break;
}
and this seems to fix the problem but I am not holding my breath.
When hitting "F1" on SysStringByteLen i got a mention of fstrlen but that
routine does not seem to be in the msdn index.
When i set a breakpoint after the b= i will see exactly 2x what the visual C
debugger shows. This does not occur ever time, but only if I call the dll a
2nd time or from a section of my VB code where a class was destroyed and
then allocated a 2nd or 3rd time. Is there any sure way to get the length
of the string and not get the 2x value?
BTW: the code "from this" traps in a library somewhere as the byte count of
2x goes past some boundary. If it didnt trap then the null terminating
character would have worked just fine. The problem is the program fault off
in the code that does the copy ie: "tde[i].rcvrname2[j] =
tdoa[i].srcvrnum2[j]; When debugging this problem, if I move the
instruction pointer so as to go to the next loop i can eventually stop out
and get the correct answer. It could be that when i let the test for the
loop be "j<=b" that b must be exactly on some boundary that traps. Normally
j must increment to the value of b so as to pick up the null terminating
character.
--
=======================================================================
Beemer Biker antispam@sbcglobal.net
Seti WU 29K Seti Years 34 Ask about my 99'R1100RT
New BoneHer V-Twin...
http://pages.sbcglobal.net/jstateson/_images/hisherbike.jpg
======================================================================= Tag: vc bug? Tag: 217969
LoadKeyboardLayout fails
Hi,
when the System locale is Arabic-Saudi arabia and I change the keyboard
layout to Arabic(Saudi arabia) it works
// this code works (it changes to Arabic(Saudi Arabia)
if (LoadKeyboardLayout("00000401", 1)==NULL)
AfxMessageBox("FAILED");
when the System locale is Arabic-Jordan and I change the keyboard layout to
Arabic(Jordan) it DOESNT works
// this code DOEST works (it changes to Arabic(Jordan)
if (LoadKeyboardLayout("00002c01", 1)==NULL)
AfxMessageBox("FAILED");
Why is it so?
-PE Tag: vc bug? Tag: 217967
unlink
why would unlink return an error 13 for a file created by the same app,
using file_attrib_normal, opened the same way and the time of trying to
delete it, that is currently not opened? Tag: vc bug? Tag: 217963
Determine if I run under a clustered server!?
Hi,
after looking for text or examples for a while I have to admit that I didn't
found quite much, except the standard description of MSCS, but that doesn't
really help.
Do any of you have an example of how to determine if I am running under a
clustered server with vc++, something like IsTerminalServicesEnabled() with
TSE, or a hint where I could have a look at? (Where I would prefer the hint,
because I would have to do the work :) )
Would really appreciate some help.
Thanks in advance and regards from Berlin
Ian Tag: vc bug? Tag: 217961
Problems with CButton
Hi,
I have done my own class derived from CButton. What my class does is lets
the button move over the form when the button is clicked , but
WM_LBUTTONDOWN doesn't work. I have solved this problem using
PreTranslateMessage, but if I do CMyButton array[3]; I can't know the id of
the button.
Someone can help me?
Thanks, Tag: vc bug? Tag: 217957
TCHAR pointer manipulation
Hi,
Considering a UNICODE application, the pointer 'pc' shown below will be
advanced 1 byte or 1 wchar_t (2 bytes) ?
_TCHAR c;
_TCHAR* pc;
pc = &c;
pc++;
How can I manipulate byte boundaries of a wchar_t ?
------
Rafael Pivato Tag: vc bug? Tag: 217937
Exception Memory Cleanup
Hi,
The buffer will be automatically deallocated in this case:
void myfunc()
{
char* buffer;
buffer = new char[size];
throw CMyException("Testing!");
}
----
Rafael Pivato Tag: vc bug? Tag: 217936
Detect when text is selected in an Edit Control
Hi,
I would like to know when a user makes a selection in a edit control on a
dialog.
It seems that the edit control doesn't send any messages to it's parent when
user selects some or all the text in the control. I need to know when user
makes selection, because I want to enable a button only when some text is
selected (eg. Open selected URL).
Is there a known method to detect this (except a timer which checks the edit
control every second)?
Thanks,
F Tag: vc bug? Tag: 217930
Detect when text is selected in an Edit Control
Hi,
I would like to know when a user makes a selection in a edit control on a
dialog.
It seems that the edit control doesn't send any messages to it's parent when
user selects some or all the text in the control. I need to know when user
makes selection, because I want to enable a button only when some text is
selected (eg. Open selected URL).
Is there a known method to detect this (except a timer which checks the edit
control every second)?
Thanks,
F Tag: vc bug? Tag: 217929
bit fileds question
Is it legal in a class to mix bit fields and common data members?
For example
struct mixed
{
size_t fixed : 1;
size_t priority : 4;
size_t shift : 4;
size_t size : sizeof(size_t)*8 - 9;
double d;
std::string s;
};
What does the compiler do if bit fields are not contiguous? Will it use many
size_t, one for each group?
size_t fixed : 1;
size_t priority : 4;
double d;
std::string s;
size_t shift : 4;
size_t size : sizeof(size_t)*8 - 9;
--
Every idea yields an answer
-- Abercrombie Smith Tag: vc bug? Tag: 217925
Newbie question
Hi,
I have just started working in VC++. I want to know how to save a file as a
text file.
In a dialog box i'm entering a person's age and name and i want to save it
as a text file.
Please help !
Gary Tag: vc bug? Tag: 217923
DLL help
Hi,
Can anyone tell me how to use a DLL file? I've compiled a DLL file that has
class Class1;. I want to create this declare this class inside another
program's code. Below is my code for the other program.
Thanks in advance,
Tim.
#include <stdio.h>
#using "temp.dll"
int main() {
Class1 c; // Class1 : undeclared identifier
// syntax error : missing ';' before identifier 'c'
// 'c' : undeclared identifier
return 0;
} Tag: vc bug? Tag: 217921
Need helps on socket programming.
How to know the socket status during the course of send() or recv()?
I use send() and recv() to send and receive data from socket. Before I call
send() or recv(), I use select() to judge the status of the socket(its file
discriptor), it works Ok. But during the progress of send() or recv(), if
network is jammed or down( for example if I pull out the net line or turn
off the hub), my program will still be waiting and waiting. It seems that it
know nothing about what happen. How could I solve the problem?
Thanks in advance for ur help Tag: vc bug? Tag: 217919
Performance Data Helper (PDH)
Help needed to display counter value, I'm having difficulty continuing the
following code (I took out the error handling to make things simple for
now):
////////////////////////////////////////////////////
HQUERY query;
HCOUNTER counter;
PDH_FMT_COUNTERVALUE value;
PdhOpenQuery(NULL, 0, &query);
PdhAddCounter(query, "\\Processor(_Total)\\% Processor Time", 0, &counter);
PdhCollectQueryData(query);
PdhGetFormattedCounterValue(counter, PDH_FMT_LONG, NULL, &value);
...
...
// what to do here to get a number that makes sense?
...
...
PdhCloseQuery(query);
////////////////////////////////////////////////////
MSDN suggests the following functions:
PdhGetFormattedCounterValue
PdhGetRawCounterValue
PdhFormatFromRawValue
PdhGetCounterTimeBase
PdhCalculateCounterFromRawValue
I don't understand why make simple things complicated, I just want a number. Tag: vc bug? Tag: 217917
Sorting Listview with C
I am trying to sort a listview window by clicking on the column header but
am having trouble even getting the
mouse click when clicking on the header.
Can anyone point me in the right direction regarding capturing the mouse
click when clicking
on the header and then sorting all the columns based on the sort of the
column who's header
is clicked on.
Thanks
Trevor Tag: vc bug? Tag: 217915
How to view stack and Heap grpahically
Is there any future available in VC++ 6.0 to view stack, heaps graphically
during debugging the program. ??
Arun Kumar. S Tag: vc bug? Tag: 217912
MS VC 7.1 compiler bug? - constant template arg considerd non-constant
Hi,
we recently upgraded from VisualStudio.NET 2002 to VisualStudio.NET
2003. Now nearly none of the C++ projects compile due to the following
error:
template <class T, T* SGL>
class sgl_own_ptr
/* smart pointer class witch evaluates never to NULL.
Instead of NULL SGL is dereferenced.
*/
{private:
...
};
class myClass
{private:
// null replacement
static ofstream NullLog;
// Absolute pointer to NullLog to keep MSVC 7.0 happy.
static ostream* const Ptr2NullLog;
protected:
// sgl_own_ptr<ostream, &NullLog> Log; // wont work with VC 7.0
sgl_own_ptr<ostream, Ptr2NullLog> Log; // *** here is the problem
...
};
ofstream EventLog::NullLog;
ostream* const EventLog::Ptr2NullLog = &EventLog::NullLog;
Output:
c:\Projekte\PI049\ErrorM\ErrorM.h(362) : error C2975: 'SGL' : invalid
template argument for 'sgl_own_ptr', compile-time evaluatable constant
expression expected
c:\Projekte\PI049\ErrorM\utils.h(109) : see declaration of 'SGL'
According to the standard any template arg must evaluate constant at
compile time. Since NullLog is static &NullLog /is/ a constant expression.
Unfortunately MSVC 7.0 refused to compile
sgl_own_ptr<ostream, &NullLog> Log;
With the helper Ptr2NullLog which is initialized to &NullLog everything
works with MSVC 7.0.
Now with MSVC 7.1 neither the direct way nor the workaround compiles.
It seems the the implicit conversion from ofstream* to ostream* is no
longer compile time evaluateable.
Without this conversion template arguments of the kind T* can never be
used with abstract classes.
Marcel Müller Tag: vc bug? Tag: 217903
will memset work here?
I'm having some memory related issues (corrupt data) in release mode, so
I'm looking over my code to see if there's anything that could be biting
me. I'd like advice about some of my methodology.
The intent of these code snippets is to clear all members of the arrays
of structures to zero. Am I correct with my use of memset for this?
// example 1, structure of numbers
struct hsdata
{
unsigned long wgpin;
unsigned long pxpin;
unsigned int hsindex;
};
myfunction(void)
{
hsdata hs[1200];
for(int z = 0; z < 1200; z++)
{
memset(&hs[z],0,sizeof(hsdata)); // any problem here?
}
}
//////////////////////////////
// example 2, structure of mixed data types
struct code_data
{
unsigned char data[12];
int hsindex;
};
struct card_codes // contains struct's of the above code_data
{
struct code_data wgcode;
struct code_data pxcode;
unsigned int status;
};
// card_codes[] array is passed in to the function
// and cleared before use.
function2()
{
struct card_codes cm[1200];
for(int x=0; x<1200; x++)
memset(&cc[x],0,sizeof(struct card_codes)); // this OK?
}
Thanks for looking.
drc Tag: vc bug? Tag: 217894
Can data be defined in __asm blocks?
I'm trying to create a jump table using code similar to the following which
I copied from the compiler generated assembler listing.
jmp jmpTable1[edx*4]
jmpTable1:
DD label1
DD label2
DD label3
DD label4
I get errors "inline assembler syntax error in 'opcode'; found 'label1'"
etc.
TIA
AJ Tag: vc bug? Tag: 217883