Japanese literal strings
Hello
I have a code source compatible with Unicode data that I want to traduce to
Japanese. The problem is that I use VC++ 6 (english version) which is not
Unicode and I can't paste Japanese inside literal strings in the code that I
use to define user messages.
Does anyone know how I can make my japanese version?
Thanks at all
Jordi Tag: vc++ and intel c++ compilers Tag: 226350
Moving a function from VB to VC
Hi all,
I've got the following situation currently all written in VB6. An ActiveX
EXE which acts as the server and various clients connect to it over a
clsUser multiuse object. This server is quite big and complex and one
function that it does it calculate the shortest paths from source to
destination using Dijkstra. The algorithm is heavily modified to return
k-shortest paths, for particular times, etc. and it all works fine and
reasonably fast but I was thinking of rewriting the algorithm in VC6/7 to
further increase performance.
For the algorithm, I currently need the following variables and structures
which I have identified as to be needed in the VC function:
- An array of nodes(vertices) (approx size 7000)
- An array of visited nodes (approx size 7000)
- An array of previous nodes (approx size 7000)
- An array of indexes (approx size 7000)
- An array of distances (approx size 7000)
- An array of edges (links between individual nodes) (approx size 80000)
The above arrays an initialized and kept in memory when a user connects to
the server. They a reinitialized for each each.
So before delving into this task, I'd like to ask some questions to you
C/C++ experts!!
1. Is a standard C/C++ DLL better/faster than creating an an ActiveX DLL
with all the COM stuff overhead?
2. How can I immediately & quickly copy a whole array from the sever to the
VC DLL instead of some kind of loop?
3. Are there any optimizations that I can do to increase performance?
Any suggestions welcome!!
Thanks,
Ivan Tag: vc++ and intel c++ compilers Tag: 226349
Redirecting the standard error and output
I want to redirect my program output to some file. I could do for standard output by following comman
myapp.exe > out.tx
But I was not able to redirect my error messages from the above application to same file. Which the comman
for redirecting both error and output at the same time
Thanks in advance. Tag: vc++ and intel c++ compilers Tag: 226347
[VC++.NET] error C2627: '()' : member function defined in unnamed class
=========
Windows 2000 Professional
Microsoft Visual C++ .NET (Version 7.0)
=========
====== C++ code : File foo.cpp : BEGIN ======
struct
{
double operator()(const double& x, const double& y)
{
return x + y;
}
} inst1;
int main()
{
return 0;
}
====== C++ code : File foo.cpp : END ========
====== Compilation : BEGIN ======
------ Build started: Project: proj-02, Configuration: Release Win32 ------
Compiling...
foo.cpp
\src\foo.cpp(7) : error C2627: '()' : member function defined in unnamed class
[---omitted---]
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
====== Compilation : END ========
GNU g++ (version 3.3.1) has no problem with that code
Which compiler is right?
--
Alex Vinokur
mailto:alexvn@connect.to
http://mathforum.org/library/view/10978.html Tag: vc++ and intel c++ compilers Tag: 226346
[VC++.NET] Invoking an executable which takes arguments
=========
Windows 2000 Professional
Microsoft Visual C++ .NET (Version 7.0)
=========
Debug->"Start Without Debugging" invokes an executable which takes no arguments.
How to invoke an executable which takes several arguments?
--
Alex Vinokur
mailto:alexvn@connect.to
http://mathforum.org/library/view/10978.html Tag: vc++ and intel c++ compilers Tag: 226343
dword to byte *
How do you cast dword down to byte *? AFAIK, dword is 32-bit and (byte *) is
16-bit, thank you
Jack Tag: vc++ and intel c++ compilers Tag: 226336
sgi-stl Error when using vc7
I wrote a program which worked ok in vc6. it uses hash_map of sgi-stl.but
when i use vc7 to complie it , it tells me that :
E:\works\include\SGI_STL\stl_alloc.h(305) : fatal error C1001:
what can i do to fix it ?
thanks Tag: vc++ and intel c++ compilers Tag: 226334
How to get returned value from a spawned process?
Hi
I have the following scenarios: client/server programs implemented with winsock are installed on all systems inthe network (assume it contains s1, s2, and s3, and other systems). If I send a command from s0 client to s1 server, which ask s1 server to execute a command line of s1 client to talk with s2 server, s2 server will return value (error code in my case) to s1 client. My question is how I can get the returned value on s0
The command line execution on s1 is realized by calling system(), to which I pass the client program name (the client program will returns error code), and the processed data from s0, but system() only return -1 or 0 to indicate error or succeed. I also looked at CreateProcess(), but still couldn't see how I can get the returned value from client execution
S0: Client/Serve
/
\
S1:Server/Clinet <------------------------------>Server/Client:S
Anybody got idea
Thanks
Peter Tag: vc++ and intel c++ compilers Tag: 226333
Class & Global variables
I have a question on how to avoid globals using classes:
I have this:
class cWorkElement
{
public:
....
.....
Privat:
...
...
}
And then i have an array of 100 pointers to this array.
cWorkElement *aMyElements[100];
The "problem" is, that i use some global variabels in this - and i was
wondering if its normal pratice to include theese in a class instead ?
Class cGlobalClass
{
public:
// global variables
cWorkElement *aMyElements[100];
}
Is this a smart way to do it ?
Thanks. Tag: vc++ and intel c++ compilers Tag: 226329
[VC++.NET 2003] CRT memory leak detection
I know there was a programming command in Visual C++ 6 to enable the CRT
to use some crude memory leak detection. I am hoping I can do the same with
the VC++ .NET 2003 CRT. I am interested in checking for memory leaks/memory
overwrites for objects allocated with the C++ keyword new. How is this
done? Tag: vc++ and intel c++ compilers Tag: 226292
COMM port programming.
Hi
I have written a code to read from the COMM port. Below given is the code for the thread which reads the comm port and send the data to the object which process it. But there is a small problem in it. Some times the code doesn't read the complete content received at the comm port
for exampl
The data expected is
*** BSC sous le LIC nominal **
Personnalisation du BSC [2
But the data which i get is
*** BSC souersonnalisation du BSC [2
Please help me as this is very important
UINT CSerialPort::CommThread(LPVOID pParam
// Cast the void pointer passed to the thread back t
// a pointer of CSerialPort clas
CSerialPort* port = (CSerialPort*)pParam
COMSTAT comStat
DWORD dwRead,dwReadResult,dwResult,dwErrors
DWORD dwEvtMask,dwErrorFlags
COMSTAT ComStat ;
BOOL bResult
char lpszBlock[5000]
int index
char temp [40]
OVERLAPPED osWaiter
ZeroMemory (&osWaiter, sizeof(OVERLAPPED))
osWaiter.hEvent = CreateEvent ( NULL , TRUE , FALSE , NULL ); // auto reset - not signale
if (!SetCommMask(port->m_hComm,EV_RXCHAR)
return ( FALSE )
while(!port->m_bCloseSerialPort
dwEvtMask = 0
bResult=::WaitCommEvent(port->m_hComm,&dwEvtMask,&osWaiter );
//ClearCommError(port->m_hComm,&dwErrorFlags,&ComStat)
//strcpy(lpszBlock,"")
if ( !bResult )
dwErrors = GetLastError ()
if ( dwErrors == ERROR_IO_PENDING )
switch ( WaitForSingleObject(osWaiter.hEvent,INFINITE ) )
case WAIT_OBJECT_0:
// Wait Comm Event complete
if(GetOverlappedResult ( port->m_hComm , &osWaiter, &dwReadResult , FALSE )
bResult = TRUE
break
case WAIT_TIMEOUT
AfxMessageBox("WAIT_TIMEOUT")
break
default
AfxMessageBox("Default")
break
if ( !bResult )
ClearCommError(port->m_hComm, &dwErrors, &comStat)
PurgeComm ( port->m_hComm , PURGE_TXCLEAR | PURGE_RXCLEAR );
}
else
if ((dwEvtMask & EV_RXCHAR) == EV_RXCHAR
ClearCommError(port->m_hComm, &dwErrors, &comStat)
bResult=ReadFile(port->m_hComm,lpszBlock,comStat.cbInQue,&dwReadResult,&port->m_ovRead)
if (!bResult
switch (dwErrors = GetLastError())
case ERROR_IO_PENDING:
// asynchronous I/O is still in progress
switch ( WaitForSingleObject ( port->m_ovRead.hEvent , 6000 ) )
case WAIT_OBJECT_0
// Async I/O complete
GetOverlappedResult ( port->m_hComm , &port->m_ovRead, &dwReadResult , FALSE )
break
case WAIT_TIMEOUT
default
ClearCommError(port->m_hComm, &dwErrors, &comStat)
dwReadResult = 0
break
} // wait for IO to complet
break
default
dwReadResult = 0
break
} // switch ReadFile Erro
if(dwReadResult>0)
{
lpszBlock[dwReadResult]='\0';
::SendMessage((port->m_pOwner)->m_hWnd, WM_COMM_RXCHAR, (WPARAM)lpszBlock, (LPARAM) port->m_nPortNr);
}
}
}while(dwReadResult>0);
if(index!=0)
{
lpszBlock[index]='\0';
::SendMessage((port->m_pOwner)->m_hWnd, WM_COMM_RXCHAR, (WPARAM)lpszBlock, (LPARAM) port->m_nPortNr);
}
}
}
AfxMessageBox("Port is closed");
EscapeCommFunction(port->m_hComm,CLRDTR);
PurgeComm(port->m_hComm, PURGE_TXABORT | PURGE_RXABORT |
PURGE_TXCLEAR | PURGE_RXCLEAR);
CloseHandle(port->m_hComm) ;
return( TRUE ) ;
} Tag: vc++ and intel c++ compilers Tag: 226282
VC 7 compiler q
HI
I just need a little info:
Anybody know if there's a point in getting VC7 stand alone?
What does it mean , no optimized compiler and.
Will all my VC6 application compile ??
Also, i Have C# , stan alone. Can i mix C# stand alone and VC7 stand alone ?
Why stand alone ? cause VC7 is only 150$, but .NET is over a 1000$ :(
Thanks a lot . Tag: vc++ and intel c++ compilers Tag: 226281
[VC++.NET] long long
=========
Windows 2000 Professional
Microsoft Visual C++ .NET (Version 7.0)
=========
====== C++ code : File foo.cpp : BEGIN ======
int main()
{
long long var;
return 0;
}
====== C++ code : File foo.cpp : END ========
====== Compilation : BEGIN ======
------ Build started: Project: proj-02, Configuration: Release Win32 ------
Compiling...
foo.cpp
\src\foo.cpp(3) : error C2632: 'long' followed by 'long' is illegal
[---omitted---]
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
====== Compilation : END ========
Is there any way to use 'long long' in VC++.NET?
--
Alex Vinokur
mailto:alexvn@connect.to
http://mathforum.org/library/view/10978.html Tag: vc++ and intel c++ compilers Tag: 226280
Performance Monitor customization
Hi
I Wonder... Is it possible to add custom counters to the performance monito
( that is provided with the OS )? how? any samples or pointers will b
appreciated
Thanks
Nadav Tag: vc++ and intel c++ compilers Tag: 226275
!gle
If you can use !gle to dynamically view the value of GetLastError in code without actually having it in the code in WinDbg, is there any way you can use it in VC6 or VS.NET
What window do you type this into? Tag: vc++ and intel c++ compilers Tag: 226274
PostQuitMessage
Apparently, PostQuitMessage 'posts a quit message to the calling thread's message queue'. How does it know which window this relates to? What if the calling thread's message pump is sending messages to more than one window, or what if there is more than one window in the calling thread but each with their own message pump
How would the function know which window to send the quit message to in both of the above cases? Tag: vc++ and intel c++ compilers Tag: 226272
LONGLONG
How expensive is multiplying and dividing by a LONGLONG (i.e. 64-bit variable), and what ways can be got around it for performance critical stuff? Tag: vc++ and intel c++ compilers Tag: 226270
LONGLONG
How expensive is multiplying and dividing by a LONGLONG (i.e. 64-bit variable), and what ways can be got around it for performance critical stuff? Tag: vc++ and intel c++ compilers Tag: 226269
handle leaks..?
Hi all,
It works fine on XP Professional but not on WinNT 4.0 and Win2k.
While PrivateBytes, VirtualBytes,etc doing very fine I see Handle count keep
going
up in the Task Manger and PerfMon.
Its about handle leaks but I wonder if anything special about winnt 4.0 and
win2k. In the
NT Service I'm creating threads in a loop, threads return fine and I do
close handles using CloseHandle() in a loop. And the return value of
CloseHandle() for all the handles looks fine (as viewed using
OutputDebugString() in the debugger and WaitForMultipleObjects always is
WAIT_OBJECT_0)
for(i = 0;i<z;i++)
{
array[i] = CreateThread(0,
0, // use default stack size
(LPTHREAD_START_ROUTINE) ThreadProc, // thread function
NULL, // argument to thread function
0, // use default creation flags
&dwThreadID);
}
DWORD waitfor = WaitForMultipleObjects(noofprocess,hThread,TRUE,freq);
int relhandles = 0;
switch(waitfor)
{
char clip[512];
BOOL close;
case WAIT_TIMEOUT:
OutputDebugString(_T(" WAIT_TIMEOUT"));
for(relhandles = 0; relhandles < curIns; relhandles++)
{
if(hThread[relhandles] !=0)
{
close = CloseHandle(hThread[relhandles]);
if(close != 0)
{
sprintf(clip,_T("\n Handle %d closed \n"),relhandles);
OutputDebugString(clip);
}
else
{
sprintf(clip,_T("\n Close Handle %d failed \n"),relhandles);
OutputDebugString(clip);
_Module.LogEvent(_T(clip));
}
}
}
break;
case WAIT_ABANDONED_0:
OutputDebugString(_T("WAIT_ABANDONED"));
break;
case WAIT_OBJECT_0:
OutputDebugString(_T("WAIT_OBJECT_0"));
for(relhandles = 0; relhandles < curIns; relhandles++)
{
if(hThread[relhandles] !=0)
{
close = CloseHandle(hThread[relhandles]);
if(close != 0)
{
sprintf(clip,_T("\n Handle %d closed \n"),relhandles);
OutputDebugString(clip);
}
else
{
sprintf(clip,_T("\n Close Handle %d failed \n"),relhandles);
OutputDebugString(clip);
_Module.LogEvent(_T(clip));
}
}
}
break;
default:
OutputDebugString(_T("default"));
}
thank you,
vinod Tag: vc++ and intel c++ compilers Tag: 226268
[VC++.NET] Getting VC++ compiler version within a program
=========
Windows 2000 Professional
Microsoft Visual C++ .NET (Version 7.0)
=========
Does VC++ contain any macro which enables to get compiler name and version within a program
(something like __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ in GNU gcc).
--
Alex Vinokur
mailto:alexvn@connect.to
http://mathforum.org/library/view/10978.html Tag: vc++ and intel c++ compilers Tag: 226265
localtime()
Hi,
Does localtime() function automatically corrects for daylight savings time?
Actually I am showing the system time in my UI and it should adjust for
daylight saving time and show it accordingly. Do I need to call __tzset()?
If I dont call this, does it take the deafult?
Thanks in advance,
Sateesh. Tag: vc++ and intel c++ compilers Tag: 226263
ReadFileEx and FileIOCompletionRoutine
When the ReadFileEx calls the completion routine I check the buffer holding
the returned data.
if (ReadBuffer[0] != 0 )
{
this executes even though a 0 is in the first element
}
Why????
thanks Tag: vc++ and intel c++ compilers Tag: 226260
About database errors
Respected Sir,
I am using DAO Recordset for my project and
recordset type is cynasset, but when I am trying to access
any records, I am finding 0 records as well as whenever I
am trying to add, edit or delete records, I am getting an
error first time when dialog is loaded in daocore.cpp file
at line no. 4854 which contains the sentence "ASSERT
(m_nFields > 0);". So where is the problem?
Regards,
Jitesh Tag: vc++ and intel c++ compilers Tag: 226255
Help about graphs and how to query them.
Hi,
I'm sorry if this it not the right newsgroup. My question is related with
databases, however the way I'm going to handle
everything could not be related with that (I use algorithms about reading
graphs), and maybe you guys come have a good idea.
Ok, let's see if I can explain the problem.
I have about a SQL database with 15 tables. Each table has several fields,
however each table
has a common field called 'Code'
ex.
Table Vehicles
--------------
Code
Make
Color
Table People
-------------
Code
Name
Age
Table Addresses
-----------------
Code
City
ZIP
...
Now we want to relate records from one table to another. For example, we
want to say 'John has two cars'
In order to do that, I have an external table called Links with source an
destination fields. For the example we would have
Source Dest
----------------
P132 V100
P132 V242
(P132 is a record from the People table with code 132, V100 a vehicle from
the Vehicle table with code 100, and V242 a vehicle
with code 242)
So, with all that, we know that John (P132) is related with two vehicles. If
I want to run the query 'People associated with vehicles'
it would be easy to query that table and get that information.
Now, let's suppose we have this situation:
Source Dest
----------------
P132 V100
P132 V242
P140 V500
P132 P140
In this example, John is related with Michael (P140) and Michael is related
with a vehicle (V500).
If I want to run the same query than before 'People associated with
vehicles', because of P132 is related with P140 and P140 is related with
a V500 this implies that P132 is related with V500.
Now, the query is not so simple, because it's like a graph and I need to
make a Depth First Search to get what I want. Doing that, I will get that
P132 is
related with V500 because there is a 'path' to get there.
I have done all this and it works fine. The problem that I have is that I
need to make that Depth First Search for each people that I have in the
database
in order to see if I have vehicles associated with it. If I don't have many
records it's ok, but If I have 100,000 people on the database I would have
to
make that search 100,000 times just to see if there is a path between them,
I mean, if there is a way to get from a person to a vehicle.
In this case... this solution doesn't work, because it takes forever...
What do you guys suggest I can try? I though that one solution would be to
have a process running on the server that maintains a table with ALL the
links that we have in the database and the depth of the link. So, in our
example we'd have a entry "P132 V500 with depth 2"
Having that table it would be easy to query. Inconvenience: the table is
going to be HUGE, and also the process has to be smart enough to keep track
of deleted links, new links...
I'd appreciate if you guys have any idea or suggestions about this and how I
can get a better perfomance.
Thanks a lot for reading this whole message!! Tag: vc++ and intel c++ compilers Tag: 226247
embedding bitmap
Hi-
Does anyone know of sample code that would show me how to accomplish this:
embed a bitmap file into a project (and subsequently my DLL)
then write that embedded data to file at runtime?
I'm developing a plugin and using there UI library, I want to create the
file at runtime to prevent users from replacing the file with there own
version.
Thanks for any help,
Steve Tag: vc++ and intel c++ compilers Tag: 226246
About copying files
Respected Sir,
How to copy one database file from one location to
another through code in VC? In the same way how to copy
one wav file from one location to another through code in
VC?
Regards,
Jitesh Tag: vc++ and intel c++ compilers Tag: 226231
About data type conversion
Respected Sir,
How to convert data from CString to COleDateTime?
Regards,
Jitesh Tag: vc++ and intel c++ compilers Tag: 226230
How can I communicate with a service?
Hi,
I'd like to design a software that is mainly made of a service and that
would need a user interface to view and edit the configuration.
Now, what I need to know is: Is it possible for an independant exe to
connect to a service and get data from it or send data to it? If it's
possible, what is the best way to do it?
Thanks Tag: vc++ and intel c++ compilers Tag: 226229
Memory Problem
Hi all
I'm having a problem with the memory management: I'm writing a program with Visual C++ which creates, after a call method, a lot of structures and classes and afterwards they are deleted completely; but I open the Windows Task Manager and the memory used by my program is is always increasing, is it correct or memory should decrease after deleting the classes and structures with 'delete'?? Any idea?? Of course, the problem is that when I'm inserting (but not storing) quite data, my program reaches 200 MB and I think that there is something wrong!
Vicent Tag: vc++ and intel c++ compilers Tag: 226228
GetWindowDC twice
Hi
Is it ok to call GetWindowDC twice on the same window before ReleaseDC ?
HDC dc1 = GetWindow(hWin1);
HDC dc2 = GetWindow(hWin1);
...
ReleaseDC(hWin1, dc2);
ReleaseDC(hWin1, dc1);
I usualy only do it once but I noticed that sometimes my drawings
calls generate a WM_PAINT message and then id get BeginPaint
EndPaint which pretty much does get/release of dcs.
thanks a lot. Tag: vc++ and intel c++ compilers Tag: 226223
template specialization bug
Hello,
I think I have found a template specialization bug in Microsoft Visual
C++ 2003 (VC7.1). The following code compiles with gcc3.2 and Intel
8.0, but gives error C2764 "template parameter not used in partial
specialization" with VC7.1.
The workaround would be to repeat the complex type deduction done in
DefinesAType for the specialization of SomeClass, which is code
duplication and error-prone.
//a class that has public typedef
template
< typename T >
struct DefinesAType
{
//assembles in a complicated (assumed)
//way a new type from T
typedef T AType;
};
//class SomeClass will be specialized
template
< class T>
class
SomeClass
{};
//specialize on the type defined in DefinesAType
template
< class T >
class
SomeClass<typename DefinesAType<T>::AType>
{
};
int main()
{
SomeClass<int> sc;
} Tag: vc++ and intel c++ compilers Tag: 226221
delete this
Hi all
I'm developing a program with Visual C++ a I'm wondering if I can write this sentence in Visual C++: 'delete this'. The main objective of this sentence is to the delete the object that I'm in, does anyone know if this can cause some errors?
Thanks Tag: vc++ and intel c++ compilers Tag: 226220
CString mess HEAP in long running programs ?
h
i make heavy use of CString in database and communications routines in a large program that runs for months. will this eventually cause HEAP problems?
thank
a Tag: vc++ and intel c++ compilers Tag: 226218
determining Windows version
I need to know at run time if the operating system is Win95/98 or a
WinNT variant. Any simple way to do that?
Thanks. Tag: vc++ and intel c++ compilers Tag: 226216
Identify user
Hello,
Given a process id, at kerner level can we identify who's the user who has
the control over the process or who is running that process (or an
application).
I want to know this for win 98, XP and 2k and above.
rgds
Bmm Tag: vc++ and intel c++ compilers Tag: 226215
<char*> data with process-to-process messages
Hi there,
I register a custom message with RegisterWindowMessage function. I would
like to pass <char*> messages via the message:
char buf[80];
.... // fill the buf with a message
SendMessage( HWND_BROADCAST, MYMESSAGE, (WPARAM)buf, NULL );
this of course does not work as expected: the array is correctly received
only in the process that sends the message. all other processes cannot see
the message data (I suppose this is due to memory beeing virtually adressed
in each process).
my question is: how then should I declare the memory to be able to pass the
data to another process as <char*>?
I've tried to alloc the memory globally (via GlobalAlloc) and pass the
pointer but with no result. The only solution I've found is to register the
data as an atom (GlobalAddAtom) as pass the atom handle. This solution,
however, does not look like a general one.
thanks in advance for your help,
Wiktor Zychla Tag: vc++ and intel c++ compilers Tag: 226206
Dll exporting a function that creates MFC dialog is causing crash in MT.
Hi
I am facing a crash only in 2k with the following scenario . In XP and 98 this problem is not observed
In my scenario I have X.exe, Y.dll. Y.dll exports a function (say Z) which has DoModal() of a dialog called. X.exe on click of a button starts a thread and in that thread calls the Z method which shows up a dialog. The problem happens when the button is clicked thrice or more than thrice. The three dialogs are lauched in three threads and are shown. But if I try to move the dialogs, After some time a crash is seen, whcih occurs in a method of MFC42.dll.
More information about the scenario is X.exe links Y.dll statically. X links MFC as a shared dll, where as Y.dll links the same as a static dll. I suspected module state change when the the control is going out of thread boundary to Dll. But the exported function already has AFX_MANAGE_STATE(AfxGetStaticModuleState( )); as te first statement.
Please let me know if any body faced the same problem before and point me towards the solution.
Thanks
Sre Tag: vc++ and intel c++ compilers Tag: 226202
try block performance
I have two pieces of code performing virtually the same task. While one of
them (f1) is written in a try block, hoping to catch as many exceptions as
possible, the other one (f2) is not:
void f1 (void)
{
try
{
do_task1();
do_task2();
do_task3();
}
catch (exception1){...}
catch (exception2){...}
...
}
void f2 (void)
{
do_task1();
do_task2();
do_task3();
}
Does f1 imposes any necessary runtime-overhead? Is to answer this question
implementation dependent? And if so, is there a general answer applies to
most implementations?
ben Tag: vc++ and intel c++ compilers Tag: 226200
Odd float C2092 compiler error
VC++6 SP4 (I think SP4... how about listing SP level in Help/About, guys :
Also compiler processor pack installed
Anyhoo, just a small quirk with float initialization (maybe applies to other types too?)
float a(1), b(2)
int c(3)
const float d((a + b)/float(c)); // error C2062: type 'float' unexpecte
const float d((a + b)/c); // O
const float d(a/float(c)); // O
const float d = (a + b)/float(c); // O
The first variant was the one I naturally used, and (IMHO) the most 'correct', and is the one that doesn't work... :
Bil Tag: vc++ and intel c++ compilers Tag: 226199
AfxBeginThread
I have an ATL / MFC project which creates an ATL-based dialog box. When the
dialog is created I want to spawn a worker thread.
The code to create the thread is:
DWORD dw;
CWinThread* pThread = AfxBeginThread(SendFileFTP, (LPVOID) &dw);
The thread proc is defined as this:
UINT CUploadProgress::SendFileFTP(LPVOID pParam)
{
CProgressCtrl* pBar = (CProgressCtrl*) GetDlgItem(IDC_PROGRESS1);
for(int x = 0; x <= 10; x++)
{
pBar->SetPos(x);
}
return 0;
}
But when I try to compile, it get this error message:
error C2665: 'AfxBeginThread' : none of the 2 overloads can convert
parameter 1 from type 'unsigned int (void *)'
I suppose it's all very obvious, but could someone help me with this? What
am I doing wrong?
Thanks Tag: vc++ and intel c++ compilers Tag: 226194
Generating ascii values
Can anybody tell me what header files and function name do I need to get VC
to generate the numerical ascii value of a given character? TIA. Tag: vc++ and intel c++ compilers Tag: 226187
list-view: how to know if scroll-bars are being displayed
Hello,
is there a way of knowing (or being notified) if a list-view is displaying
scroll bars (horizontal or vertical)???
I'd like to prevent horizontal scroll-bars from getting displayed resizing
just before the list-view to prevent them from appearing, but this obviously
requires knowing if they are being displayed.
Bob Rock Tag: vc++ and intel c++ compilers Tag: 226186
How check validity of BSTR?
Hi,
When a BSTR is passed is as a function parameter, how to test the
validity of BSTR?
In case of char* pointer we check whether it is NULL before using it.
Is there a similar error checking mechanism for BSTR?
I tried checking the lenght, but this is not the rightway, it hangs.
I am using ATL, my function get called by ExOLEDB.
Thanks
Ramesh Tag: vc++ and intel c++ compilers Tag: 226183
Re: sublass instance
perhaps poor choice of wording on my part, but is there one instance of that
fucntion? or one per each window subclassed? Tag: vc++ and intel c++ compilers Tag: 226182
LNK2001 : unresolved external symbol "public: _thiscall
trying to compile with vc++ 6.0, on windows xp,
I doubled checked my project settings and options but
can't understand why I'm getting the following errors :
Linking . . .
Server.obj : error LNK2001: unresolved external symbol "public: __ this call
CallImpl(void)" (??0CallImpl@@QAE@XZ) Tag: vc++ and intel c++ compilers Tag: 226172
vcvars32.bat not present after installing the Microsoft .NET SDK
I am new to C++ and am trying to set up my machine to compile from the
command line. The following program compiles and links:
#include <stdio.h>
main()
{
printf("This is my first C program.\n");
}
This one doesn't:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{
MessageBoxA(NULL,"What's up, world!", "Windows PRogram", MB_OK);
return(0);
}
Here's the error I'm getting when I compile the second program:
C:\>cl winprog.c
Microsoft (R) 32-bit C/C++ Standard Compiler Version 13.10.3077
for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights
reserved.
winprog.c
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:winprog.exe
winprog.obj
winprog.obj : error LNK2019: unresolved external symbol
__imp__MessageBoxA@16 referenced in function _WinMain@16
winprog.exe : fatal error LNK1120: 1 unresolved externals
From reading the documentation, it looks like I'm supposed to run a
file named 'vcvars32.bat' to set up my enviromment. However, this
file is not on my hard drive. I've uninstalled and reinstalled the
SDK 3 times to make sure I'm not missing a setting, and the
'vcvars32.bat' file still is not on my machine. I have also loaded
the Platform SDK. I am running Windows XP Home. Please help. Tag: vc++ and intel c++ compilers Tag: 226167
Threads
Hi,
I want to create a thread and this thread should wait some messages and
behave accordingly...
Lets say I derived a class from CWinThread.. I think the execution point is
determined by the function that will be passed as an argument to the
AfxBeginThread function..
UINT MyThreadFunc(LPVOID lParam)
CMyThread *myThread = (CMyThread *) AfxBeginThread(MyThreadFunc,NULL,
THREAD_PRIORITY_NORMAL,0,0);
Now I want to post some messages to myThread by PostThreadMessage..
I have already defined message handlers for some user messages
#define WM_USER_THREAD_UPDATE_PROGRESS (WM_USER+0x102)
ON_MESSAGE(WM_USER_THREAD_UPDATE_PROGRESS, OnThreadUpdateProgress)
it seems I will handle this messages into MyThreadFunc with GetMessage and
PeekMessage and after TranslateMessage and DispatchMessage OR this messages
will come to the PreTranslateMessage of CMyThread..(?)
if I will handle messages in MyThreadFunc then the function will look like
this..
UINT MyThreadFunc(LPVOID lParam)
{
while (GetMessage(...))
{
//if message is destroy thread, then quit..
//else
TranslateMessage(...)
DispatchMessage(...)
}
}
the syntax may not be correct.. but whose message pump GetMessage function
gets messages?
I mean if I had two thread with the same function, what will happen?
I hope I can explain what i thought:)
if preTranslateMessage gets the messages, the there will not need for
MyThreadFunc, so it should wait until the thread is terminated???!
Please tell me I am wrong or not..
Thanks anyway.. Tag: vc++ and intel c++ compilers Tag: 226166
How to launch an Executable from within memory
Hi All ,
I am writing a program that inputs an executable ,compresses it and outputs
an exe in which the input compressed exe has been packed.The Output exe when
executed , is supposed to uncompress the original exe and then Launch this
exe from memory without writing it to the disk.
Can anybody help me as to how to launch an exe that has been read into a
memory buffer...?
Thanks
Jeffrey Tag: vc++ and intel c++ compilers Tag: 226162
UNICODE vs _UNICODE
First off, how come there is both a _UNICODE and UNICODE symbol used in
the Win32 API?
Second off, what is the distinction, if any?
I've noticed that for builds to work w/o errors, I need to either have
both defined or neither.
So, anyone feeling descriptive? I'd really like to know which I should
officially be using in code where I need to detect whether building with
or w/o it (i.e. #ifdef UNICODE vs #ifdef _UNICODE).
Thanks.
--
Kendall Gifford
========================================
WEB: http://kendall.jedis.com/
EMAIL: [REPLY TO NEWSGROUP PLEASE]
======================================== Tag: vc++ and intel c++ compilers Tag: 226159
What's the way to integrate intel c++ compilers (to use pIV asm
instructions), with .NET for example?