|
First, the linker does not care about .h files. Those files are handled by the preprocessor.
si_69 wrote:
i need to include the library "afxdao.h"...
This is a header file, not a library.
si_69 wrote:
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\dbdaoint.h(109): error C2011: 'LockTypeEnum' : 'enum' type redefinition
c:\MyApp\Debug\msado15.tlh(228) : see declaration of 'LockTypeEnum'
The error is telling you that more than once instance of LockTypeEnum has been found. If you remove the inclusion of afxdao.h , does the error go away, or get replaced with a different error?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
If you remove the inclusion of afxdao.h, does the error go away, or get replaced with a different error?
yes, the error goes away if i remove the afxdao.h
but i require that header file
i found using
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename( "EOF", "adoEOF" ) rename ("LockTypeEnum","newLockTypeEnum")
has solved my problem
thanks anyway
si
|
|
|
|
|
si_69 wrote:
i found using
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename( "EOF", "adoEOF" ) rename ("LockTypeEnum","newLockTypeEnum")
has solved my problem
It may very well have solved it, but without knowing more about the application and the problem, it may also have just masked the real problem.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
My app creates a CDialog which is displayed in the taskbar. Then I hide this dialog (with ShowWindow(SW_HIDE)) and create a new CDialog. However since I hid the 1st dialog, the taskbar window is also not shown and the new CDialog doesn't display a new taskbar window. What am I doing wrong here? - how can the new dialog display a taskbar window?
|
|
|
|
|
in my application i need to find the windows system directory(ie. say C:\WINNT\system32) at run time. how do i do so? any APIs?
|
|
|
|
|
TCHAR buffer[_MAX_PATH+1] = { 0 };
BOOL ok = SHGetSpecialFolderPath(myHwnd, buffer, CSIDL_SYSTEM, false);
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
SHGetSpecialFolderPath not working......
|
|
|
|
|
GetSystemDirectory
sometimes it's soooo easy.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
CSDIL_SYSTEM does not exist.
i have checked the other option, none gives the systen folder
|
|
|
|
|
Anonymous wrote:
CSDIL_SYSTEM does not exist.
i have checked the other option, none gives the systen folder
CSIDL_SYSTEM is the correct value. It is defined in shlobj.h
You might also try GetSystemDirectory but I'm not sure if that returns System or System32.
Michael
CP Blog [^]
|
|
|
|
|
It's CSIDL_SYSTEM, and it does exist with the current platform SDK.
If you're running VC6 "out of the box", you might have to use GetSystemDirectory()
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
#include <strstrea.h>
char szDir[128];
ostrstream strmDir(szDir, sizeof(szDir));
strmDir << getenv("SystemRoot");
strmDir << "\\System32" << ends;
You can string the insertions out in one line. I broke them up into seperate lines because of the horixzontal linitation of this window.
The size of 128 is arbitrary. You could use "MAX_PATH" or "_MAX_PATH" depending on other includes in your program
|
|
|
|
|
Anonymous wrote:
strmDir << getenv("SystemRoot");
Not only does this rely upon environment variables, which I consider a bad practice, it does not include "System" or "System32" in the returned value.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
GetSystemDirectory[^]?
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
The include in the previous response should have been strstrea.h
|
|
|
|
|
Hi,
I have a MSHFlexgrid with a list of names. when you press eg. 's' the first name that starts with an 's' is highlighted and the list scrolls down. If I then press 'a' however, the name is highlighted, but the view doesn't scroll up.
I've tried about every function with "scroll" in it( ) and even refreshing and 'scrolling' down from the start, but nope...
anybody got some clue on how to solve this?
(in meantime I do keep searching )
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I'm looking for a generic/convenient solution to the following common pattern:
X * GetX()
{
static X * x = NULL;
if (x == NULL)
x = CreateX();
return x;
}
I know hot to make it threadsafe, etc, but would love to find something "well tested", threadsafe, and convenient.
Any links?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
You could use a static CCriticalSection which you Lock() and Unlock() within the X::GetX() method. That should ensure the singleton nature of your code.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
yes, I'm using that -
however, with all the gotchas (e.g. this pattern is said to be unsafe with agressive optimizers on multiprocessor boxes, "so turn optimizations off") this is a fairly "dangerous" piece of code, and I was wondering if there was a "proven correct" generic function that does that for any type T and different Initializers.
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
Dare I suspect suggest doing something as primitive as locking a memory mapped file for exclusive access? Would that work across processor boundaries? Just a thought!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I have an application which is developed in VC++ 6 under a Windows 2000 machine. This application opens an Access database (it works with a class which is derived from CDaoRecordset).
I want to run this app under a windows 98 system which has installed just the Ms Office 2000.
I made a setup with InstallShield for Microsoft Visual C++ 6 and I include in the setup the ADO DB drivers.
I have to say that I convert the database that I want to open to a previous version (Ms Access 97).
During the opening of the database (under windows 98) I get an error saying "Abnormal program termination".
Can anyone please help me with this issue?
Thanks in advance
dimitris
|
|
|
|
|
I think the only solution is to debug your application under Windows 98. The fact is that Windows 98 is less permissive for some bad operations, or some bugs. For example, I will tell you my experience with a problem I had.
I developed an application that uses ADO to connect to a SQL Server database. I had a CWinApp member variable called m_Database which was initialized in InitInstance method.
In order to use ADO, I had to use CoInitialize(NULL) in InitInstance and CoUninitialize in ExitInstance. Note that the m_Database destructor was responsible to close and release ADO objects.
All works perfectly under Windows 2000 and XP, but in Windows 98 application crashed at exit.
The cause of the problem: CDatabase destructor was called at the end of ExitInstance, of course, after CoUninitialize. Since COM was uninitialized when I tried to release COM interfaces, application crashed, but only in Windows 98. In Windows 2000 and XP, application exited the normal way.
The solution: declare the member as * m_pDatabase, and delete it before CoUninitialize.
I could realized of that only by debugging it in Windows 98.
This wasn't the only problem I had when running the application in that platform.
Jaime
|
|
|
|
|
Does anyone know where I can find the bit structure of a 16bit signed short?
Joel Holdsworth
|
|
|
|
|
platform dependent, but on "everything useful I know" it's 2's complement:
0..0x7FFF are nonegative values 0..32767
0xFFFF..0x8000 are negative values -1 .. -32768
(incrementing 0x7FFF == 32767 rolls over to 0x8000 == -32768)
data is stored either least significant byte FIRST or LAST.
Intel x86/pentium platforms use LSB first, so a 0x7FFF is actually stored as
[0xFF] [0x7F] in memory.
BIT position is a "mu" question in C/C++ and even assembler (i.e. it typically doesn't make sense to discuss if the most or least significant bit is stored first, unless you want to re-wire your motherboard)
Hmm... anythign I forgot?
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen
|
|
|
|
|
Thanks; that's very useful!
Joel Holdsworth
|
|
|
|