visual-c++

Windows Controls or .NET objects as Global Variable in Visual C++

Hi, I'm Writing a C++ Class. I want to keep a global variable in System::Windows::Form::Control type or a .NET managed objects. I want to process somethink on this global variable. But Visual C++ is not allowed this. Returning Error is: "global or static variable may not have managed type" May be this error interest Garbage Collector...

Problem with Visual C++ program-- can't find the Debug CRT

Hi everyone, I have a friend who's taking over a Visual C++ project from me and is having trouble running it. It's a graphics application and it uses the Qt GUI library. The reason I mention this is because of the error below. He can build and link the program using Visual Studio 2010, but when he runs it this message comes up in the ...

Why Static variable initialization internally tries to acquire _lock(_EXIT_LOCK1)

Why Static variable initialization internally tries to acquire _lock(_EXIT_LOCK1)? Here is the calls stack when the initialization of a local static variable happens. *MSVCR80!_lock+0x2e MyDLL32.dll!_onexit(int (void)* func=0x0864ae10) Line 103 C MyDLL32.dll!atexit(void (void)* func=0x0864ae10) Line 127 + 0x9 bytes C* Can you p...

Sending data from VC++ to Visual Basic in a .NET framework.

I'm having a heck of a time figuring this out, the tutorials I found on the web are not complete or are for VB 6.0 (obsolete in some cases). On the C++ side I have the following :: ..... hwndExternalApplication = FindWindow(NULL, L"Dromocast Client"); SendMessage(hwndExternalApplication, WM_SETTEXT, NULL, (LPARAM)"Hello"); ..... "Dro...

Flex/bison compile error on windows

Hi, i have a lex and yacc file which compiles fine on linux. When i try to compile it on windows using Visual c++ using the lex.yy.c & y.tab.c files i get the following error: program1.y(184) : error C2059: syntax error : '<' line 184 is #define YYLAST 95 ...

How to create resource manager dll in VC++?

Hi guys! I need to create a DLL that acts as a resource manager (string resources). This dll must have methods that will return target strings based on the target language resource dll. I know how to implement this in C# but I need this one to be implemented in VC++ in certain reasons. I already read many articles but it is hard to under...

How to Lock Queue Variable Address instead of using Critical Section ?

Hi, I have 2 threads and global Queue, one thread (t1) push the data and another one(t2) pops the data, i wanted to sync this operation without using function where we can use that queue with critical section using windows API. The Queue is global, and i wanted to know how to sync, is it done by locking address of Queue?. Answers wil...

software update

Hi. i want general idea about how to write the software update for an application? which technology is simple like VC++ or .Net?.. i just need the idea in brief. ...

How to prevent VC++ 9 linker from linking unnecessary global variables?

I'm playing with function-level linking in VC++. I've enabled /OPT:REF and /OPT:ICF and the linker is happy to eliminate all unused functions. Not so with variables. The following code is to demonstrate the problem only, I fully understand that actually having code structured that way is suboptimal. //A.cpp SomeType variable1; //B.cpp...

How can we capture a mouse event when it's already out of the client area?

Hi All, I have an application that has a list of buttons and has customized tooltips. Whenever the mouse hovers through the buttons, the tooltips come out and is working fine. However, I want to hide the tooltips when the mouse cursor is outside the client area. How can I tell my application that the mouse is already out of the client ...

How to overcome vc++ warning C4003 while writing common code for both gcc and vc++

I have a code that is compiled in both gcc and vc++. The code has a common macro which is called in two scenarios. When we pass some parameters to it. When we don't want to pass any parameters to it. An example of such a code is: #define B(X) A1##X int main() { int B(123), B(); return 0; } The expect output from ...

How can I center an MFC MDI application at startup?

I am working with a legacy MFC (VC 6) application that needs to be modified to be centered vertically and horizontally on the screen at startup. I have tried using the call to CenterWindow in the main frame OnCreate call, but that doesn't appear to do anything. Any help would be greatly appreciated. ...

visual studio c++

Hi. I am write the code. I'm writing a program that will install the software at startup. When the installation file has the extension .msi all is well, I used (found it in SetupAPI) method MsiInstallProduct. And what to do when the installation file has the extension .exe? I would like to start the installation regardless of the user. C...

Locating what lib is linking to the debug CRT

We link our app with numerous different static libs, the problem is that one of these libs is in turn linking with the VC90.DebugCRT even in release. Some libs we don't even have the source to, so it would be nice if there's a way to locate what lib is the actual culprit. I've toyed around some with dumpbin, but am unable to find a way t...

is there a new equalivant of _malloca

I am a big fan of the _malloca but I can't use it with classes. Is there a stack based dynamic allocation method for classes. Is this a bad idea, another vestige of c which should ideologically be opposed or just continue to use it for limited purposes. ...

MSVC# and Debugging Infinite Loops

Hi there, I'm building a game in XNA. But that's not that important. The thing is, whenever I start the game, it crashes, and I believe it some sort of infinite loop, or recurring calls between methods. Is there any way I can just stop the program at any second and see what the last n steps it took was? This way I could find out what's ...

MFC Virtual List Control using Database

Hi, Does anyone know of a good MFC example of how to create and use a virtual list control with a database that has 100K records? I don't want to load in all the records at once because it takes too much time. I want all updates to the list control to be fast based on user interaction. Thanks, Mike ...

Basic Code Layout Question

HI, I have a simple question, I've asked 3-4 different people and have had different answers from each of them. Which code layout is better and used more? does it really matter as long as it's consistent? Which is seen as better practice in the world of working as a programmer? Eg A) for(int i=0;i<8;i++) { for(int p=0;p<8;p++)...

VS 2008 C++ build output?

Why when I watch the build output from a VC++ project in VS do I see: 1>Compiling... 1>a.cpp 1>b.cpp 1>c.cpp 1>d.cpp 1>e.cpp [etc...] 1>Generating code... 1>x.cpp 1>y.cpp [etc...] The output looks as though several compilation units are being handled before any code is generated. Is this really going on? I'm t...

MSVC: Embedding Data in Program

I'm hoping someone has run into this sort of problem before, and can give me a hint to solve it. With Microsoft Visual C++ 2005, I have this code in a program: DWORD locator[FOURXFLAGCOUNT+1]={ 0x58585858, 0x58585858, 0x58585858, 0x58585858, 0x58585858, 0x58585858, 0x58585858, 0x58585858, 0x58585858, 0x58585858, 0x58585858,...