Newbee question - where's the RaiseException code?
I've been doing some tests and I've found the following:
Given the stupid code below
bool bScannerInstalled = false;
try
{
if(!bScannerInstalled)
throw(FALSE);
}
catch(BOOL)
{
::DebigOutput(blahblahblah)
}
Ok, I know that i this case, the try catch block is acting more like a
Goto statement than a exception treatment. But my question is: I saw
in the assembler code generated by compiler that there's a call
instruction to RaiseException, like:
call @RaiseException (or something like this, I havent the
assembly output file here with me now)
In case of an OCX, this routine is linked together the OCX file (.ocx)
or is it present in some system dll (like ntdll.dll, user.dll, or
another else) and is called by the ocx as a dependency?
Thanks in advance and excuse me my poor English. English is not my
first language. Tag: CFile Rename fail Tag: 293312
Linkage errors when missing ".c" files in a Managed C++ class libr
Hello,
I have this set of C files which implement a web service client stub
generated with the gSOAP toolkit. Since I can't access the web service with
anything else than this gSOAP client, I have to create a Managed C++ wrapper
library and use it in all my C# projects.
So I created a new Visual C++ class library project. I brought in all the
".c" and ".h" files and created a simple class that would act as the
interface and would redirect all my calls to methods implemented in the ".c"
files.
The problems I am getting when I compile are "LNK2028: unresolved token" and
"error LNK2019: unresolved external symbol" linkage exception. I should
mention that I excluded all ".c" files from being built with CLR support.
Any idea on how to deal with this?
TIA,
Eddie Tag: CFile Rename fail Tag: 293303
How to convert time from one timezone to another?
Hi,
I need help in time conversion from one time zone to another
programmatically.
For e.g With Local Time zone as (GMT -5:00) US Eastern time I want to
convert time 29 Mar 2008 00:00:00 on TimeZone(GMT+1:00) into UTC.
I tried first converting the time into time_t using mktime, but
time_t uses local timezone and I could not find any API wherein I can
specify time as well as timezone.
Thanks in advance,
Art Tag: CFile Rename fail Tag: 293291
extern "C" ... again
Hello all,
I've spent a couple of hours reading topics on name mangling or name
decoration and the use of extern "C".
First, let me try to summarize what I think I have learned so far:
There is no standard or convention on how and when to use name
mangling. It is up to the "producer" of compiler and linker to decide.
Even for C++, there is no rule how function overloading and other
stuff is to be achieved, though it is commonly achieved through name
mangling.
Furthermore, name mangling is not an invention that came along when
there started to be object oriented programming or even C++ as a more
specific example. It has been there with good old standard C in a more
simple form (using underscore, at-sign and numbers left and/or right
of the function name).
I haven't yet found any statement on whether the old-style C name
mangling has any rule to it. Because if it doesn't, I have an
important question.
If I declare a function in a library as <extern "C">, it will revert
to old-style C name mangling. Though the <extern "C"> is not primarily
about name mangling, it is part of what it does (if the C++ compiler
does the more elaborate name mangling that is).
However, if there is no rule to old-style C name mangling, how is the
linker to find the referred function? Imagine I use a 3rd party
library which has been built with a different compiler/linker, is it
still enough to specify <extern "C"> when using this library?
Some enlightenment would be highly appreciated!
Thanks in advance,
regards,
Pelle. Tag: CFile Rename fail Tag: 293281
Reentrancy and Thread-safety
Hi,
I read some articles about reentrancy and thread-safety but, unfortunately,
those are not consistent.
Some outhors say "every reentrant functions are also thread-safe" and
onother says "reentrant functions may or may not be thread-safe".
Again, some of them (an article from IBM) says "reentrancy is about invoking
the same function from different threads" while others say "reentrant
functions should be called recursively from the same thread"
I am completely confused and want to be sure about what should I imagine
when I here the word "reentrant". Would you please explain below cases :
- What is reentrancy?
- Is reentrancy completely about multithreaded environments?
- What is the difference between thread-safety and reentrancy? (Please give
two short code samples, one for reaantrant but not thread-safe functions and
one for thread-safe but not reentrant functions)
- At least one consistent point about reentrant functions is that they
should use local or passed data but there is no restriction about passed
data in the definition. There is no difference between using global data
directly and passing pointer to a global data. So reentrancy is not a thing
by itself, someone can call a reenrant function in a non-reentrant fashion.
Can't it?
Thanks in advance. Tag: CFile Rename fail Tag: 293273
how does system determine when to enter the thread function when using mutex
Following is a sample code I got from the MSDN help on using the mutex with
multiple threads. I can't figure out how the operating system decides when
the break out of the thread function to allow entry for another thread. It
doesn't appear to be under the control of the code. Is that something the
system determines? based on time slice, perhaps?
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#define THREADCOUNT 2
HANDLE ghMutex;
DWORD WINAPI WriteToDatabase( LPVOID );
void main()
{
HANDLE aThread[THREADCOUNT];
DWORD ThreadID;
int i;
// Create a mutex with no initial owner
ghMutex = CreateMutex(
NULL, // default security attributes
FALSE, // initially not owned
NULL); // unnamed mutex
if (ghMutex == NULL)
{
printf("CreateMutex error: %d\n", GetLastError());
return;
}
// Create worker threads
for( i=0; i < THREADCOUNT; i++ )
{
aThread[i] = CreateThread(
NULL, // default security attributes
0, // default stack size
(LPTHREAD_START_ROUTINE) WriteToDatabase,
NULL, // no thread function arguments
0, // default creation flags
&ThreadID); // receive thread identifier
if( aThread[i] == NULL )
{
printf("CreateThread error: %d\n", GetLastError());
return;
}
}
// Wait for all threads to terminate
WaitForMultipleObjects(THREADCOUNT, aThread, TRUE, INFINITE);
// Close thread and mutex handles
for( i=0; i < THREADCOUNT; i++ )
CloseHandle(aThread[i]);
CloseHandle(ghMutex);
}
DWORD WINAPI WriteToDatabase( LPVOID lpParam )
{
DWORD dwCount=0, dwWaitResult;
printf("%d*********************\n", GetCurrentThreadId());
// Request ownership of mutex.
while( dwCount < 20 )
{
printf("%d dwCount = %d\n", GetCurrentThreadId(), (int)dwCount);
printf("%d ...wait...\n", GetCurrentThreadId());
dwWaitResult = WaitForSingleObject(
ghMutex, // handle to mutex
INFINITE); // no time-out interval
printf("%d ---switch---\n", GetCurrentThreadId());
switch (dwWaitResult)
{
// The thread got ownership of the mutex
case WAIT_OBJECT_0:
__try {
// TODO: Write to the database
printf("%d writing to database...\n",
GetCurrentThreadId());
dwCount++;
}
__finally {
// Release ownership of the mutex object
if (! ReleaseMutex(ghMutex))
{
// Deal with error.
}
printf("%d xxxreleasexxx\n", GetCurrentThreadId());
}
break;
// The thread got ownership of an abandoned mutex
case WAIT_ABANDONED:
printf("%dWAIT_ABANDONED------------\n", GetCurrentThreadId());
return FALSE;
}
}
printf("%d----------------------\n", GetCurrentThreadId());
return TRUE;
} Tag: CFile Rename fail Tag: 293266
Question I can't get around this common problem now, unresolved
...
: error LNK2019: unresolved external symbol__imp__htons,...
: error LNK2019: unresolved external symbol __imp__WSAGetLastErro
...
These are functions from Ws2_32.lib or kernel32.lib , and I am sure
visual studio project setting about lib reference is right.
/ERRORREPORT:PROMPT glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib
intl.lib libxml2.lib Ws2_32.lib kernel32.lib user32.lib gdi32.lib .
My project is a c project, calling convention is __cdecl (/Gd),
compiled to /TC.
My visual studio is vs 2005 sp1.
Any suggestions will be appreciated. Thank you in advance. Tag: CFile Rename fail Tag: 293264
need C code to reference ADO .. how?
I have an application that is using the Visual Studio 2008 environment
but the project is a 'C' project (everything is using C conventions
and compile options). We are making sure that there is no C++ in this
application for coding reasons I'm not going to go into. Just note
that we have to do it this way.
Here's my issue, I need to have part of the code get data from a Jet
database and connect/use a SQL 2005 database. If this were C++ I could
use #import and recordbinding (love record binding) and be done with
it. How can I do the same operations (perferably with some
recordbinding) in C? Is there a header or something easy to use or do
I need to traverse all of the notions of COM by hand. Please note that
ADO's record binding is one of the key features that I would like to
duplicate in this C code.
Thanks for all the help or pointers (pun) and I wish you a very good
day. I am finding this more challanging the deeper I look. Tag: CFile Rename fail Tag: 293255
samples
Why is it that the zip file of sample vc++ projects will not extract
properly. When I extract one folder at a time, the project still won't
compile. Is there somewhere else that I can get those sample files?
Daniel Tag: CFile Rename fail Tag: 293251
.rsp files
Is there a way to tell vcbuild to keep the .rsp files it creates in
the process of building a project? I have some very strange errors in
a large project and am hoping that the .rsp files may shed some light
on what vcbuild thinks it should be doing. Tag: CFile Rename fail Tag: 293248
NT service exe notcalling bat files via shellexecute
Hi,
I have created a executable that gets deployed as a windows service
via Installshield..
This exe calls a bat file internally to launch a java application..
The problem i'm facing is it does not start the bat file when the
service gets started from services menu..it calls the bat file when
executed outside the purview of the service..
The bat file and the exe are on the same folder..
The path to this folder is added to path env var..
Please tell me what could be wrong..
Thanks,
NKH Tag: CFile Rename fail Tag: 293239
Accessing non-static class members fom static methods (About an alternative)
Hi,
We generally access non-static class members from a static method by passing
"this" to that static method and accessing non-static members over "this".
My alternative is caching "this" into a static member and use that static
member whenever you need to access non-static members. Is there anything bad
about this solution?
//////////////////////////////////////////////////// SAMPLE
///////////////////////////////////////
class Foo
{
public:
static Foo * lpThis;
Foo ()
{
// Some initializations...
lpThis = this; // Last statement in the constructor...
}
static void doJob ()
{
// Now we can access all non-static members over static "lpThis"...
}
};
Foo * Foo::lpThis;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
Thanks in advance. Tag: CFile Rename fail Tag: 293236
why more than one min requirement in targetver.h
Below I copied and pasted contents of the targetver.h file of a VC 2008
project I created. There are three different minimum requirements listed
for Windows. How does that work?
Daniel Tag: CFile Rename fail Tag: 293231
how to check the status of a printer
hi,
I am do some printing programming in vs6.0. I have to check the
status of a printer. I try to use the API of "OpenPrinter" and
"GetPrinter", and retrieve a struct of PPRINTER_INFO_2. but the member
of "status" in PPRINTER_INFO_2 is always equal to zero no matter
whether the printer is connected to the PC. the code is as follows
//==========
HANDLE phPrinter;
if(OpenPrinter(pPrinterName,&phPrinter,NULL))
{
DWORD buffsize;
GetPrinter(phPrinter,2,NULL,0,&buffsize);
PPRINTER_INFO_2 pInfo = (PPRINTER_INFO_2)new unsigned char[buffsize];
GetPrinter(phPrinter,2,(LPBYTE)pInfo,buffsize,&buffsize);
pInfo->Status;// it is always equal to 0;
}
//==========
who can help me? Thank you. Tag: CFile Rename fail Tag: 293229
A few questions about XmlLite
XmlLite questions:
I am using XmlLite (the reader) to parse some XML fragments, and I have a few questions.
Example fragment:
<Top>
<Second>
<Data>
<Top>
</Top>
</Data>
</Second>
</Top>
1. How can I determine when I am finish parsing?
I have tried using the GetDepth() to determine when finish, but I am not clear on the meaning, since
the depth can change when reading attributes. I also do not know exactly when the depth is changed.
2. I use CreateStreamOnHGlobal to create a stream used for IXmlWriter. When finish with IXmlWriter
calls, I return the XML data in a CStringA by using:
// Get the size of the stream.
ULONG nRead;
ULONG nSize;
STATSTG oStatus;
hr = m_pMemoryStream->Stat(&oStatus, STATFLAG_DEFAULT);
nSize = (ULONG)oStatus.cbSize.LowPart ;
// Go to the beginning of the stream.
hr = RewindStream();
assert(SUCCEEDED(hr));
// Read the XML formatted data.
hr = m_pMemoryStream->Read(sBuffer.GetBuffer(nSize), nSize, &nRead);
sBuffer.ReleaseBuffer();
However, it seems the size of the stream may be greater than the size of the XML written. How can I
determine the number of bytes written by IXmlWriter?
--
Frank Tag: CFile Rename fail Tag: 293221
VS2008 Project Settings for Autorun.exe Code
The following complete source code is used in creation of AutoRun.exe file
for distribution media. It appears that created file is dependent on
Microsoft.VC90.CRT.
Can somebody tell me how to get rid of VC90 dependency?
I use Visual Studio 2008 to generate executable.
I don't use C++ on a day to day basis.
I think static linking could be one way to solve the problem. What do I need
to set to enable static linking?
It appears to me that such in a simple code one does not even need VC90 as a
dependency. After all it is only one Win32 call.
----
#include <windows.h>
#include <tchar.h>
int WINAPI _tWinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow )
{
HINSTANCE result;
if (0 == _tcslen(lpCmdLine)) {
lpCmdLine = _T("Setup.hta");
}
// Launch the file specified on the command-line
result = ShellExecute(NULL, _T("open"), lpCmdLine, NULL, NULL,
SW_SHOWNORMAL);
// Check the result
if ((int)result <= 32)
{
// An error was encountered launching
// the .HTA, probably because the computer
// doesn't have IE5 or greater
// Open windows explorer, showing the CD contents
ShellExecute(NULL, _T("explore"), _T(""), NULL, NULL, SW_SHOWNORMAL);
return 1;
}
else
{
// Launched OK
return 0;
}
} Tag: CFile Rename fail Tag: 293219
Is NULL a valid parameter for the strcmp()?
Is NULL a valid parameter for the strcmp() function according to the C
standard?
I found the following code and I have doubts that it is valid
char *parm = NULL;
....
if (strcmp(parm, NULL))
bla,bla,bla
I think that it would be simpler and more correctly to write
if ( parm == NULL )
bla,bla,bla
MS Visual C++ 2005 EE abnormally terminates at runtime if the original if
statement is
used. However if the code is compiled with the IBM C/C++ compiler it runs
without terminating.
Vladimir Grigoriev Tag: CFile Rename fail Tag: 293211
Microsoft Development Environment 2008
I switched From Microsoft Development Environment 2003 to 2008 and notice a
12% reduction in speed on program using Visual C++ does anyone have any
incite?
Thank you, Tag: CFile Rename fail Tag: 293206
debug version won't initialize
Using Visual Studio 6 with SP5...
The project builds without errors. It runs OK in release mode, up to the
point where it crashes because of something I need to fix. Gotta run debug
mode to find it.
Debug mode builds OK but won't run:
"Application failed to initialize properly (0xc0150002)", then
"Could not execute: Path not found (Win32 error 3)"
The status window says "Failed to probe C:\\mydir\Debug\mydll.dll for its
manifest"
The dll in the debug directory is most definitely a debug build with
symbolic information. This error only appears on the target machine (with VS
loaded on it), not on my development machine.
Suggestions, please?
Thanks
Dave C Tag: CFile Rename fail Tag: 293204
vcbuild vs. Visual Studio
Hi all,
first off, apologies if this is not the right group for my query.
(Maybe someone can direct me to the proper group.)
I have a very puzzling problem with a large project I am building.
The
project builds fine in Visual Studio 8 and 9, but when I use vcbuild
at the command line, the linker complains about missing routines.
(I thought this was impossible.) This occurs in only one of the
projects.
I played with this for a week now, and I am getting nowhere. Now I
have an even more
perplexing problem. The project leader wants to use the command
vcbuild /u
This creates a problem in *every* project, with the linker
complaining
=FF_/
LIB : fatal error LNK1181: cannot open input file "=FF_/"
The input file is rendered as "~_/" when I open the log file
in wordpad and as "=FF=FE/" in buildLog.html. I am quite certain
that these characters do not appear in my environment variables,
or anywhere in the vcproj files. What is worse, these symptoms
only show up when I use vcbuild at the command prompt.
I can build the projects just fine inside of Visual Studio.
What am I missing? Is there anything else I could be trying?
Thanks a million.
gus gassmann Tag: CFile Rename fail Tag: 293196
Linking error in mixed code
Hi all,
I have a .NET application which needs to use some Win APIs. I set the
linker option (of VC++ .NET 2008 Express) to '\clr' to use mixed code
and added the following line of code:
...
#pragma unmanaged
namespace UnManagedFuncs
{
using namespace System::Runtime::InteropServices;
[DllImport("user32", EntryPoint = "SetClipboardViewer", CharSet =
CharSet::Unicode)]
extern "C" long __cdecl SetClipboardViewer(void* hWnd);
[DllImport("user32", EntryPoint = "SetWindowLong", CharSet =
CharSet::Unicode)]
extern "C" long __cdecl SetWindowLongW(void* hWnd, int nIndex, long
dwNewLong);
[DllImport("user32", EntryPoint = "CallWindowProc", CharSet =
CharSet::Unicode)]
extern "C" long __cdecl CallWindowProcW(long* lpPrevWndFunc, void*
hWnd, unsigned int uMsg, unsigned int wParam, long lParam );
...
}
#pragma managed
namespace MyApp
{
...
private: System::Void frmMain_Load(System::Object^
sender, System::EventArgs^ e)
{
// Register this window to receive 'clipboard contents
changed' event
UnManagedFuncs::SetClipboardViewer((void*)this->Handle);
UnManagedFuncs::HookWindow((void*)this-
>Handle);
}
}
I get the following linker errors:
ScratchBook.obj : error LNK2019: unresolved external symbol
_CallWindowProcW referenced in function _UnManagedWinProc
ScratchBook.obj : error LNK2019: unresolved external symbol
_SetWindowLongW referenced in function "void __cdecl
UnManagedFuncs::HookWindow(void *)" (?
HookWindow@UnManagedFuncs@@YAXPAX@Z)
What is wrong? Tag: CFile Rename fail Tag: 293186
Debug vs Release mode - memory leak
Hi all,
I am able to release the resources (CStringArray objects) in debug
mode. But, not in Release mode.
Any project settings or compiler options are required?
Thanks and Regards,
John Tag: CFile Rename fail Tag: 293179
Problem with ShellExecute
I have problem with ShellExecute() for open image with Ms Paint :
I tried :
ShellExecute(NULL,"Open","mspaint.exe",szFileName,NULL,SW_SHOWNORMAL);
If szFileName with space ("C:\\Documents and Settings\\pic.jpg" etc...) ->
MS Paint cannot open this file !
What the happen ?
Pls. help me! :(
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ Tag: CFile Rename fail Tag: 293159
Problem with ShellExecute ?
I have problem with ShellExecute() for open image with Ms Paint :
I tried :
ShellExecute(NULL,"Open","mspaint.exe",szFileName,NULL,SW_SHOWNORMAL);
If szFileName with space ("C:\\Documents and Settings\\pic.jpg" etc...) ->
MS Paint cannot open this file !
What the happen ?
Pls. help me! :(
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ Tag: CFile Rename fail Tag: 293158
VC++.2005 locally defined class's member functions generate LNK2005
Hi Anyone,
I found following strange problem writing a C++ code in VS.2005.
Say we have a class A having inside its scope locally defined function
a() (by default it should have inline attribute AFAIK). Then inside
a() I define locally class B with function b().
Finally if the header file is included in more than one cpp files I
get linker error LNK2005 that B::b() has multiple definitions.
Now If I move B outside the scope of a() to the scope of A then the
problem is gone.
Is that proper behavior of the compiler/linker according to C++
standard or a bug?
Are the functions defined in inside local classes considered inline as
well by default?
Best regards,
B. Tag: CFile Rename fail Tag: 293145
strange 4 assembly instructions for a function
Hello everyone,
I am confused what is the function of the 4 assembly instructions? I posted
the 4 assembly instructions and related whole source code/assembly code below.
Any ideas?
[Code]
00BA13CC lea edi,[ebp-0C0h]
00BA13D2 mov ecx,30h
00BA13D7 mov eax,0CCCCCCCCh
00BA13DC rep stos dword ptr es:[edi]
int sumExample (int a, int b)
{
00BA13C0 push ebp
00BA13C1 mov ebp,esp
00BA13C3 sub esp,0C0h
00BA13C9 push ebx
00BA13CA push esi
00BA13CB push edi
00BA13CC lea edi,[ebp-0C0h]
00BA13D2 mov ecx,30h
00BA13D7 mov eax,0CCCCCCCCh
00BA13DC rep stos dword ptr es:[edi]
return a + b;
00BA13DE mov eax,dword ptr [a]
00BA13E1 add eax,dword ptr [b]
}
#include <iostream>
using namespace std;
int sumExample (int a, int b)
{
return a + b;
}
int main()
{
int c = sumExample (100, 200);
cout << c << endl;
return 0;
}
[/Code]
thanks in advance,
George Tag: CFile Rename fail Tag: 293141
EIP register
Hello everyone,
I have debugged into the assembly language for the following simple sample,
but I never saw any instructions dealing with push eip/pop eip, which dealing
with saving/restoring the return address when function foo completes. Any
ideas?
[Code]
int foo (int a, int b)
{
return a+b;
}
int main()
{
int a1 = 100;
int b1 = a1 + 100;
a1 = foo (a1, b1);
return 0;
}
[/Code]
thanks in advance,
George Tag: CFile Rename fail Tag: 293133
How to change code to rid the warning?
ostringstream stm;
stm.imbue(loc);
const ctype<char>& ctfacet =
use_facet< ctype<char>>( stm.getloc());
for( size_t i=0; i<str.size(); ++i )
stm << ctfacet.narrow( str[i], 0 );
warning C4244: 'argument' : conversion from 'const wchar_t' to
'std::ctype<char>::_Elem', possible loss of data Tag: CFile Rename fail Tag: 293090
marshal parameters without using com
Is it possible to create a new thread and run a procedure in it which takes
a parameter to be passed in between the two threads? I need to do this
without creating a separae project or use COM.
Daniel Tag: CFile Rename fail Tag: 293089
VC++2008 and vector exception - not caught
With some test code similar to that below, I can't seem to catch the exception that is thrown on the
v1[44]... line.
What should I check to solve this problem? (I am using a mixture of MFC and STL.)
vector<int> v1;
try
{
v1[44] = 22;
}
catch(std::exception e)
{
e.what();
e.what();
}
Thanks,
Frank Tag: CFile Rename fail Tag: 293080
symbols in static libraries
HI,
I have an application that look like
app.exe depends static lib 1 and static lib 2
static lib 2 depends on static lib 1
in static lib 1, I have one header file and one cpp file
header:
extern const int kNotUsed;
cpp:
const int kNotUsed = -1;
The weird thing is that I can use kNotUsed in my app.exe. However, I
can NOT use kNotUsed from static lib 2. Also, I used
dumpbin /symbols StaticLib1.lib
and I could NOT find kNotUsed.
Thus, my questions are
1. why can I use kNotUsed from app but not from static lib2?
2. if kNotUsed is not in the symbols, how can app.exe use it?
I tried to reproduce the problem in a dummy project and I could NOT
reproduce it. not sure what is wrong. totally lost.
Thank you for any advices, Tag: CFile Rename fail Tag: 293057
Getting localized name folder
Hello all,
Q: How can I het localized name of any specific folder.
(Mainly want this for WinVista, aulthough I want it to work for
lower version as well)
eg:
char* getLocalizedName(char* UserPath){
char *LocalizedName;
.....
.....
.....
return LocalizedName;
}
Examples of input Char *, can be any from following
c:\
c:\Programe Files
c:\MyFolder
c:\MyFolder\MyFolder1\MyFolder2\MyFolder3\MyFolder4\MyFolder5
Till now I have done RnD with IShellFolder Methods,
result of various RnD with the help of Groups-MSDN-blogs-
HelpLinks.....
Is that I need to start with *SHGetDesktopFolder*
& then I can reach to Special Folders defined with CSIDL via
*SHGetSpecialFolderLocation*
Then use *GetDisplayNameOf* function to get the localized name
My issue is I need to check specific path provided by user, does this
path has any localized name?
If Yes, return the Localized name
In No, return the same folder name back
If any one can provide any guidence on how can I work arround this
*Special Special Path provided by user*
Any clue will be helpful....
Looking forward to great help from all there....
Thanks in advance...
Bipin Mistry Tag: CFile Rename fail Tag: 293054
dialog.domodal causes crash
I have an application that's worked well for two years. Recently I added
some code (a few functions and 2 calls to a dll) and now the program
crashes. Debug build is OK, Release build crashes and displays the MS "MFC
Application has encountered a problem".
I've put MessageBox'es at different points to identify where the crash
happens, and it seems to be at a call to mydialog.DoModal. The MessageBox
that I put in OnInitDialog doesn't display before the crash. This dialog is
not new, it's been there all along.
How would I go about tracking something like this down?
Thanks
Dave Tag: CFile Rename fail Tag: 293029
Http 502 and 503 errors
Hello everyone,
I am writing a simple client which downloads Pages from Http Web site.
Sometimes I received errors like 502 or 503 (Http error code), and I am
wondering,
- What do they mean?
- Are they pure server side issue? Or I could improve by adding some
additional information to my Http request (e.g. provide user name and
password, provide locale information?)
thanks in advance,
George Tag: CFile Rename fail Tag: 292991
Earn $35,000- $50,000 per project from google
Earn $35,000- $50,000 per project from google
it is a online project work from google.you can earn a lot from
here.just join with the below network and you will start earn within
15 minutes
www.onlineincomehere.blogspot.com/ Tag: CFile Rename fail Tag: 292988
struct & enum & :: visibility operator
Hi at all,
I have a header file like this:
-------- file.h ------------
...
extern "C"
{
...
typedef struct _S S;
...
struct _S
{
...
enum
{
a,
b
}myenum;
...
};
}
--------- end of file.h -------------
and a C file like this
----------- file.c ----------------
....
#include "file.h"
static void myFunc(S* pS)
{
....
if (... == _S::a)
....
....
}
-----------end of file.c --------------
I'm using the Microsoft 2005 environment and so its compiler. The compiler
says me that there is an error in myFunc, the error is that _S is an
undeclared indentifier. I'm not an expert of C but I don't know where the
problem is.
Can anyone help me, please?
thanks a lot
roberto Tag: CFile Rename fail Tag: 292971
CStringArray, CArray and CMap objects have memory leak?
Hi All,
I am using CStringArray object in VC++ 6.0 application. Trying to
release this object by .RemoveAll() function. But, it is decreasing the "VM
Size" from task manager. And, I confirmed this with memory leak tool.
The "VM Size" after loading all the CString objects into CStringArray is
17MB. After RemoveAll() called, it decreases just 1MB.
And, same for CArray and CMap objects also. How to deallocate them
successfully?
All objects are member variables of class. There is no global objects.
What is the difference between "Mem Usage" and "VM Size" in task
manager? If I minimize the application, "Mem Usage" decreases to 1MB from 20
MB. But, "VM Size" is not decreasing. Can anybody clear this doubt.
Please suggest.
Thanks in advance.
Regards, Tag: CFile Rename fail Tag: 292964
calling convention stdcalll and cdecl call
Hello everyone,
Both stdcall and cdecl calling convention could support variable input
parameters? Is that correct?
(I think stdcall is using RET N and cdecl is using ESP - N, so both are
capable to handle variable number of input parameter, like printf?)
BTW: I have this question because I have something in mind that only one of
them supports variable number of parameters, but after reading assembly
language code, I think both of them are able to support this feature?
thanks in advance,
George Tag: CFile Rename fail Tag: 292957
RPC and IOCP tutorial?
Hello everyone,
I am new to RPC (TCP based) and IOCP, any recommended tutorials?
thanks in advance,
George Tag: CFile Rename fail Tag: 292956
define a char[ ] with alignment restrictions
Env: VC++6.00
I wonder how to define a char[ ] with alignment restrictions?
For example, I hope the start address of a char[100] is with alignment
restrictions 256 bytes.
TIA
ou Tag: CFile Rename fail Tag: 292951
how to cast byte to char
How do I change a byte variable so that I can add it's character value to
the end of a variable of type string, such that:
String^ s = "1234";
byte b;
b= 53;
s = s + b;
thus s = "12345".
I wasn't able to use a cast.
s = s + (char)b;
did not work.
Daniel Tag: CFile Rename fail Tag: 292947
Reading U.D. Functions
Is there a way to tell VC++ what to do from an external text file?
Anyone can do this in vbcript and Visaul Fox Pro.
The situation is to allow the user to write certain algorithm on text file
and the application should be able to interpret this text file and excecute
its instructions inside the application.
--
Thanks,
Rick.
"For every problem, there is a solution that is simple, neat, and wrong."
H. L. Mencken" Tag: CFile Rename fail Tag: 292942
Two basic questions about generated assembly
Hello everyone,
Two questions after readnig this article,
http://www.microsoft.com/msj/0298/hood0298.aspx
1.
why using LEA to do multiplication is faster than using MUL?
"Using "LEA EAX,[EAX*4+EAX]" turns out to be faster than the MUL instruction."
2.
"The TEB's linear address can be found at offset 0x18 in the TEB." -- what
means linear address? Something like array, which elements are put next to
each other? What means non-linear address?
thanks in advance,
George Tag: CFile Rename fail Tag: 292930
process termination
Hello everyone,
My question is during system shutdown/reboot, will OS shutdown/reboot wait
for all process to terminate or not? How could OS identify if a process is
terminated or not?
I am suffering a problem when write event log returns 0x80004005 error in my
own code when system is reboot (I monitor this reboot in Event View), I think
OS should always wait for process to complete (e.g. write event log
operation) before stops event log services and reboot? Maybe OS does not wait
until my process completed event log write?
thanks in advance,
George Tag: CFile Rename fail Tag: 292929
Create a file larger than 3 gb
All,
I am having an issue create a file larger than 3 GB. I am using CreateFile
and WriteFile. Any ideas how to create one past 3 GB? Here is what I am
doing. Thanks in advance...
BOOL bWrite = TRUE;
HANDLE hFile = CreateFile("c:\\test.dat", GENERIC_WRITE,
FILE_SHARE_WRITE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN, 0);
while(bWrite == TRUE)
{
memset(szData, 0, sizeof(szData));
WriteFile(hFile, szData, sizeof(szData), &dwBytesWrite, NULL);
Sleep(.5);
dwSize = GetFileSize(hFile, NULL);
if(dwSize >= (1024 * 1024 * 1024 * 5))
{
bWrite = FALSE;
}
}
CloseHandle(hFile); Tag: CFile Rename fail Tag: 292921
How to load dll ?
Hi to all
Now newbie to vc++6. Now i am writing a simple application in vc++6
using MFC library. Can anyone help me to how to load the dll files and
display the dialogs within it. For eg. i need to load
nsv_coder_aac.dll file in my application and display the dialog within
it. How can i do this? can anyone help me ????????? thanks in
advance..
Regards,
itekchandru. Tag: CFile Rename fail Tag: 292913
What does CALLBACK mean?
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
I know this signature for a while but I am really interested in the
"CALLBACK".
After some research I found this article quite helpful:
http://www.codeproject.com/KB/cpp/calling_conventions_demystified.aspx
The question is, why "CALLBACK" is a necessity. Why must I use it in a
callback function?
Regards
Warren Tag: CFile Rename fail Tag: 292904
I try to modify a file name by CFile::Rename(temp.txt,temp.rtf),system
prompt "access to temp.txt denied".
How can I solve it ? Thank you!
"wangyang" <wangyang@hotmail.com> wrote in message
news:#tWbgOg7IHA.4864@TK2MSFTNGP06.phx.gbl...
> I try to modify a file name by CFile::Rename(temp.txt,temp.rtf),system
> prompt "access to temp.txt denied".
> How can I solve it ? Thank you!
Maybe you don't have sufficient permissions to rename the file?
The CFileException thrown has the error code...what is it?
"wangyang" <wangyang@hotmail.com> wrote:
>
>I try to modify a file name by CFile::Rename(temp.txt,temp.rtf),system
>prompt "access to temp.txt denied".
>How can I solve it ? Thank you!
Are you still writing to "temp.txt"? You need to close it first.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.