error LNK2005
I am getting the LNK2005 for mulitple definitions of all my subroutines.
Here's my structure:
cc_main.cpp - contains the code fore main()
cc_subs.cpp - contains the various routines called by main()
cc_lib.h - the definitions for the subs.
in cc_main I have the #include "cc_subs.cpp" directive
in cc_subs I have the #include "cc_lib.h" directive
at the top of both cc_subs.cpp and cc_lib.h I have the #ifndef statements that were supposed to avoid the multiple linking.
How do I fix the multiple linking problem.
Thanks, Tag: Drive Letter Tag: 231949
CString problem
I am trying to make a wrapper class that contains the GetLogicalDriveStrings() function. Is there a way to
1) Get this buffer copyed into a CString
2) Use the CString in the same manner that the buffer is being used.
The problem i am running into is the format of the buff string that is returned from
GetLogicalDriveStrings(). It has the terminating character seperating the
Drive Letters.
A:/'\0'C:/'\0'...
This seems to be doing something to the functionality of the
CString.
Here is the code.
TCHAR * buff = NULL;
buff = new TCHAR[nBuffSize];
GetLogicalDriveStrings(nBuffSize,buff);
for(DWORD i = 0; i < nBuffSize; i += 4){
RecurseDirs(&buff[i]);
}
Any better suggestions on how to implement this would be
great also if there is a better way. Tag: Drive Letter Tag: 231947
C++ dll from VB
First off let me say that I am not a C++ expert and
any help would be appreciated.
Here is part of the function that I am trying to modify
the strncpy function crashes when I try and call the function from
VB when debugging
However if I use the exe that I generate from VB in the C++ debuger
it does not crash.
Or if I execute the EXE everything seems to work fine
I suspect that when I call the dll in the VB debuger the
values are not passed the same as when I execute the compiled exe.
How can I get filepath[] to display in the MessageBox?
BOOL _stdcall GetPatName2(char filepath[], char* patname,int
filepath_len){
BOOL return_val = SUCCESS;
int sample_size;
char *PName;
long filesize;
long wnum =0;
char *file_name;
struct SAMPLE_HEADER *raw_data_buffer = NULL;
int file_no;
PName =(char*)AllocateHeap(PNAMESIZE);
file_name = (char *)AllocateHeap(filepath_len+1);
MessageBox(NULL,(LPCTSTR)file_name2,TEXT("Sample Code"), NULL);
strncpy(file_name,filepath,filepath_len);
file_name[filepath_len] = '\0'; //make sure its null terminated
MessageBox(NULL, TEXT("Job Done\n"), NULL, NULL);
return (return_val);
}
VB fuction declaration
Declare Function GetPatName2 Lib "c:\test\testdll\Debug\playback.dll"
Alias "#4" (ByVal Filepath As String, ByVal PName As String, ByVal
FILEPATHLEN As Integer) As Boolean
Thanks Nevlis Tag: Drive Letter Tag: 231944
self modifying exe
hi,
can anyone help me writing self modifying exe??? any article, site,
reference??????? i need to write one in C/C++ this has to be console based
application.
thanks.
bye,
Farooq Khan Tag: Drive Letter Tag: 231939
restricting number of digits after decimal point using CString.format()
Hello,
To dispaly the value of variable B of type double in a MFC text
control, I am using the following three lines
CString maxA;
double B=0.00;
maxA.Format("%f ",B);
Everything is and the numbers are diplayed like '2.987654'. I would,
however, want the numbers to be displayed upto only three digits
after decimal point. Would someone tell me please how can it be done?
Thanks. Tag: Drive Letter Tag: 231933
Remove a file over the network on a Sun
Hi
I have an application on a Windows PC who shoul delete files on a Sun which
is in the same network. I try this with 'remove', e.g.
remove(\\Sun\Temp\File.jpg). But this doesn't work. The return code from
remove is not 0 and the errno is 22 (invalid argument).
What could be wrong?
I have access to the Sun and have tried this with the directory mounted or
not mounted and I have tried the same (delete a file) on a Windows and a Mac
OS X machine in the netwroks. This works fine.
Thanks for any help.
Regards
Hans Tag: Drive Letter Tag: 231930
Function problem
I'm kinda new to C++, having programmed VB6 and VB.NET for some time.
Here's my function:
extern "C" __declspec(dllexport) long* CHARtoINT(char* input);
long* CHARtoINT(char* input)
{
int length = strlen(input);
long* output;
for (int i = 0; i < length; i++)
{
output[i] = (long)input[i];
}
return output;
}
The purpose is to pass in a string, and return a long (would prefer
int) array. I need every letter of the string that comes in to be
it's own array member in the outgoing array in ASCII equivs. For
example, if I pass into it "Hello", I need this returned:
[72],[101],[108],[108],[111]
Should be simple, but after 3 weeks, I still can't get it too work
right. I've even tried to pass a areference to the long* as a
parameter, and still no good. Ohh, BTW, this needs to be able to be
called form VB, and C++, and .NET. Nice added touch, right?
Thanks,
Tibby Tag: Drive Letter Tag: 231926
solution to clearcase : VC++ error: fatal error C1033: cannot open program database
I have been getting this error in clearcase trying to compile my
VC++ projects
fatal error C1033: cannot open program database
Some people have posted this problem on the NG but nobody has posted a
solution.
So it was frustrating for me trying to fix the problem but now I have
fixed the issue and I want to post in this NG so that someone else who
comes across this erros does not have to waste much time.
And here is the solution to the problem (pretty lame but i ended up
wasting
too much time).
In the clearcase home base, go to "administration".
In "administration" select "control panel"
In "control panel" select "MVFS"
In MVFS there is something called "case insensitive MVFS". In my
machine it was unchecked.
So it was generating those errors.
To fix the problem we have to check "case insensitive MVFS" option and
followed by checking the next option
"Case preserving"
(a new check box "case preserving" comes up when we check the "case
insensitive MVFS" option). Tag: Drive Letter Tag: 231925
Library RSA SHA1 PKCS1v15 + X509 -> COM?
Hi!
Does anyone know a free library who manage theses sepecifications under
windows?
!!!No .NET - No Java - only COM (VB6 VC6)!!!
I receive 3 binary files : The original one, the signature(RSA SHA1 content
not included), and the certificate with the public key X509.(1024bits)
I only have to validate the original file with the signature...
I alread tryed theses libraries :
WCCO - Too hard to work with
ActiveCrypt - Doesn't manage X509
ASPEncrypt - doesn't manage certif >256Bits in the free version
CryptLib - too hard and too expencive...
OpenSSL -i didn't understand all...
ebCrypt - OK but the verification work with a content included(and i don't
know how to concat it)
In M$
CryptoAPI - No PKCS1v1.5... Only PKCS7
CAPICOM - idem
(Is it possible to concat the signature with the public key and the content
to fit in the specs of capicom... To use the SignedData.verify - if yes :
how?)
PS: I'm newby in cryptology...
Sincerely,
Delfosse Jérôme Tag: Drive Letter Tag: 231924
Calling "system" without console window appearing
When I call an external program from another program (either MFC standalone
or as a plugin inside another application), then a call to system always
launches a console window. Can I prevent that?
--- stefkeB --- Tag: Drive Letter Tag: 231920
Microsoft Visual C++ .NET 2003 compiler problem
#include <memory.h>
class str{
public:
str(){memset( &szBuf, 0x00, sizeof(szBuf) );}
bool operator == ( str& strTmp ) { return memcmp( &this->szBuf,
&strTmp.szBuf, sizeof(this->szBuf) ) == 0; }
bool operator != ( str& strTmp ) { return memcmp( &this->szBuf,
&strTmp.szBuf, sizeof(this->szBuf) ) != 0; }
operator char* (){ return (char*) szBuf; }
private:
char szBuf[128];
}_str;
int main(int argc, char* argv[])
{
str s1;
bool b = s1 == str();
return 0;
}
Hi there,
In the source above when I use Microsoft Visual C++ .NET 2003 at line 'bool
b = s1 == str();' first is called operator (char*) for member 's1' after
that is called operator (char*) for str() and then operator == for type
(char*). Of course after this the result from '==' is 'false'. If I add
'const' for referenced parameter in str::operator == ( bool operator == (
const str& strTmp ) ...) the right operator is called (str::operator == )
and the result is 'true'.
In Microsoft Visual C++ .NET 2002 and in Microsoft Visual C++ 6.0 this
source works fine (str::operator == is called) without adding 'const' to
the parameter.
Is this is cimpiler bug or something else? Any ideas, comments, thoughts...
:-))
Thanks
Dimitar Lazarov Tag: Drive Letter Tag: 231919
Cannot save file. The file may be in use by another application
I am running MSVC 6.0
Ever since I upgraded to XP (and I don't think it is related to that) I've
been getting a strange and inconsistant error.
In some projects (not all, some more than others) occasionally when I save a
file I get an error messagebox saying:
"Microsoft Visual C++"
"Cannot save file. The file may be in use by another application."
I don't think it is in use by any other applications and when I repeat the
save it always works fine the second time.
I've tried to compare a problem project with one that rarely does this, but
I don't see any setting differences.
It's getting to be really annoying. Any help is really welcome.
Thanks in advance,
--Tom Swezey
--
--
**** Signature **** (KISS: Keep It Simple, STUPID!) ****
Check out my Web Site: http://www.winternet.com/~swezeyt
(o o) E-mail me at swezeyt@winternet.com
oOO*( )*OOo********************************************* Tag: Drive Letter Tag: 231917
FindNextChangeNotification
I am trying to write a little program to monitor a directory and its
sub-trees.
I get FindNextChangeNotification, FindNextChangeNotification and
FindCloseChangeNotification to work fine
but when they pop I can't tell what file changed.
I've looked at ReadDirectoryChangesW but I can't get it to compile - it says
"undeclared identifier".
Is there anyway to get this info?
I'd hate to have to step through the directories one by one.
Thanks in advance,
-- Tom Swezey
--
**** Signature **** (KISS: Keep It Simple, STUPID!) ****
Check out my Web Site: http://www.winternet.com/~swezeyt
(o o) E-mail me at swezeyt@winternet.com
oOO*( )*OOo********************************************* Tag: Drive Letter Tag: 231916
MC.EXE: how to have single event log message file for several programs
Hi all
I have an application consisting of several programs.
I want to have a single dll with event log messages for all programs
together.
Each program should have its own ProgXY-Msg.mc file.
Is this possible?
The following two lines make up the ProgXY-Msg.rc file:
LANGUAGE 0x7,0x1
1 11 ProgXY-Msg.bin
I suppose I can not have more than one resource with a leading "1 11".
I suppose if I change it to "2 11" or "1 12" the event log will not be
able to read its messages.
Is there an alternative to concatenating all *.mc files into a single
all.mc file before calling the message compiler MC.EXE?
Is there anything like a commandline parameter to MC.EXE to read
several mc-files at once?
Is there anything like an include statement for *.mc files?
Is there an alternative to MC.EXE with does anything of the above?
any hints welcome
Joerg M-T Tag: Drive Letter Tag: 231915
How can i use USB port in visual C++?
I have to make a project . It will send sms. I have Motorla mobile phone.
How can i communicate that mobile phone?
Regards. Tag: Drive Letter Tag: 231914
ListView from namespace system::windows::form
Hi,
i would like to find an example how to use the ListView from the
namespace system::Windows::Forms.
including all include, using, and basic code..
i didn't find any help about it on internet...just about C# or VB, but
nothing regarding C++.
thx,
Maileen Tag: Drive Letter Tag: 231907
Forcing a symbol out of an executable
I'm using VC6.0 SP5 and VC.NET 7.1. I have a third-party static library (no
source) that when linked into my executable, results in my executable
exporting the static library's symbols. I believe it's due to how the
static library itself is contructed (I'm not specifying its entry points in
a .def file, with a /EXPORTS or /INCLUDE switch, or by __declspec(dllexport)
in the source code of my project or any includes) . Is it possible to
either:
a) Modify the static library to prevent this behavior
or
b) Explicitly exclude entry points when linking my executable
and if so, how? Thanks.
--------------------------
Kyle Alons
http://www.kinook.com/ Tag: Drive Letter Tag: 231902
run-time array bounds checking
Compiling the program below with MSVC 13.10.3077 for 80x86 using the
/GX /GZ /Ge options
#include <iostream>
using namespace std;
int main()
{
int ix[1];
ix[0] = 3;
cout << ix[0] << " " << ix[1] << endl;
}
produces a compilation warning
local variable 'ix' used without having been initialized
and output
3 -858993460
Is there an option that will cause the program to terminate at run
time
(preferably with an informative error message) when trying to access
an out-of-bounds array element?
If I add the line
ix[1] = 4;
before the cout the program prints '3 4' and then crashes. It would be
better if it crashed at the 'ix[1] = 4;' line. Tag: Drive Letter Tag: 231901
OO dll backward compactibility problem
Hi,
I wonder if anyone can give me some advices for this
problem.
I have been working on some program to interface with some
devices and I would like to use the OO model to interface
with different devices with different dll.
I tried to seperate the design into 3 layers:
/* BaseDevice .h */
class EXPORT_DLL_PREFIX BaseDevice{
public:
BaseDevice(){}
~BaseDevice(){}
virtual void DeviceCallA()=0;
};
typedef BaseDevice * (CALLBACK* BASEDEVICE_GET_INSTANCE)();
/* Inherited Device class A DeviceA.cpp */
#include <BaseDevice.h>
#static BaseDevice instance = NULL;
class EXPORT_DLL_PREFIX DeviceA: BaseDevice
{
public:
DeviceA() {// do something}
~DeviceA() {// do something }
DeviceCallA()
{
// Do the actual work here...
}
};
BaseDevice * getInstance()
{
....
instance = new DeviceA();
return instance;
}
/* upper interface layer upper.cpp */
...
static BASE_DEVICE_GET_INSTANCE getInstance;
....
BaseDevice * device;
.....
getInstance = (BASE_DEVICE_GET_INSTANCE )GetProcAddress(
modHandle, _T( "getInstance" ) );
// link to the (DeviceA.dll) and get the instance...
device = getInstance();
device -> DeviceCallA();
..
Turn out it works. However, if I would like to add
another method to the BaseDevice.h for the new support
device, problems comes up. Any previous application which
was developed using DeviceA.dll will not run. I know that
it is due to the virtual table ordering when new methods
are added.
Are there any suggestion to this problem that adding new
methods will not affect previously developed applications
which used link to the previous version of the dll
implementing the previous version of the abstract class?
Thanks!
Kenric Tag: Drive Letter Tag: 231900
__loctotime32_t problem in MSVS 8.0
If issues related to MSVS 8.0 should be posted somewhere else, I would appreciate a pointer in the right direction.
We are using MSVS 8.0.40426 (pd5.040426-1400) on Win32 XP
There looks to be a bug in __loctotime32_t (called from _stati64 which is actually _stat32i64) where EINVAL is incorrectly reported. Here is the code fragment from the Microsoft VC7 CRT. Notice that the first "if" has a side effect of modifying the parameter "yr"; however, the subsequent _VALIDATE_RETURN expects "yr" not to have been changed. Also note that yr is later decremented by 1900 again.
__time32_t __cdecl __loctotime32_t (
int yr, /* 0 based */
int mo, /* 1 based */
int dy, /* 1 based */
int hr,
int mn,
int sc,
int dstflag )
{
int tmpdays;
__time32_t tmptim;
struct tm tb;
/*
* Do a range check on the year and convert it to a delta
* off of 1900.
*/
if ( ((yr -= 1900) < _BASE_YEAR) || (yr > _MAX_YEAR) )
return (__time32_t)(-1);
_VALIDATE_RETURN(
( ( ( yr - 1900 ) >= _BASE_YEAR ) && ( ( yr - 1900 ) <= _MAX_YEAR ) ),
EINVAL,
( ( __time32_t )( -1 ) )
)
yr -= 1900;
--
Jason Hinsperger
Product Manager
iAnywhere Solutions Tag: Drive Letter Tag: 231899
main(int argc, char* argv[])
When started from VC6 IDE, I receive 7 arguments in argc/argv. When
started from console I receive 8 arguments in argc/argv. What should I do?
This is how I strat my console app from debugger:
-p1 -p2 -p3 -p4 -p5 -p6 -p7
This is how I start my console app from console:
TestApp -p1 -p2 -p3 -p4 -p5 -p6 -p7
I've tryed to add "TestApp" in a front of debugger argument list, but
then I have to change argv[3] into argv[4] in my app, if my app was invoked
from VC6 IDE, but I don't know if my console app was started from VC6 IDE or
console.
I'm using Windows XP Pro. Tag: Drive Letter Tag: 231895
Download API , help please
Hi
I wrote a small download manager.
Im using IBindStatusCallback and i want to prevent "caching" the files :
STDMETHODIMP CBindStatusCallback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO*
pbindinfo)
{
*pgrfBINDF = BINDF_NOWRITECACHE;
return S_OK;
}
But its not working, the data is still cached !!!
What am i missing here ?
thanks Tag: Drive Letter Tag: 231890
A question of SAPI?
Hi
I want to make a tool, using Microsoft Speech with VC++6.0 . The
XP ->Contral panel->Speech->SpeechRecognize we can choose the "Microsoft
English Recongizer" or "Microsoft Simplfied Chinese Recongizer" etc...but I
want to make it in my tool. Are there any SAPI functions to choose the
Recongizer?
Thanks in advance Tag: Drive Letter Tag: 231887
pre-compiled header file
To use pre-compiled header file, for the first time of compiling a project,
we have to specify "Not use pre-compiled header file" in the project's
Setting options, since there is no .pch file yet and for each project, the
.PCH file could be different. Is this correct?
In a Windows console program, is the "stdafx.h" header file that determines
what to be included in the .PCH file?
Is "stdafx.h" header file can be compiled, can other header files like being
created by myself be compile as well?
Thanks! Tag: Drive Letter Tag: 231886
Finding waveIn devices
I am trying to read sound from a microphone but I
can not make it work.
The problem might be that I am using the device.
According to waveInGetNumDevs(), I have two devices.
My problem is that I do not know what devices they
are, I do not know how to find their names and
their device ids.
In the documentation, they give the device to
waveInOpen as WAVE_MAPPER which seems to work as
some sort of default device. I can not make this
work.
(I hate the Visual Studio Help. When I search
on DeviceId, I only get fax references. I suppose
they are out there somewhere but I could not find
any answers to my questions.)
Thanks for any answer
Anders Floderus
--
m a i l : anders d o t floderus a t swipnet d o t se Tag: Drive Letter Tag: 231881
Dialog Problem
I need to add some design for the background of my Dialog.And I also want
to display some text with custom format like changed font and color.What is
the ideal control for doing it.Please help.Thanks in advance.Can get me some
sample code.
Jeevan Tag: Drive Letter Tag: 231879
convert string to LPSTR
Hi,
I know that LPSTR is a char*.
I would like to convert a string (from std namespece) to a LPSTR.
nowhere i found a tutorial/help about it.
i was thining to cast it into char* but it's not correct.
thanks for help.
Maileen Tag: Drive Letter Tag: 231873
Raelian, Normism & Declaration of Heaven on Earth2914
Please visit http://www.normism.org for details!
169292bvktlg169292
bvktlg169292bvktlg
-----------------------------------------------------------------------------
--This Message Has Been Posted Using A Trial Version Of Message Poster 2003--
-----------------------------------------------------------------------------
Would you like to reach millions of customers for only the cost of bandwidth?
You can post messages like this to thousands of newsgroups with a simple to
use software application called Message Poster 2003. For more details on
this extremely affordable software, visit:
http://www.exibitionsoftware.com Tag: Drive Letter Tag: 231865
Convert _bstr_t to c_str
Is the following correct?
char* c_str;
_bstr_t b;
...
c_str = b;
If correct, how could an ANSI char* pointer get pointing at a memory of
unicode string?
Thanks! Tag: Drive Letter Tag: 231861
Smart pointer types of MSXML
The code is from MSDN:
// Initialize objects and variables.
IXMLDOMDocument2Ptr pXMLDoc = NULL;
IXMLDOMParseErrorPtr pError = NULL;
...
// Clean up and destroy objects.
if (pXMLDoc) pXMLDoc.Release();
if (pError) pError.Release();
pXMLDoc and pError seems like pointer type since they are initialized with
"NULL". Then how can their member function "Release()" is called using
"pXMLDoc.Release()" and "pError->Release()"?
What for to call "Release()" here? If to releasing memory, then as smart
pointers, they should have already done that at the exit of the scope?
How exactly such smart pointer types defined for IXMLDOMDocument2Ptr?
Thanks! Tag: Drive Letter Tag: 231860
Convert between DWORD and WORD
My understanding is that conversion of WORD type data converts to DWORD will
not cause loss of any data bits.
What happens if converting DWORD to WORD?
How to convert "safely" a DWORD that has a value within the range of WORD?
Thanks! Tag: Drive Letter Tag: 231854
vector and class - end
Hi,
i have the following class :
class Book
{
string Category;
string SubCategory;
Book(string Cat, string SubCat)
{
Category = Cat;
SubCategory = SubCat;
};
};
in my cpp file, i use a vector of this class:
vector<Book> My_Book;
My_Book.push_back(Book("Cat1","SubCat1"));
My_Book.push_back(Book("Cat2","SubCat2"));
My_Book.push_back(Book("Cat3","SubCat3"));
// this works great...but how can i display later my data ?
i tried :
char buf[1024];
for(int i=0;i<My_Book.size();i++)
{
wsprintf(buf,"Element %d : %s\n",i+1,&My_Book.at(i).Category);
TRACE(buf);
}
but it doesn't work... i mean &My_Book.at(i).Category
i have partially good result...but just partially :(
something like : IIIICat1 and IIIIcat2,....
thx for help,
Maileen Tag: Drive Letter Tag: 231851
strange behavior of Vector
Hi,
I'm still working on my Book Class using vector.
due to a strange behavior of vector function : push_back(), i decided to
do a simple test.
the result is absolutely the same...it's to say :
I wrote this :
//-------------
vector<int> Pokus;
Pokus.push_back(10);
Pokus.push_back(20);
when i control in my Local window the values, i have :
Pokus
_MyFirst 10
_MyLast *? a random value but not 20
_Myend *? the same random value than _MyLast
so i was thinking that push_back function reallocate memory in case of
need...but it seems to not work.
Does anyone already had this behavior or just me ?
thx,
Maileen Tag: Drive Letter Tag: 231844
ListView from namespace System.Windows.Forms.TreeView
Hi,
I'm trying to use the ListView available in the namespace
System.Windows.Forms.TreeView.
But impossible to make it run....i tried :
using namespace System::Windows::Forms::TreeView;
how i can get access to this namespace in order to use this LIstView
control ?
thanks,
Maileen Tag: Drive Letter Tag: 231839
Class constructor limited in parameter ?
Hi,
I'm still with my vector and my Book class.
I have a strange behavior during construction of my class.
I my class constructor as 5 parameters it works, if it has 6 parameter,
VC.NET returns me an error :
error C2059: syntax error : ')'
here is code :
class Book
{
public:
std::string Category;
std::string SubCategory;
std::string Title;
std::string Author;
int Pages;
int Year;
std::string Publisher;
std::string Format;
std::string Description;
std::string Language;
std::string Image;
std::string Information;
// constructor
Book(std::string Arg_Category, std::string Arg_SubCategory, std::string
Arg_Title, std::string Arg_Author, int Arg_Pages, int Arg_Year,
std:string Arg_Publisher) : Category(Arg_Category),
SubCategory(Arg_SubCategory), Title(Arg_Title), Author(Arg_Author),
Pages(Arg_Pages), Year(Arg_Year), Publisher(Arg_Publisher)
{
}
};
this work when i use :
std::vector<Book> Books;
Books.push_back(Book("Category_1", "SubCategory_1",
"Title_1","Author_1", 588, 2004, "Publisher_1"));
but if in my class i have as constrcutor:
Book(std::string Arg_Category, std::string Arg_SubCategory, std::string
Arg_Title, std::string Arg_Author, int Arg_Pages, int Arg_Year,
std:string Arg_Publisher, std::string Arg_Format)
: Category(Arg_Category), SubCategory(Arg_SubCategory),
Title(Arg_Title), Author(Arg_Author), Pages(Arg_Pages), Year(Arg_Year),
Publisher(Arg_Publisher),Format(Arg_Format)
{
}
and i initialize it as such :
std::vector<Book> Books;
Books.push_back(Book("Category_1", "SubCategory_1",
"Title_1","Author_1", 588, 2004, "Publisher_1", "Format_1"));
i get error written above :(
so, Is there any limitation for the number of parameters in constructor ?
if yes (and i've never seen it), how can i initialize more parameters ?
thx,
Maileen Tag: Drive Letter Tag: 231833
Cannot add fields at runtime to a CDaoRecordSet class
I solved this once before using VC++ and CDaoRecordSet, but I am looking for
a better solution - even though I have the sinking feeling that what I am
attempting to accomplish is not possible.
Here is the issue (at least a pared down version of it):
My VC++ MFC application has a Microsoft Access file Networks.mdb which
currently has six fields.
The problem arises when I want to add another (or seventh) field.
There is no problem updating the CPP (or class file) for this file -
Networks.mdb. I am able to successfully bind a new variable for the new
field.
But of course this means I can no longer read the old MDB file without
throwing an exception. Which is not unexpected since the number of elements
(6) no longer matches the new class file where m_nFields is now set to 7.
So my question is there a way to open this mismatched MDB file at runtime so
that I can retrieve the records and safe them in the new MDB file. Of course
the added problem is both MDB files have the same name.
TIA.
Michael T. Tag: Drive Letter Tag: 231820
bool and ==
Hi,
Can the == operator be used with bool? Is this valid?
////////////
bool a, b;
bool c = a == b;
////////////
Thanks,
Nelson Tag: Drive Letter Tag: 231815
Object properties change without reason
Hi
Consider an object from a child class B with the parent class A. I create an
Object of class B in a function that can return a pointer to the class A,
then I return the Object's pointer through the function.
After examining the returned Object in debug mode, like (B *)
ReturnedObject, I see that some properties has got invalid. These properties
are pointers to other objects of the other classes that I had created in the
function and gave their pointers to my Object. But after returning it these
sub-objects are gone!!
Can anyone help?
Mehran Ziadloo Tag: Drive Letter Tag: 231811
Using C++, how can I check the existence of a directory?
Hi,
Using Microsoft Visual C++ ver 6.0, I need to check if a directory exists.
I am using PathIsDirectory() function and I included <shlwapi.h> in my file. I am calling PathIsDirectory() inside a class virtual member function. When I try to build the program I am getting these 2 errors:
error LNK2001: unresolved external symbol __imp__PathIsDirectoryA@4
fatal error LNK1120: 1 unresolved externals
How can I fix these errors? Is there any other function that I can use?
Thank you Tag: Drive Letter Tag: 231806
Can someone explain why Intellisense does not wotk here? - VC6
struct projectStructure
{
int mgrItem;
int buyrItem;
int decisionItem;
int artItem;
int cpyItem;
int advItem;
int lstItem;
int lblItem;
int prnItem;
int afixItem;
int delvrItem;
};
typedef struct projectStructure project;
//This is in a c source file. When I type:
int main()
{
project july4sale;
july4sale.artItem=20
....
}
I do not get intellisense at this point july4sale. Nothing happens =
after I type the period. I know it works the code seems correct but =
intellisense doesn't work. What have I done wrong? Thanks. Visual C++ =
6 SP5 Windows 2000.
--=20
George Hester
__________________________________ Tag: Drive Letter Tag: 231801
Perhaps a VC++ compiler error
Well I'm not sure who's fault is it, me or VC++ compiler!!
I wrote a program which works with files in hard disk and it just reads them
through "ifstream".
This program of mine acts so strange, when I compile it as a release
version, it works perfectly but when I compile it as a debug version, it
cuases error and abnormal termination!! Can I do anything wrong to make such
an error?
I'm using VC++ 7.0 in visual studio .Net but without .Net framework.
Please help...
Mehran Ziadloo Tag: Drive Letter Tag: 231798
C++ Object size
Hello all,
I want to find out is how much memory is being used by each class (and thus the object) in my application. This includes differentiating between the memory allocated for functions and memory allocated for static data (like arrays, constants etc.)
Does anyone know of any utility that will allow me to obtain this information AFTER linking my application with other libraries? I tried to interpret the linker generated MAP file for this, but there seems to be no documentation on MSDN to interpret the keywords in the MAP file. If not another utility, does anyone know how to interpret the MAP file for individual objects/classes?
Thanks,
Adwait Tag: Drive Letter Tag: 231790
class constructor error
Hi,
I have a stupid error message from VC++.NET.
I did a mistake but i don't see where :(
here is my class :
class Book
{
public:
int Pages;
Book(int Arg_Pages) : Pages(Arg_Pages)
{
}
};
error message is :
error C2512: 'Book::Book' : no appropriate default constructor available
where is the error ?
thx,
Maileen Tag: Drive Letter Tag: 231789
LogonUser and ImpersonateLoggedOnUser
Hi!
I'm developing the setup of an application. It needs to write in registry
and extract files on certain directories. The files are extracted using
scripting interface (JScript) processed in my setup using odl to define new
functions.
The setup evaluate if current user have administrator privileges and, if he
doesn't have them, it let you introduce username and password and change the
current user with LogonUser and ImpersonateLoggedOnUser.
This actions are done at the beginning and goes well (I can write in local
machine entry of registry), but, when I extract files, the administrator
privileges are lost.
Does anyone knows how to resolve this? Does the scripting machine have their
own privileges or is it multithread or something?
Thanks at all
Jordi Tag: Drive Letter Tag: 231783
How to catch "integer division by zero" exception
In VC7, Division by zero will cause system to throw an exception, I do not
konw the
exception type, I can only catch it by
catch(...){}
but, it's no use, because I do not know what the exception really was. Other
run time
exceptions, such as access violation, have the same problem. I can not find
the exception types
in the document. Dose some one know the exception type or know how to catch
those exceptions? Thanks a lot.
Tao Bo Tag: Drive Letter Tag: 231780
Convert String to Variable
I have a form which has a series of TextBoxes on it which are named bin0,
bin1, bin2, ... On the form I have an array defined called bin[20] which
holds integer values and the contents are changed by other code which
returns the variable npod. If npod = 1 then I increment bin[1] and then on
the form I changed bin1->Text = bin[1].ToString()
I started with just a few bin variable an didn't use an array so I performed
the update with a case statement and hard coded each TextBox update with the
name like above. What I want to do know is create a string which hold the
name of the TextBox and use this value to change the text in the box.
So my question is how do I code the program, so that once I have a string
which holds the TextBox name, it will know that this is the TextBox name and
now just a string?
Here's an example of what I want to do:
Old Code
=======
bin1->Text = bin1.ToString();
New Code Which Doesn't Work
======================
String* thebin = String::Concat(S"Bin", npod.ToString());
thebin.ToString()->Text = bin[npod].ToString();
Thanks!!! Tag: Drive Letter Tag: 231778
Hi,
Is there an API that takes a partition number and returns the drive letter of that partition?