Problem with fstream in my SDI application!
I recently started to use a couple of stream routines in my
application, problem is that if I try to compile in debug mode I get
the following compiler error:
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\fstream(465) : error C2061: syntax error : identifier
'_DebugHeapTag'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\fstream(457) : while compiling class-template member
function 'void std::basic_filebuf<_Elem,_Traits>::_Initcvt(std::basic_filebuf<_Elem,_Traits>::_Cvt
*)'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\fstream(484) : see reference to class template
instantiation 'std::basic_filebuf<_Elem,_Traits>' being compiled
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
The problem occurs whenever I include fstream, #include <fstream>.
Thanks,
Mike Tag: changing window brush Tag: 243116
C++ operators, how to export them in a DLL?
Hi,
I'm having problem exporting a c++ class to a DLL correctly. Basically,
those operators (such as bool operator==(......) {} ) aren't being exported.
Although other things are going fine.
I'm wondering if it's possible to export c++ operators in a DLL?
Best regards,
--
He Shiming Tag: changing window brush Tag: 243114
Getting the console screensize
Apologies if this is not the most correct group for this question...
I have a console application (running in a COMMAND PROMPT) and I need to
detect the width in columns of the console?
Any ideas? Tag: changing window brush Tag: 243112
Register Message between MFC and Win32 SDK Application
i want to comunicate between two windows(sepearte exe's)
one is build by MFC and another is build by win32 SDK
in MFC app i registered one Message and broadcast it to all windows
and i want to get it and process in another windows os win32 SDK.....
consider an simple Example:-
i have two exe's
one is 1.exe and another is 2.exe
i have one button in i.exe labeled as "Open Child"
i have one more button in i.exe labeled as "Close Child"
Open Child will open 2.exe
and Colse Child Should close 2.exe
How can i register an Message that should be unique!....
plz can u send me sample code for the above problem.......
Thnaks
-Renugopal Tag: changing window brush Tag: 243104
Register Message between MFC and Win32 SDK Application
i want to comunicate between two windows(sepearte exe's)
one is build by MFC and another is build by win32 SDK
in MFC app i registered one Message and broadcast it to all windows
and i want to get it and process in another windows os win32 SDK.....
consider an simple Example:-
i have two exe's
one is 1.exe and another is 2.exe
i have one button in i.exe labeled as "Open Child"
i have one more button in i.exe labeled as "Close Child"
Open Child will open 2.exe
and Colse Child Should close 2.exe
How can i register an Message that should be unique!....
plz can u send me sample code for the above problem.......
Thnaks
-Renugopal Tag: changing window brush Tag: 243103
MFC Sockets Query?
Hi experts
This is my first experience with Sockets Programming.
I am purely using MFC on both sides -- Server(Dialog based application with
3 buttons <Start server, Send data & shutdown server>).
The client application is an Windows explorer type MFC SDI application.
After the connection is established & when the <Send data> button is clicked
on the server side, names of all the folders in C:\ is send one by one to
the client for display in the tree view.
Now i have 2 questions to ask:
Q1--> How can i make sure that the Port No. that i will provide in the
Create() will be to create socket on each & every system?
Q2--> Now suppose the data ie folder names are being send from server to
client & in the mean time i purposely pulls out the network cable. Now under
such circumstances how wud the client know that the connection with the
server is disrupted & no more data transfer cud take place?
waiting for suggestions
Regards Tag: changing window brush Tag: 243101
LNK2005
Hi,
I get the error lnk2005 multiple defined symbol, because I have
non-member functions defined in a header file, that is included in
multiple compilation units.
If they were normal functions I'd make them static member functions. But
they're operators.
Is there a solution for this problem? Is is a MVCPP problem or is it a
c++ issue?
thanks
Ingo Tag: changing window brush Tag: 243095
MFC ActiveX Control in VC++
Hello,
I am using MS VSIDE 2003. I want to create a simple MFC ActiveX control. I create the
control as follows, but it gives me Catastrophic Error. Please let me know where I am
doing wrong.
I create the project, name is SMath, the name of the control. I select "Invisible at
runtime" checked, and all other options unchecked.
After creating the project, in the Class View write click on the Interface node, and add
the method, say
LONG AddVal(LONG v1, LONG v2); class wizard create the method, and the method in the
control defination, I just add the code...
return v1 + v2;
and compile the project. I also create the test project and add the class created from the
SMath typeLib. After this created the instance, and the CreateDispatch, properly.
CreateDispatch works correct, and not throwing any error, and returns 1 as success. When I
try to use the method on the control it gives me the exception, and error says,
"Catastrophic Error". Am I really doing catastrophically? I create the same project in ATL
by adding the simple object and it works perfect. I also add the AddVal method, as
follows...
HRESULT AddVal(LONG v1, LONG v2, LONG *retVal); with appropriate code. But still it
gives me the same error.
I appreciate your help. If the steps that I am using while creating the project are not
correct, then please provide the steps. I want absolutely a simple control, w/o window.
One more thing, I test my control in the ActiveX Test Container, and it works fine,
invokes method correctly, but in the test project it is not working.
Thanks, Tag: changing window brush Tag: 243092
Memory dc usage
I have noticed that most memdc are created within a function and then
released. Usally in OnDraw. Is there anything wrong with creating the memdc
in your windows wm_create and then freeing it when you close your window. I
mean what are the pros and cons to lonf term memdc use? Tag: changing window brush Tag: 243085
"Streams"
hello
I hope somebody can help me get my head around this area of 'stream'
programming... I know that streams are very fashionable nowadays so
hopefully there'll be lots of replies. ;-)
Basically I have an operation which the input and output for are streams -
a function which receives a certain 'chunk' of data each time it runs, and
it runs many times until it has received all the data, in a similar way to
a socket.
What the processing involves is treating the data like a string, and
picking out certain 'words' and putting 'tags' round them. For instance,
say if the word 'dog' came along, I want to replace it with
<animal>dog</animal> or something like that.
So that if the input stream was "table kennel dog coffee beer" the output
stream would be "table kennel <animal>dog</animal> coffee beer" or
something like that.
So say, if in a stream-like fashion, the stream function was called 5
times, each receiving 100 bytes of a transmission which is 500 bytes
in total.
What if the word 'dog' occurred from characters 99 to 101?
The first invocation would *end* in the characters "...do" and the second
would start with the characters "g ..."
I can't think how I can solve this, it is eluding me unfortunately. It
sounds like it should be simple, but isn't. I need to do it in a way that
doesn't involve storing the whole string in memory at once (for
performance reasons - the whole data might be as large as 64K), and hope
somebody can shed any further light on it!
Please don't say "You need to examine the bytes at the end of one
invocation and compare them with the ones at the start of the next"...
because I know this is *what* I've got to do, the question is *how*? Tag: changing window brush Tag: 243079
How to integrate an MFC 7.0 DLL into a standard C++ application
Hi
How to integrate an MFC 7.0 DLL into a standard C++ application.
I'm going to use an OPC Toolkit for C++ and have to interface my MFC DLLs.
How do I do this?
Any recommendations? Links?
Regards
Kjell Arne Johansen Tag: changing window brush Tag: 243078
Memmory dc and fonts
I am new to using memory dc's. My drawtext function is drawing the wrong text
type to my memdc. Text comes out bold and wrong text type. So my question is,
how do I set the memory dc to the same font as my windows dc?So that the text
will appear the same. My code is below. It is basically a ownerdrawn cbutton.
Thx ahead of time for any help.
CDC memdcRaise;
TCHAR buff[MAX_PATH];
int a = GetWindowText(buff,MAX_PATH);
//Get client size
CRect ct;
GetClientRect(&ct);
CBitmap rbm;
memdcRaise.CreateCompatibleDC(GetDC());
rbm.CreateCompatibleBitmap(GetDC(), ct.Width(), ct.Height());
HBITMAP oldBitmap = memdcRaise.SelectBitmap(rbm);
memdcRaise.FillRect(ct,CreateSolidBrush(GetSysColor(COLOR_BTNFACE)));
memdcRaise.SetBkMode(TRANSPARENT);
memdcRaise.DrawText(buff,a,&ct,DT_VCENTER | DT_SINGLELINE | DT_CENTER); Tag: changing window brush Tag: 243073
functionally equivalent
According to Petzold:
printf("The sum of %i and %i is %i", 5, 3, 5+3);
and
char szBuffer[100];
sprintf(szBuffer, "The sum of %i and %i is %i", 5, 3, 5+3);
puts(szBuffer);
are functionally equivalent.
Consider this small c program:
/* lines3.c */
void main(void){
int x, y;
char szBuffer[100];
for (y =3D 1; y < 24; y++){
for (x =3D 1; x < 24; x++)
if ((x =3D=3D y || x =3D=3D 24 - y) && y !=3D 12){
// sprintf(szBuffer, "\xDB");
printf("\xDB");
// puts(szBuffer);
} else
printf("\xB0");
printf("\n");
}
return;
}
This is a command console application which makes a design when run. cl =
lines3.c should get the executable.
But if we uncomment the sprintf and puts statements and comment out the =
accompanying printf the result is very different.
So that tells me they are not functionally equivalent. What's the =
trouble here?
--=20
George Hester
_________________________________ Tag: changing window brush Tag: 243069
Template of interface?
Hello
How do I declare a template class such that the template class T must
implement a certain interface?
e.g.
interface IProvideID
{
int MyID;
};
template<type T>
class ListOfIDs
{
public int add(T& newitem)
{
return newitem.MyID; //(this is what I want to do)
}
}; Tag: changing window brush Tag: 243064
Reading Pipe & Log
Hi,
I'm looking for some idea of using a listbox instead of a textbox to
log.
Presently I'm using a multiline textbox with code like:
char buf[1024];
DWORD red;
ZeroMemory(&buf,sizeof(buf));
while((ReadFile(hPipeRead,buf,sizeof(buf),&red,NULL)) !=0 )
{
SendMessage(hLogEdit, EM_REPLACESEL, FALSE, (LPARAM)buf);
ZeroMemory(&buf,sizeof(buf));
}
I also thought about RichTextBox(...in that case I don't have to change
anything in the code...), but I don't know how to initz. it on Non-MFC
app.
Any advise are welcomed...
--
playwin Tag: changing window brush Tag: 243054
Reading Pipe & Log
Hi,
I'm looking for some idea of using a listbox instead of a textbox to
log.
Presently I'm using a multiline textbox with code like:
char buf[1024];
DWORD red;
ZeroMemory(&buf,sizeof(buf));
while((ReadFile(hPipeRead,buf,sizeof(buf),&red,NULL)) !=0 )
{
SendMessage(hLogEdit, EM_REPLACESEL, FALSE, (LPARAM)buf);
ZeroMemory(&buf,sizeof(buf));
}
I also thought about RichTextBox(...in that case I don't have to change
anything in the code...), but I don't know how to initz. it on Non-MFC
app.
Any advise are welcomed...
--
playwin Tag: changing window brush Tag: 243053
Trouble getting this template to compile under VC7.1
I am having problems compiling an app that simply includes the following
template definition, any idea why?:
template<> struct get
{
inline static SQInteger from(HSQUIRRELVM v, int idx)
{
SQInteger p;
if (SQ_FAILED( sq_getinteger (v, idx, &p) )) throw exception(v);
return p;
}
};
Here is the error I'm getting from VS.NET 2003
\primitives.hpp(18) : error C2143: syntax error : missing ';' before '<'
\primitives.hpp(18) : error C2913: explicit specialization;
'squadd::types::get' is not a specialization of a class template
\primitives.hpp(18) : error C2059: syntax error : '<'
\primitives.hpp(19) : error C2143: syntax error : missing ';' before '{'
\primitives.hpp(19) : error C2447: '{' : missing function header (old-style
formal list?) Tag: changing window brush Tag: 243048
error C2065: '_endthread' : undeclared identifier
hi to all,
i m creating a simple win32 chat application, when i run my application in
debug mode its run perfectly.
but in release mode this error will occur
error C2065: '_beginthread' : undeclared identifier
error C2065: '_endthread' : undeclared identifier
I dont know why
please help
Manoj Tag: changing window brush Tag: 243046
Problem with char arrays
I have written a simple console app to learn how to handle char arrays. My
program (code is below) simply lists the files in the current directory.
When you run it you'll notice that "After" always displays the last file.
"Before" is correctly showing each file.
If you can point me in the right direction I would be grateful.
Thanks,
Roland
#include "stdafx.h"
#include <windows.h>
int main(int argc, char *argv[])
{
WIN32_FIND_DATA FindFileData;
HANDLE hFile;
BOOL fDone = FALSE;
char szFilter[MAX_PATH];
LPCSTR lpFiles[255];
LPCSTR* lpFileNames;
LONG lpStatus[255];
int nIndex = 0;
int nFiles = 0;
lpFileNames = lpFiles;
strcpy(szFilter, "*.*");
hFile = FindFirstFile(szFilter, &FindFileData);
if( hFile == INVALID_HANDLE_VALUE ){
printf("FindFirstFile Failed!\n");
return(0);
}
printf("Before:\n");
while( !fDone ) {
if ( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
} else {
lpFileNames[nFiles] = FindFileData.cFileName;
printf("%s %s\n", FindFileData.cFileName, lpFileNames[nFiles]);
lpStatus[nFiles] = FindFileData.nFileSizeLow;
nFiles++;
}
fDone = !FindNextFile(hFile, &FindFileData);
}
FindClose(hFile);
printf("\nAfter:\n");
for (nIndex = 0; nIndex < nFiles; nIndex++)
{
printf("%d %s %d\n", nIndex, lpFileNames[nIndex], lpStatus[nIndex]);
}
return 0;
} Tag: changing window brush Tag: 243045
please review: simple winsock example for sending data over a nonblocking socket
please review: simple winsock example for sending data over a nonblocking
socket
I put together a simple winsock example for sending data over a nonblocking
socket because i could not find such a simple example on the internet.
please tell me if you see any MEMORY LEAKS, RESOURSE MISUSE, or other
critical issues with this code: http://rafb.net/paste/results/mZAzaI55.html
I would like this to be perfect as i will use it over and over. Any
meaningfull and focused suggestions appreciated. In no case should this code
hang because of any kind of network or remote server issue. And in no case
should it leak memory or resources:
#include "stdafx.h"
#include <winsock2.h>
#pragma comment(lib, "ws2_32.lib")
int main(void);
int genericstream(char*, int, char*, int);
int main(void)
{
char* pData = new char[12];
char* pIp = new char[11];
memcpy((void*)pData, (const void*)"hello world", 11);
pData[11] = ' ';
memcpy((void*)pIp, (const void*)"3.3.3.222", 10);
pIp[10] = '\0';
int ret = genericstream(pData, 12, pIp, 11);
pData[4] = '\0';
delete[] pData;
delete[] pIp;
return 0;
}
int genericstream(char* a, int iLen, char* pIp, int iIpLen)
{
int sock;
try
{
WSADATA wsaData;
//load winsock dlls if not already loaded
if(WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
{
return 1;
}
//create a socket
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == INVALID_SOCKET)
{
WSACleanup();
return 1;
}
unsigned long ulMode = 1;
//make the socket connect operation
//return right away even if the
//remote computer hangs on connect
//e.g. nonblocking socket
ioctlsocket(sock, FIONBIO, &ulMode);
sockaddr_in clientService;
clientService.sin_family = AF_INET;
clientService.sin_addr.s_addr = inet_addr( pIp );
clientService.sin_port = htons(8888);
memset(clientService.sin_zero, 0, 8);
//try to connect, should return SOCKET_ERROR most of the time as the
connect
//is on a nonblocking socket
if(connect( sock, (SOCKADDR*) &clientService, sizeof(clientService) ) ==
SOCKET_ERROR)
{
if(WSAGetLastError() == WSAEWOULDBLOCK)
{
fd_set fsConnect;
FD_ZERO(&fsConnect);
FD_SET(sock, &fsConnect);
timeval sTimeoutVal;
sTimeoutVal.tv_sec = (long)30;
sTimeoutVal.tv_usec = (long)0;
//wait up to 30 seconds for the socket to complete connecting, unless
the target computer, network or
//internet is hanging this should return with 1 right away
int retval = select(FD_SETSIZE, (fd_set *) NULL, &fsConnect, (fd_set *)
NULL, &sTimeoutVal);
if(retval != 1)
{
//connect timed out
//close socket and remove a winsock reference count
closesocket(sock);
WSACleanup();
return 1;
}
}
else
{
//connect failed right away, no need to select status of socket
//close socket and remove a winsock reference count
closesocket(sock);
WSACleanup();
return 1;
}
}
//send data
int iBytes = send(sock, a, iLen-1, 0);
if(iBytes == -1 || iBytes != iLen-1)
{
//send failed, perhaps target application or machine went down
//close socket and remove a winsock reference count
closesocket(sock);
WSACleanup();
return 1;
}
//close socket and remove a winsock reference count
closesocket(sock);
WSACleanup();
}
catch(...)
{
try
{
closesocket(sock);
WSACleanup();
}
catch(...)
{
}
return 1;
}
return 0;
} Tag: changing window brush Tag: 243044
possible unnamed temporary problem?
Hi,
I have code that goes something like
LNstring s = LNstring::convert(i) + ":" + LNTableMsg(vect[i]).toStr() +
LNLog::getMsgFieldSeparator();
and causes a crash. Stepping it through the debugger I noticed that the
statements are executed in the following order:
1) LNLog::getMsgFieldSeparator()
2) LNTableMsg::LNTableMsg(vect[i])
3) LNstring::convert(i)
Crash!!!
I was wondering if there is a possible compiler issue here with MSVC's
handling of unnamed variable LNTableMsg (hence .toStr() was never called)
Any info is appreciated!
thanks,
max Tag: changing window brush Tag: 243039
MDI Children
Given a MDI Parent Window Handle, how can I enumerate all the form
windows( handles) that are children of the MDI ? I tried GetWindow but
always returns 0 ! Tag: changing window brush Tag: 243036
Problems with printf() and globals in multi-threaded app?
I hope someone can point me in the right direction. I'm having problems
with a console app I'm writing in MSVC using multiple threads. I assume
that there is a setting I need to enable, function I need to call or
some struct I need to initialize to get around these problems which seem
somewhat related (accesses to global resources).
Before someone suggests it, I've got the build settings setup for
multi-threaded libs (MT d)
Application description:
The app is a simulation of another (embedded) OS and starts by setting
the base thread, main(), the highest priority
(THREAD_PRIORITY_TIME_CRITICAL) it then does a _beginthreadex(),
CREATE_SUSPENDED, to create three child tasks setting their priority to
THREAD_PRIORITY_LOWEST. The main() thread is used to control which one
of the three other threads is currently running. It does this by doing a
SuspendThread() on the current child thread that is running and a
ResumeThread() on the thread to run followed by a Sleep(1) on the main()
thread. When main() wakes up it decides which of the three to run and
goes through the process again. The main() thread does nothing else
except debug printf(). The three spawned threads make a lot of calls to
printf() and access application globals. The spawned threads have no
local variables.
The problem(s):
The printf() calls by the child threads, there's a LOT of them, seem to
be locking up the application. They will run for a little while (a
couple dozen printf() calls, then freeze. If I step the code in debug
the problem goes away. If I disable the printf() calls, the problem goes
away. If I have the child threads use sprintf() and route the results
through the main() letting the main() thread handle all printing they
run fine.
The threads also seem to be having problems with accessing global memory
in the order they are told to access it. A variable will have the same
data that was read last time the thread ran even though another thread
has modified the variable. I'm using 'volatile' qualifiers on all
globals so that isn't the problem. I've seen this happen when stepping
through the code in debug. As an example, thread #2 will set a variable
and wait (watchdog counter method) for another thread to change it.
Thread #3 changes it and when thread #2 runs again it still doesn't see
the change.
If anyone has any idea what I'm missing, it would be greatly appreciated!
Grant Killey Tag: changing window brush Tag: 243032
Typecasting without the correct constructor
Hi there,
I'm having problems typecasting an object in C++. What I have is
several classes derived from 1 base class but the derived classes implement
their own unique constructors. I only have references to the base class and
at the moment I am having problems trying to call a method of the derived
class via type casting as the constructors do not match.
Is this not possible to do in C++? Or do I have to make solid references
to the child classes from the beginning? Thanks *loads* in advance!
--
Nick Pateman
---------------------------------------------------------------
Any views expressed above are my own
Without predjudice Tag: changing window brush Tag: 243029
How to popup a chat-dialog by hotkey when playing game in full scr
How to popup a chat-dialog by hotkey when playing game in full screen mode?
I want to make a program to do this, then I can play games while chating
with my friends. The question is the game should still in full screen mode
and still be running when the dialog pop up. The two should coexistence.
--
Because we are curious.
Because we are lazy.
Because we are not so able. Tag: changing window brush Tag: 243022
help on setwindowrgn
hi,
Can i get any help on how to use SetWindowRgn to create transperant region
on the Desktop,the issue was pretty straight forward in the case of winNT
but getting weird results in the case of win98. Tag: changing window brush Tag: 243020
Terminating processes
My application, A say, lunches another one, B, - written somewhere
else by someone else and of which I know nothing about the source
code. B puts up a window showing some information.
I do this with CreateProcess, and I would need my program to be able
to shut B down again under various circumstances.
One way of doing this appears to be with TerminateProcess (using the
process handle I get back from CreateProcess). But the
documentation warns me that this is a draconian operation only to be
used in dire emergencies.
Is there a better way?
Dave
--
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm Tag: changing window brush Tag: 243016
Problem closing handle
Anyone any idea why I could get the following exception when debugging a COM
module using VB:
First-chance exception in VB.EXE (NTDLL.DLL): 0xC0000008: Invalid handle
If I create a ReleaseMinSize module, VB just terminates, no messages or
anything.
The handle was opened OK and the file I created exists and contains the
right data, it's just when CloseHandle(hFile) is called that the exception
is thrown. I cannot understand what's causing it.
Dave Tag: changing window brush Tag: 243013
Side-by-Side Assembles on XP -using mainfest for COM components
Hi
We have an App with COM dlls. I want to run old and new version of this App
which contains different
COM dll versions.
I was curious if anyone has attempted Side-by-Side Assemblies on XP using a
manifest???
I have a couple questions
1)Is this correct - There is a Application manifest for the EXE that lists
all the dll's I want to
use different versions of ?? If my App uses foo.dll and mydll.dll and
foo.dll is the only one that may have
multiple versions - this is the only dll that needs to be in the
Application manifest???
2)Every COM dll that I want to have multiple versions on the machine - I
need to create
an assemble manifest for that COM dll and the dlll will also be listed in
the Application manifest???
Where do the assemble manifest get stored??? How does windows find them
to read???
3)The old and new app would have different versions of COM dlls. If I have a
COM dll foo1.dll and that #imports of COM dlls foo2.dll and foo3.dll - do I
list all 3 dll in the application manifest???
Do I need 1 assemble manifest for each dll???
4)Do I need to list only the dll's that I know will be different between the
2 Apps???
If I need msado015.dll but it doesn't matter what version - do I need to
list in application manifest??
Any other helpful tips ???
Thanks Tag: changing window brush Tag: 243010
Explicitly calling constructors/destructors
Suppose you have a memory pointer to some allocated memory and a class.
How can you call the constructor of the class so that it operates on your
memory?
The same question goes for the destructor.
Something like this:
class A;
void* tmp_buff;
((A*)tmp_buff)->A();
((A*)tmp_buff)->~A(); Tag: changing window brush Tag: 243005
new and delete operators for a class..
I want to add a new operator for one of my classes, that looks like this:
void* operator new(size_t Size, void* tag);
What should look like the delete operator?
If I use something like this:
void operator delete(void* Buffer, void* tag)
it will not be called when I "delete" a class instance.
If I use a delete operator like this:
void operator delete(void* Buffer)
It will be called, but I will get a complie warning because it's not
matching my new operator.
So, what is the right delete operator? Tag: changing window brush Tag: 243001
Using GDI+ in C++
Hi there,
I'm having problems include gdiplus.h in my C++ application, I get a
huge list of compiler errors. My stdafx.h looks like this
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows
headers
#include <windows.h>
#include <windowsx.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>
#include <string>
#include <time.h>
#include <iostream>
#include <Winsock2.h>
#include <gdiplus.h> << Causes 560 build errors!
using namespace std;
I've tried removing WIN32_LEAN_AND_MEAN but that just caused different
errors to occur. Any ideas with this one? I'm hoping that I do not need to
use MFC or ATL with this do I? I need to use only standard windows
libraries. Thanks loads in advance!!
BTW. Look below for some of my error list
Nick.
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2059: syntax error
: 'public'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2059: syntax error
: 'public'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2059: syntax error
: 'public'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2059: syntax error
: 'public'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2059: syntax error
: 'public'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2146: syntax error
: missing ';' before identifier 'IImageBytes'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2146: syntax error
: missing ';' before identifier 'IImageBytes'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2146: syntax error
: missing ';' before identifier 'IImageBytes'
c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include\GdiPlusImaging.h(67): error C2146: syntax error
: missing ';' before identifier 'IImageBytes'
c:\Program Files\Microsoft Visual Studio .NET
.... Tag: changing window brush Tag: 242995
VC 7 DLL Export
Hello,
i want to create a dll with some exported functions. Normally this
isnt a problem, but with VC 7 and my current problem ive got the
following Linker warning/error:
warning LNK4017: EXPORTS statement not supported for the target
platform; ignored
I created the project using the "Win32 Project->DLL" wizard. The
function to export is defined as WINAPI and listed in the EXPORTS
section of the def file.
Without the def file all things are compiled/linked without problem,
but also without export ;)
Thank you for any ideas in advance.
Ciao Danilo Tag: changing window brush Tag: 242991
Do you think this is possible?
I have a third party 'EXE' that contains a number of windows in it. By
sending a message to the EXE I can get it open any screen. But I need this
screen to be created in *my* windows app ! or at least to set the parent of
the created form equal to my MDI ? Is this possible at all ?
In short , what I am trying to achieve is to create something like a notepad
window within my MDI. Is this possible ? Tag: changing window brush Tag: 242989
Buffer Overrun
Hi,
I'm working on a Direct3D Project. This might not relevant though but part
of it has a DirectInput routine. The d3d app launches and exception throws
at me saying that buffer is overrun and the app must be terminated. What
most likely be the cause of buffer overruns? Thanks
PS: I have to cross-post as this is a hybrid question
Jack Tag: changing window brush Tag: 242966
A problem with the code: getline(fp,line);
The arguments are:
FILE* fp; // a file pointer
string line;
I am getting the following 3 error messages:
f:\X.cpp(214): error C2039: 'getline' : is not a member of
'std::basic_string<_Elem,_Traits,_Ax>'
with
[
_Elem=char,
_Traits=std::char_traits<char>,
_Ax=std::allocator<char>
]
f:\X.cpp(214): error C2784: 'std::basic_istream<_Elem,_Traits>
&std::getline(std::basic_istream<_Elem,_Traits>
&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template
argument for 'std::basic_istream<_Elem,_Traits> &' from 'FILE *'
f:\X.cpp(214): error C2780: 'std::basic_istream<_Elem,_Traits>
&std::getline(std::basic_istream<_Elem,_Traits>
&,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : expects 3
arguments - 2 provided
The only examples I saw anywhere are with the first argument being 'cin'.
Can't it be just any file pointer?
Anybody understand the error messages?
Thanks,
David Tag: changing window brush Tag: 242963
BigInt lib not working, help!
Hello,
I use BigInt lib from:
http://www.codeguru.com/Cpp/data/data-misc/values/article.php/c4563/
It doesn't work properly. I describe my problem:
http://www.codeguru.com/Cpp/data/data-misc/values/comments.php/c4563/?thread=5367
Please, help me!
If anybody have good version of the bigint lib, tell me please.
I need use only / * - + operator.
Thanks! MK
--
email: http://tiny.pl/p8 Tag: changing window brush Tag: 242949
redrawing in control with Invalidate()
I have a CStatic which displays a plot - X, Y axes, tickmarks, etc. I
want to change scaling of the plot by entering new ranges of X and Y. I
call an overriden OnPaint for that:
CPlot::OnPaint() {
this->Invalidate()
CPaintDC dc(this);
... draw lines and labeles
DeleteDC(dc);
}
The problem is that it gets redrawn on top of the prevous drawing, w/o
first erasing the prevous drawing. I also tried InvalidateRec() w/o
success.
I guess I can fill the whole area with a background color, but this
seems lame. A search of this group showed that Invalidate should work,
but it doesn't! What's the solution then?
BTW... is there a quota of how many questions per day one can ask here?
:) I wonder if I am abusing this group. Tag: changing window brush Tag: 242942
Querying Server OS
I have a small application running on a small network file server. I
wish to access the usernames and IP addresses of clients currently
logged onto the server.
Could anyone point me in the right direction on how to query the
server to find out that information?
Thanks
Tim Tag: changing window brush Tag: 242936
Assertion error when using Free (non-local pointer)
Hi all, my application uses callback function in DLL (Written in C),
The DLL sniff's the network card and then allocates new data dynamically
using malloc() function ,
Then the data (pointer) passed to the host application (MFC),
After I use the data and copying it, I'm trying to free the space using
Free()
But I get an Assertion error,
After running step by step inside MS code I see that free() function check's
if the new memory was allocated inside the current app (local) , if the
memory wasn't allocated inside then Assertion error occur .
How do I free memory from other application?
[DLL]
| |
| |
[App]
steps :
1.. Application init the DLL and run it, the DLL now runs separately from
the app .
2.. when ever the DLL find network data , it will allocate memory space
,and process incoming data
3.. Then it will notify the application using callback function, and pass
the application a pointer to the new allocated space.
4.. the application uses the memory
5.. Application try to free the memory using the free function - Assertion
Error !!!!!
Env : Vs.net IDE (NO DotNet involved , pure c/c++ code .)
Win xp
Thank you very much
Sharon.G Tag: changing window brush Tag: 242935
Run-time stack frame checks - false alarm?
I get a run-time check failure message, saying:
"Run-Time Check Failure #2 - Stack aroung the variable ... was corrupted."
1. I'm almost sure that my stack is not corrupted!
2. When I copy the func to another file, rename the copy, and call the copy
instead, the run-time check message does not show.
My question is: when such a message appears, does this necessarily mean that
there is a problem with the source or this may be a false alarm? Tag: changing window brush Tag: 242928
Multiple compiler errors - this could hurt your eyes...
sources : private, but very awesomely ass-huge sources.
bug : I'm compiling, and on many occasions, the compilation dies with this.
it ALWAYS dies this way, i think.
hint : always seems to crash on cxx files (c++ surely?)
possible solution : move to gcc?
informations :
Compiler : Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077
for 80x86 -- the one that comes with Vs .net 2003
OS : Windows XP with Multilanguage user interface (we're msdn members where
I work)
tree : a mix of C, C++, and rarely but sometimes fortran.
UC : small P4 1.7 with 512 mb RAM.
strangely, all seemed to compile propely with the VC++ 6.0 compiler. Some
people tell me it's just that .net plain s***s. While i'm more of the
GNU/F_OSS breed and tend to have these type of opinions, this time i don't
have them, as i am slowly having respect for microsoft.
so, did VC .net 2003 break the compiler?
if so, does VC Whidbey un-break it?
Error log:
<removed to keep our sources to ourselves>
cl -c /nologo /W3 /GX /Gi- /MD /YX /Zi /Od /Gm /GZ /c /Zm500 /Fd.\ /D
"MOTIFAPP" /D "WIN32" /D "_WINDOWS" /D_WIN32_WINNT=0x0500 /D "_AFXDLL" /D
"NOCRYPT" /D "ORACLE_AVAILABLE" /D "_RWTOOLSDLL" /D "RW_NO_STL=1" -D
"Z_NTUSEDLL" -D "Z_NP=1" -D "Z_DB=1" -DOEMRESOURCE /D "EMS" /D "ASC_PRESENT"
/D "NAS_PRESENT" /D "OPS_PRESENT" /D "PSS_PRESENT" /D "PDMS_PRESENT" /D
"PEMS_PRESENT" /D "GDM_PRESENT" /D "PDB_PRESENT" /D "GVC_ZAPP_BASED_TABLE" /D
"WIN32_LEAN_AND_MEAN" -DBUILDING_LIB -DBUILDING_LIBECMS -I"(our include dir
1)" -I"(our include dir 2)" -I"(our include dir 3)" -I"(our include dir 3)"
-I"C:\Program Files\Hummingbird\Connectivity\7.10\Exceed\XDK\Motif12\include"
-I"C:\Program Files\Hummingbird\Connectivity\7.10\Exceed\XDK\include"
-I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include"
-I"C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\include"
-I"C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\PlatformSDK\Include" -I"(our include dir 4)" (path of cxx file)
-Fo(path of .obj)
(random cxx file name)
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(98)
: warning C4346: '_Iter::iterator_category' : dependent name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xutility(104) : see reference to class template
instantiation 'std::iterator_traits<_Iter>' being compiled
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(98)
: error C2146: syntax error : missing ';' before identifier
'iterator_category'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(98)
: error C2501: 'std::iterator_traits<_Iter>::iterator_category' : missing
storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(99)
: warning C4346: '_Iter::value_type' : dependent name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(99)
: error C2146: syntax error : missing ';' before identifier 'value_type'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(99)
: error C2501: 'std::iterator_traits<_Iter>::value_type' : missing
storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(100)
: warning C4346: '_Iter::difference_type' : dependent name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(100)
: error C2146: syntax error : missing ';' before identifier 'difference_type'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(100)
: error C2501: 'std::iterator_traits<_Iter>::difference_type' : missing
storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(101)
: error C2146: syntax error : missing ';' before identifier 'distance_type'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(101)
: error C2086: 'T1::difference_type difference_type' : redefinition
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xutility(100) : see declaration of
'std::iterator_traits<_Iter>::difference_type'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(101)
: error C2501: 'std::iterator_traits<_Iter>::distance_type' : missing
storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(102)
: warning C4346: '_Iter::pointer' : dependent name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(102)
: error C2146: syntax error : missing ';' before identifier 'pointer'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(102)
: error C2501: 'std::iterator_traits<_Iter>::pointer' : missing storage-class
or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(103)
: warning C4346: '_Iter::reference' : dependent name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(103)
: error C2146: syntax error : missing ';' before identifier 'reference'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(103)
: error C2501: 'std::iterator_traits<_Iter>::reference' : missing
storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(200)
: warning C4346: 'std::iterator_traits<_Iter>::iterator_category' : dependent
name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(200)
: error C2146: syntax error : missing ';' before identifier '_Iter_cat'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(200)
: error C2501: 'std::iterator_traits<_Iter>::iterator_category' : missing
storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(200)
: error C2143: syntax error : missing ',' before '&'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(486)
: warning C4346: 'std::iterator_traits<_Iter>::difference_type' : dependent
name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(486)
: error C2146: syntax error : missing ';' before identifier 'distance'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(486)
: error C2501: 'std::iterator_traits<_Iter>::difference_type' : missing
storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(486)
: error C2065: '_InIt' : undeclared identifier
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(486)
: error C2146: syntax error : missing ')' before identifier '_First'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(486)
: error C2501: 'distance' : missing storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(486)
: error C2059: syntax error : ')'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(497)
: error C2143: syntax error : missing ';' before '{'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(497)
: error C2447: '{' : missing function header (old-style formal list?)
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: warning C4346: 'std::iterator_traits<_Iter>::iterator_category' : dependent
name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xutility(621) : see reference to class template
instantiation 'std::reverse_iterator<_RanIt>' being compiled
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: error C2923: 'std::iterator' :
'std::iterator_traits<_Iter>::iterator_category' is invalid as template
argument '#1', type expected
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: warning C4346: 'std::iterator_traits<_Iter>::value_type' : dependent name
is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: error C2923: 'std::iterator' : 'std::iterator_traits<_Iter>::value_type' is
invalid as template argument '#2', type expected
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: warning C4346: 'std::iterator_traits<_Iter>::difference_type' : dependent
name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: error C2923: 'std::iterator' :
'std::iterator_traits<_Iter>::difference_type' is invalid as template
argument '#3', type expected
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: warning C4346: 'std::iterator_traits<_Iter>::pointer' : dependent name is
not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: error C2923: 'std::iterator' : 'std::iterator_traits<_Iter>::pointer' is
invalid as template argument '#4', type expected
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: warning C4346: 'std::iterator_traits<_Iter>::reference' : dependent name is
not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(509)
: error C2923: 'std::iterator' : 'std::iterator_traits<_Iter>::reference' is
invalid as template argument '#5', type expected
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(513)
: warning C4346: 'std::iterator_traits<_Iter>::difference_type' : dependent
name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(513)
: error C2144: syntax error :
'std::iterator<_Category,_Ty,_Diff,_Pointer,_Reference>::difference_type'
should be preceded by ';'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(513)
: error C2208: 'T3' : no members defined using this type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(514)
: warning C4346: 'std::iterator_traits<_Iter>::pointer' : dependent name is
not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(514)
: error C2144: syntax error :
'std::iterator<_Category,_Ty,_Diff,_Pointer,_Reference>::pointer' should be
preceded by ';'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(514)
: error C2208: 'T4' : no members defined using this type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(515)
: warning C4346: 'std::iterator_traits<_Iter>::reference' : dependent name is
not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(515)
: error C2144: syntax error :
'std::iterator<_Category,_Ty,_Diff,_Pointer,_Reference>::reference' should be
preceded by ';'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(515)
: error C2208: 'T5' : no members defined using this type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(634)
: warning C4346: 'std::reverse_iterator<_RanIt>::difference_type' : dependent
name is not a type
prefix with 'typename' to indicate a type
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(634)
: error C2143: syntax error : missing ';' before '__cdecl'
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xutility(634)
: error C2501: 'std::reverse_iterator<_RanIt>::diffe