multi-process singleton DLL
I have a DLL that exports a class that allows a program to access a
unique system resource.
At the moment, the DLL is implemented as a singleton such that any
thread in a given process is using the same resource handle.
But, if a second, unrelated process loads the DLL and accesses it,
this process will try to create its own handle to the resource which
fails because it's already in use by the first process.
How do I give the second process access to the handle that's being
used by the first process so that both can query the resource?
Thanks,
PaulH Tag: context switch Tag: 279412
Hadnling Large memory
Imagine 2 GB of memeory map data and if user changes a bit we should be able
to find the resultant change in the binary location update that specific byte.
Give me some larger memory based comparison APIs in .NET. Tag: context switch Tag: 279408
Questions about VC++
Hi dear experts,
I'm not experienced in VC++ but i have VC++ 6.0 just for a very few
experience. I'm confused and i need to know someting about C++
application development under VC++ 6 or more.
Here to go:
1-Is the most efficent way to develop GUI-based applications possible
with MFC or what else? What's MFC used for?
2-What's the best way to learn VC++ or C++ with Windows app.
developing? Which books? Web tutorials? There are some and a few free
tutorials which are very fragmented and need to know which dicipline
or procedure(s) is/are the most strong steps to learn VC++ ? I
appreciate if you had useful steps till right now with your
experiences.
3-When compared to Basic, VC++ or C++ seems much more complicated and
has more mistake rist while coding, that's why i'm a bit concerned, so
what are the basics understanding of Visual C++ enviroment/C++ ? (For
example: Declarations, strings, using variables...)
These can be generated more, so please post your feedback in order to
undertand about VC++ coding disipline, recognizing enviroment and
programming basics/tricks to make explicit things.
Regards... Tag: context switch Tag: 279393
GETMESSAGE hook, WM_SYSCOMMAND, SC_CLOSE, and the "X" button?
In an extension (DLL) to a subsystem:windows app I'm trying to make the app hard
to close. A simple WH_GETMESSAGE hook correctly sees <WM_SYSCOMMAND, SC_CLOSE>
when it's generated by the system menu's "Close" (also <Alt-F4>) and translates
it into <WM_SYSCOMMAND, SC_MINIMIZE>. But my hook fails to see <WM_SYSCOMMAND,
SC_CLOSE> when it was generated by the title bar's "X" button. The application
does not set any other hooks.
What's going on here? Can I work around it?
Thanks.
--
- Vince Tag: context switch Tag: 279391
Performance issue
Hi,
I'm trying to improve the performance, but found some issue.
When a function call from FileA to FileB that will have performance loss.
But if the both function in the same file that will have a better peformance.
Is it normal? Or have some way to improve it?
FileA.cpp
------------
HRESULT functionA()
{
return S_OK;
}
void functionMain()
{
for (int i=0; i<10000; i++)
functionA();
for (int i=0; i<10000; i++)
functionB();
}
FileB.cpp
------------
HRESULT functionB()
{
return S_OK;
}
--
Herman Man
Tetragames Studio Limited Tag: context switch Tag: 279384
Instantiate Class with/without operator new?
Hi,
I'm trying to understand the difference between instantiating a generic
C++ class, A) using operator new, B) not using operator new. I have a
simple class called Numbers, that can add or multiply two ints supplied
to the constructor. It seems to work regardless of whether I use new or
not. I'm interested to know when I should use new for Class
instantiation and when not to use it. I tried to find the answer by
searching, but 'new' is not a very common word.
Here's how my calling code looks in _tmain(), note one instance uses
pointers, the other does not
int a,b;
Numbers * n1 = new Numbers(4,5);
a = n1->Add();
wcout << a << endl; // prints 9
b = n1->Multiply();
wcout << b << endl; // prints 20
delete n1;
Numbers n2 = Numbers(5,6);
a = n2.Add();
wcout << a << endl; // prints 11
b = n2.Multiply();
wcout << b << endl; // prints 30
--
Gerry Hickman (London UK) Tag: context switch Tag: 279369
File IO related issue
Hi there:
Is there any APIs to detect the files are being operating by some API ,
such as WriteFile? Tag: context switch Tag: 279365
Define a larger code block
Hi,
As I can define something like
#define ABC(x) if(x){x = NULL;}
but how can I define something similar but the code block is relatively
large (like several lines testing different cases, etc)?
Thanks,
Alan Tag: context switch Tag: 279349
System Requirements for Express Edition
I would like to install the Express Edition on a system that does not
have the memory/process speed shown under the system requirements for
this edition.
If my system is undersized, will the Express Edition not function at
all? Or just slowly. Anyone have experience here?
Thanks in advance Tag: context switch Tag: 279333
Template function question
I'm using Visual Studio .NET 2003. I don't understand what's going on
with this code (why the compiler accepts the call to DoSomething2 but
not DoSomething1) :
template< typename T >
void DoSomething1( void (*)( T ), T );
template< typename T >
struct wrap_type
{
typedef T type;
};
template< typename T >
void DoSomething2( void (*)( T ), typename wrap_type< T >::type );
void F1( const int & );
void main()
{
// error C2782: 'void DoSomething1(void (__cdecl *)(T),T)' :
template parameter 'T' is ambiguous
// could be 'int'
// or 'const int &'
//DoSomething1( &F1, 1 );
// Works
DoSomething2( &F1, 1 );
}
Any insights would be appreciated.
---Chris Tag: context switch Tag: 279328
resource editor newbie
hey all,
what is the story behind the resource editor? Does every project need one?
Is this like the form designer in c#.net?
thanks,
rodchar Tag: context switch Tag: 279326
application configuration
hey all,
i'm trying to create a file that holds settings for when my application
starts up. can someone please tell me what are the new and old ways of doing
this?
thanks,
rodchar Tag: context switch Tag: 279321
One-time initialization of statics in a multithreaded world
Hi everybody,
I cooked a macro for initializing objects once in our project, could
you review and criticize it, please?
I'm mostly interested in correctness, not performance :)
I must say that I don't care about reentrance in the same thread (the
potential "problem" I see) and that I don't want to go through the
InitOnce* API.
#define ONE_TIME_INITIALIZE(TYPE, NAME, INITIALIZER) \
static TYPE* NAME##StaticPtr = NULL;\
static LONG NAME##InitState = 0;\
if(InterlockedCompareExchange(&NAME##InitState, 1, 0) == 0) \
{ \
static TYPE NAME##Handle(INITIALIZER); \
InterlockedExchangePointer(&NAME##StaticPtr, &NAME##Handle); \
InterlockedExchange(&NAME##InitState, 2); \
} \
else \
{ \
while(InterlockedCompareExchange(&NAME##InitState, 2, 2) != 2)
{} \
} \
TYPE* NAME##Ptr;\
InterlockedExchangePointer(&NAME##Ptr, NAME##StaticPtr); \
TYPE& NAME = *(NAME##Ptr);
Thanks in advance,
Bertrand Tag: context switch Tag: 279320
Portability and MDI Application
Hi,
I am creating an application using MS Visual C++ 6.0 and MFC
(AppWizard exe). But when I run its debug version in other computers
where Visual Studio is not installed, its gives an error on startup
(Linking to MFC42D.dll failed). But it runs fine on computers having
VStudio installed. Please Tell me how can I make my application
portable.
Secondly, in my application(MDI) I want to create a new child window
when i click a certain menu item in my main menu (like in File->New)
where I can display a graph. Please tell me how I can a create a new
child window and use it.
Thanx in advance,
Rishabh Tag: context switch Tag: 279306
How to check dll version?
Hi,
I have got a vc6.0 project from my coleague. There are many dlls in this
project and export many functions. So in the main application, there are
bunch of "GetProcAddrss". I don't this kind of style.
I have a little knowledge of COM but do not have many experience, so I don't
want to use COM.
I want to export a class for every dll. The code like below:
//public interface file
class IHardwareInterface{
public:
virtual DWORD GetHost()=0;
virtual DWORD AddHost()=0;
...
};
extern "C" __declsepc(dllexport) IHardwareInterface* CreateInstance();
//implement file
class CHarewareImpl : public IHardwareInterface
{
...
};
Now, if in main application, I only need to create an interface for every
dll. I don't have to write bunch of "GetProcAddess". If I want to add more
export functions, I should update the interface class. What I worried about
is if I use the old dll, main application will not report any errors when
call "CreateInstance". It will report an error when I call the new function.
Is there any method to check whether the dll is consistent with the
interface file?
Any advice is appreciated. Thanks in advanced. Tag: context switch Tag: 279303
MMX registers
I was just wondering if there is a way to tell Visual Studio to use
the MMX registers to improve performance.
Thanks. Tag: context switch Tag: 279295
excerpt from lecture notes help
hey all,
http://www.difranco.net/cop2334/Outlines/fileproc.htm
there's a section called:
Writing Data Randomly to a Random-access File
can you make it write plain text to the text file and still make all the
random stuff work? what do you need to changed to make it write as plain text
instead of binary?
thanks,
rodchar Tag: context switch Tag: 279275
Structure size
I would like to allocate a structure size of 1024 bytes but I want the
compiler to do the calculation for me.
typedef struct
{
int var1;
short var2;
long var3;
char var4[ ?????? ];
} MYSTRUCT;
What I want to do is replace the ?????? something that will automattically
make the total structure 1024 bytes without having to manually count the
bytes of the other members myself.
Is that possible in vc++?
Thanks. Tag: context switch Tag: 279273
Basic terminology help
hey all,
what's the difference between an API and a library of functions such as MFC?
Are these terms synonomous?
thanks,
rodchar Tag: context switch Tag: 279266
Petzold's tome
hey all,
i started my reading of Programming Windows and have a newbie question about
the following excerpt:
Microsoft Windows version 3.1 was released in April 1992. Several
significant features included the TrueType font technology (which brought
scaleable outline fonts to Windows), multimedia (sound and music), Object
Linking and Embedding (OLE), and standardized common dialog boxes. Windows
3.1 ran only in protected mode and required a 286 or 386 processor with at
least 1 MB of memory.
The last sentence is my question what does that mean in lamen's terms to run
in protected mode?
thanks,
rodchar Tag: context switch Tag: 279259
Managed C++ changing a forms property (Text)
Hey,
I'm working more with C++ nowadays (Creating host managers for a game,
and i need the asm functionality to get it all working.
I am trying to do (from frmAttach), changing the Text property of
frmMain ---- i am from VB, so i have tried frmMain.Text, frmMain().Text,
frmMain::Text, etc.
How would i achieve this?
Cheers Tag: context switch Tag: 279254
get the idle time of an excel application
I need to get the idle time of an excel application that is opened
through VC++.
Once the excel is opened there should be a timer that starts and it
should re start when ever there is some activity in the excel and if
the excel is ideal for about 15 mins then there should be a pop up
message Tag: context switch Tag: 279244
Compiler optimization problem in MSVC 2003 Release mode
Hi,
I have written a small function to check whether a single precision
variable is sufficient to hold a double precision value. The code is
below
#include <stdio.h>
int cmpFloat_to_Double(float x, double y) { return x == y;}
#define IsSinglePrecisionSufficient(a) cmpFloat_to_Double((float)a, a)
void main( void )
{
double b = 0.7;
printf("%d",IsSinglePrecisionSufficient(b));
}
It works fine in debug mode giving output of 0 but in release it gives
1. Also if i change
int cmpFloat_to_Double(float x, double y) { return x == y;}
to
int cmpFloat_to_Double(volatile float x, volatile double y) { return x
== y;}
it works fine in release mode too.
Thanks
Shireesh Tag: context switch Tag: 279235
How to include a header file in another header file that....
Hello, I have a global header file called TypeDefs.H, this file is included
in header file of every class of my project. because all classes use custom
types. Now I have a class called CMyData which is also a member of some
structs in TypeDefs.H, so I have to include MyData.H in TypeDefs.H
problem is some members of CMyData are custom and defined in TypeDefs.H so I
also have to include TypeDefs.H in MyData.H
I agree that it may seem ugly but in this way I can keep things organized in
my brain, but compiler dose not like that and shouts loudly with thousands of
error messages. I even tried
to use
<code>
#ifndef MY_DATA_H_
#define MY_DATA_H_
...
#endif
</code>
in MyData.H
and
<code>
#ifndef TYPE_DEFS_H_
#define TYPE_DEFS_H_
...
#endif
</code>
in TypeDefs.H
but problem persists
can someone kindly tell me how can I get over this problem:) Tag: context switch Tag: 279231
Self Extracting Exe (how?)
Hello All,
I want to create a self-extracting executable to bind several files.
I have been looking at using custom resources to hold the desired files then
re-create the files from the resources. However, I ran into a problem. I've
been using
HGLOBAL hResource = LoadResource(hInst, FindResource(hinst,...,...));
LPVOID pData = LockResource(hResource);
/// Use data...
FreeResource();
Using this method, I have not been able to find the size of the memory
allocated. Without the size, I'm not able to know where each file ends.
GlobalSize() can not be used. Does anyone have any suggestions or different
approaches?
Thank you,
M Tag: context switch Tag: 279216
help with this article please
hey all,
can somone please try to open the source code in the following article in
VC++. Apparently the author used some other editor and when I try to open it
up I get a compile error.
http://www.codeproject.com/win32/Win32SDK_C_TabCtrl.asp
thanks,
rodchar Tag: context switch Tag: 279214
Function Identifier Not Found Error
Hi,
I was trying to compile some code and I am getting a "Function
identifier not found" error. I can't figure out why since the
function that it claims is not identified is very clearly laid out.
Here is the declaration in my h file:
#pragma once
#include "afxwin.h"
class CGUIDlg : public CDialog
{
// Construction
...
// Implementation
protected:
..
public:
BOOL processEventMsg(time_t TimeSec, UCHAR chan, int strtID, UCHAR
*buf, int siz);
...
...
};
My function is written in the code as:
BOOL CGUIDlg::processEventMsg(time_t TimeSec, UCHAR chan, int strtID,
UCHAR *buf, int siz)
{
...
}
And it is called in another function as:
void getAllRs232( int lr )
{
...
processEventMsg(TimeSec, (UCHAR)(lr+8),elmThree*32, adrs, length-1); //
These variables have been declared and used
...
}
However upon compilation the error states that processEventMsg
identifier is not found. I've tried moving around the function to
different area of the code but it gives the same error.
Does anyone have any ideas about what could cause this?
Thanks very much in advance for any help! Tag: context switch Tag: 279212
marquee in a dialog
hey all,
how hard would it be to put a simple marquee in a dialog box. The marquee
can be anything scrolling across the dialog such as plain text, hyperlinks,
and images.
any hints, articles, direction?
thanks,
rodchar Tag: context switch Tag: 279211
Function Identifier Not Found
Hi,
I was trying to compile some code and I am getting a "Function
identifier not found" error. I can't figure out why since the
function that it claims is not identified is very clearly laid out.
Here is the declaration in my h file:
#pragma once
#include "afxwin.h"
class CGUIDlg : public CDialog
{
// Construction
...
// Implementation
protected:
..
public:
BOOL processEventMsg(time_t TimeSec, UCHAR chan, int strtID, UCHAR
*buf, int siz);
...
...
};
My function is written in the code as:
BOOL CGUIDlg::processEventMsg(time_t TimeSec, UCHAR chan, int strtID,
UCHAR *buf, int siz)
{
...
}
And it is called in another function as:
void getAllRs232( int lr )
{
...
processEventMsg(TimeSec, (UCHAR)(lr+8),elmThree*32, adrs, length-1); //
These variables have been declared and used
...
}
However upon compilation the error states that processEventMsg
identifier is not found. I've tried moving around the function to
different area of the code but it gives the same error.
Does anyone have any ideas about what could cause this?
Thanks very much in advance for any help! Tag: context switch Tag: 279209
Function identifier not found
Hi,
I was trying to compile some code and I am getting a "Function
identifier not found" error. I can't figure out why since the
function that it claims is not identified is very clearly laid out.
Here is the declaration in my h file:
#pragma once
#include "afxwin.h"
class CGUIDlg : public CDialog
{
// Construction
...
// Implementation
protected:
..
public:
BOOL processEventMsg(time_t TimeSec, UCHAR chan, int strtID, UCHAR
*buf, int siz);
...
...
};
My function is written in the code as:
BOOL CGUIDlg::processEventMsg(time_t TimeSec, UCHAR chan, int strtID,
UCHAR *buf, int siz)
{
...
}
And it is called in another function as:
void getAllRs232( int lr )
{
...
processEventMsg(TimeSec, (UCHAR)(lr+8),elmThree*32, adrs, length-1); //
These variables have been declared and used
...
}
However upon compilation the error states that processEventMsg
identifier is not found. I've tried moving around the function to
different area of the code but it gives the same error.
Does anyone have any ideas about what could cause this?
Thanks very much in advance for any help! Tag: context switch Tag: 279208
std::vector subscript out of range
Hello,
I really think I have to get a C++ book.... but let me ask one more question
Code Snippet
struct
{
std::string name;
...
} FRUIT, *PFRUIT;
struct
{
std::vector<FRUIT> fruitarr;
} fruittab;
std::string a;
fruittab.fruitarr[i].name = a;
the variable of i is 0 when called, but it returns vector subscript out of
range error Tag: context switch Tag: 279194
Question about TCHAR string
Hi,
I've been spoiled with C# and the easy to use string functions. Now I'm into
a bit of C++ for writing a custom action for a DLL to be incorporated into an
MSI installer. Yikes.
What I'm basically doing is getting the Product Key from the
MsiGetProperty() function, like this -
TCHAR szPidKey[MAX_PATH];
DWORD dwPath;
dwPath = sizeof(szPidKey) / sizeof(TCHAR);
MsiGetProperty(hInstall, TEXT("PIDKEY"), szPidKey, &dwPath);
So I have my Product ID in szPidKey. Now I want to do some manual
verification of it. The Product ID is of the form -
123456789-ABCD-12
I need to verify this code so I need access to the beginning part
(123456789) and the end part (12). So I'm looking for a way to substring out
those parts of the string. I'm also looking to convert those substrings into
integer or long data type so i can do some checking on them, is it ok to use
itoa to do that?
Thanks very much for any hints.
David Tag: context switch Tag: 279190
How to turn vector to an address
Hi,
Here is the code snippet, don't mind its correctness, just take it as an
example
struct
{
...
} FRUIT, *PFRUIT;
struct
{
std::vector<FRUIT> fruitarr;
};
============================
I have an address comparison...
pos = a - fruitarr; (a is PFRUIT, b4 modification fruitarr was also of type
PFRUIT)
============================
And the subtraction worked very well until I changed that line to
std::vector
The statement pos = a - fruitarr; did not work any more (compile-time error)
My question is how do I get the address from the vector<FRUIT> object?
Thanks
Jack Tag: context switch Tag: 279181
CloseHandle and WriteFile
Hi there!
I create a file using CreateFile(...), and write some data to the file
handle ,say hFile, using WriteFile(...) I wonder if I call CloseHandle
(hFile) to the handle, at the same time , WriteFile is operating on the file
handle , whether the WriteFile will block the CloseHandle? Tag: context switch Tag: 279172
How to make SetCursor work
I would like to set an hourglass cursor.
I say:
SetCursor(LoadCursor(NULL, IDC_WAIT))
for setting the hourglass cursor
and:
SetCursor(LoadCursor(NULL, IDC_ARROW))
for going back to the regular cursor.
But neither cursor gets set?
Please help! Thanks! Tag: context switch Tag: 279155
is there another way to get edit box
hey all,
i found this snippet in tutorial which show how to retrieve a value from an
edit box just using win32api, is there another way to get this thru just the
api?
// TODO: Read an edit box
int len;
len = GetWindowTextLength(m_hFirstNameEdit);
if (len>0) {
char* buf;
buf = (char *)GlobalAlloc(GPTR, len+1);
GetDlgItemText(m_hWnd, IDE_FIRSTNAME, buf, len + 1);
// .... work witht the text
MessageBox(m_hWnd, buf,"Hello",
MB_OK | MB_ICONEXCLAMATION);
GlobalFree((HANDLE)buf);
}
thanks,
rodchar Tag: context switch Tag: 279150
Dialogbox question
If I use dialogbox() function to specify a dialogbox (template already in
resource), is there any way for me to specify the dialogbox window size?
(since I don't have access to the actual CreateWindow but the dialogbox()
function helped did so, so I want to know whether it's possible to specify
those sizes manually for the dialogbox in code but not create a window
manually.) Tag: context switch Tag: 279140
snippet of code
hey all,
does this snippet of code indicate any presence of MFC or Microsoft Libraries:
//Populate ComboBox
FillListBox(hwndList);
//Set a Default Selection
SendMessage(hwndList, CB_SETCURSEL, 0, 0);
GetWindowText(hwndList, pVarName, 30);
SetWindowText(hwndText, pVarName);
return 0;
I'm particularly interested in the GET/SET WindowText functions. How would I
be able to tell?
thanks,
rodchar Tag: context switch Tag: 279133
history lesson
hey all,
with the start of my c++ journey i see substitutions like LPSTR for char*
for instantance. can someone please brief me on why this is and if possible a
list of common substitutions?
thanks,
rodchar Tag: context switch Tag: 279131
SplashButton question
Hi,
I have a splashbutton, in there I am using AddMessage method to add
message on the fly. Actually I show the progress. I ran into a
problem. First I show a number say 10% on the second round, I want to
change the text to 20%. So I first write " " (blank characters)
and then write the new number. So users get the feeling the progress
is happening. But When I tried, the blank characters are not writing
and the text is over writing itself. Could some one help? Here is the
code I am trying to do it.
AddMessage(" ", SLIDE_TEXT_FONT,
SLIDE_TEXT_FROM_BOTTOM,
0, SLIDE_TEXT_FROM_RIGHT,
FW_NORMAL, FALSE, FALSE, TA_CENTER,
DT_CENTER|DT_BOTTOM|DT_SINGLELINE,
SLIDE_COLOR);
AddMessage(m_csSlideText, SLIDE_TEXT_FONT,
SLIDE_TEXT_FROM_BOTTOM,
0, SLIDE_TEXT_FROM_RIGHT,
FW_NORMAL, FALSE, FALSE, TA_CENTER,
DT_CENTER|DT_BOTTOM|DT_SINGLELINE,
SLIDE_COLOR);
Thanks all. Tag: context switch Tag: 279130
ms visual studio 2005 building older application - error C2143: syntax error : missing '{' before '__stdcall'
Hi.
I am very unfamiliar with VC++, having mostly other compiler experience in my
past.
I have installed visual studio 2005 and am trying to build an application that
supposedly built fine previously with Visual Studio c++ 6.0.
preprocessor definitions are: WIN32;_DEBUG;_WINDOWS
On this line (the BOOL __export CALLBACK line) in a ".c" (c not c++) file:
BOOL __export CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
{switch (message) {case WM_INITDIALOG:return (TRUE); ...
I get this error:
error C2143: syntax error : missing '{' before '__stdcall'
Can someone recommend a course of action, or tell me what the problem is?
thanks
Jeff
Jeff Kish Tag: context switch Tag: 279115
Window Message (WM_xxxx)
Hi all, (and please forgive my frenchy english!)
I'm using VS PRO 2005, developing API without MFC.
I'd like to know the Message that is send to the program when the
window is dragged out of the screen, in order to correctly redraw it.
Thanks in advance, and feel free to ask more details.
regards,
Thomas. Tag: context switch Tag: 279114
Problem using unmanaged static libs from managed C++ Windows Form Application in VC2005
I have some Static libs which were intially implemented in VC6 and
then converted to VC2005.
When I try to use these in my managed C++ application, I am getting
the following exception:
An unhandled exception of type 'System.TypeInitializationException'
occurred in Unknown Module.
Additional information: The type initializer for '<Module>' threw an
exception.
Any comments/url is appreciated.
Here is the output :
-------------------------------------
First-chance exception at 0x1021c0a7 (msvcr80d.dll) in NewTestVC.exe:
0xC0000005: Access violation reading location 0xae59162c.
A first chance exception of type 'System.AccessViolationException'
occurred in NewTestVC.exe
First-chance exception at 0x7c96df51 in NewTestVC.exe: 0xC0000005:
Access violation reading location 0xae591630.
A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll
A first chance exception of type
'<CrtImplementationDetails>.ModuleLoadExceptionHandlerException'
occurred in msvcm80d.dll
First-chance exception at 0x7c812a5b in NewTestVC.exe: Microsoft C++
exception: [rethrow] at memory location 0x00000000..
An unhandled exception of type 'System.TypeInitializationException'
occurred in Unknown Module.
Thanks a lot for the help, Tag: context switch Tag: 279111
VS 2005 conditional compilation syntax coloring
hi
I have some code which looks like this
#if defined (XYZ_PQ)
// do something
#endif
In my project settings , under c++ settings I have set the XYZ_PQ
macro as a preprocessor define.
WHen I debug I am able to set a breakpoint in the code,
but the syntax coloring colors the code grey and if I right click on
the code, the go to definition and go to declration part are greyed
out!
how to do get the editor to identify that the symbol is defined.
Regards
Chiman Tag: context switch Tag: 279106
redirecting cout - is it possible with dynamically loaded DLL?
Folks,
I am redirecting the standard output from my console application to a
log file.
Dynamically loaded DLLs seem not the see this redirection, and still
echo on the console.
Here is the sequence of events in more detail:
1) Starting console application from the command prompt.
2) The application loads a shared library using the "LoadLibraryEx"
function.
The library is loaded and correctly executes an initialization
routine.
3) The console application now redirects cout to a new file.
The (simplified) code used to achieve this is as follows:
log.open(x.c_str(), ios::out);
cout.rdbuf(log.rdbuf());
4) Logging statements in the main application (coded with "cout <<")
write to the new file, as expected.
Logging statements in the shared library (also coded with "cout
<<") continue to be logged to the console, which is not what I want.
Switching the order of steps 2 and 3 doesn't change the behavior.
The code does work fine when running under Linux.
Is the above behavior expected? Or, am I missing something? Any
solutions or alternatives?
All input greatly appreciated,
Johan Tag: context switch Tag: 279105
[Music Movies Soft] Free binaries search & download = www.GEGEREKA.com
Project of the year: Incredible unique search machine like nothing on earth.
MP3,MPEG,AVI,DIVX,DLL,PHP,EXE,ISO, ...and much more
Millions files for everyone. Music, movies, soft and other media.
http://www.GEGEREKA.com : THE LORD OF DOWNLOADS. Tag: context switch Tag: 279095
I was just wondering if Windows XP always saves and restores the MMX
and SSE registers during a context switch. Any help is appreciated.