Answer Questions
Ricky Pusch Associating an HotKey
I'm working on a program to take screen shots. What I want to do is to make my program respond when the key "Print Screen" is pressed, even if my program doesn't have the focus. I searched the Internet for hours but didn't managed this, probably because I'm a newbie in C++. Can anybody help me I'll greatly appreciate it! Thanks We can do one thing to take the screen shot before launching the program,i.e,just sleep for 1 or 2 seconds before launching the exe.You won't get the exe window captured. What I want to do is to make my program respond when the key "Print Screen" is pressed, even if my program doesn't have the focus. Your proram must have focus to process ...Show All
vijee Problem : D3D-overloads : from MVStudio 2003 to 2005
I have an application running in Studio 2003, which use #define D3D_OVERLOADS. At this moment I have installed Microsoft Visual Studio 2005 but my application doesn't work anymore : Cannot open include file: 'd3d.h' ... Cannot open include file: 'ddraw.h'... Can anyone give my tips on how to solve this problem Thanks I have a similar problem - porting a project from VC6 to VC2005, the d3d.h and d3dtypes.h files are missing - they are there in the VC6 VC98\Include directory, but not anywhere for VC2005. By installing DirectX SDK, do I understand correctly that I should download and install the 509MB dxsdk_oct2006.exe file, or am I missing something Thanks in advance. Yes: tha ...Show All
Walter Poupore - MSFT MSBuild running from Local System
Hi I've been executing msbuild.exe from the NT_AUTHORITY\SYSTEM account to build VS 2005 C# projects and the builds have been working as expected. Recently, I attempted the same for a VS 2004 C++ project and the build failed with the following error. fatal error C1902: Program database manager mismatch; please check your installation Is this a bug with msbuild or am I doing something wrong Thanks Can you please post a link. I have been unable to find this hotfix. Thank you! You can contact your PSS representative for information regarding the availability of a hot-fix for this issue. Hi Mark, I have run into the same problem, but the folks we have spoken wit ...Show All
Eric Best VC++2005 Behaviour When Reading Numbers Followed By Commas
I’m having a problem in Visual C++ 2005 with a program that works fine in earlier versions as well as in compilers like Dev-CPP. I’ve got a file containing a series of records one on each line. Each record starts with a date followed by a series of comma separated numbers. When reading the dates in Visual C++ 2005 the program fails on the first year component which is the first value followed by a comma. To illustrate the problem I’ve written the below program. #include <iostream> #include <fstream> using namespace std; int main(int argc, char *argv[]) { ifstream fin("records.txt"); int iCurrentDay = -1; int iCurrentMonth = -1; int iCurrentYear = -1; while (fin.good()) { fin >> iCurrentDay; fin.ig ...Show All
AlanKohl #pragma make_public, ClsCompliantAttribute and LNK2022 errors
I am getting the following VC8 linker error on my mixed assembly which is comprised of old syntax MEC++. TextElement.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are not consistent: (0x0c0002fa). LINK : fatal error LNK1255: link failed because of metadata errors I ran ildasm on the above .obj and 0x0c0002fa appears to be the CLSCompliant attribute on a native type for which I have specified #pragma make_public in one of my compilands. I don't have any idea how to make the linker happy here. Not specifying make_public on the type makes the linker error go away, but I need the type to be made public since it is in the signature of a few public methods. Below is the VC8 ildasm output, and below that ...Show All
c.paddock ArrayList vs. cli::array
Hey all, I've been passing a lot of arrays around in on of my latest programs, and I'm wondering if it is more efficient to pass an ArrayList of objects or a cli array of objects ArrayList and cli::array are both reference types so no matter which one you pass as a parameter is the same thing, a reference (4 bytes on a 32 bit version, 8 bytes on a 64 bit version) will be passed to the function. Beyond this there are many things that are different but it really depends on how you are using the arrays. In most cases an array is more efficient because: 1) it does not box value types 2) you don't need to cast when you retrieve an element of array 3) it uses exactly the same memory as it's require ...Show All
ukrob Reference to DLL behaves differently than Reference to Project
Ok, this IMO defies all logic and reasoning. I have the same identical C++ Project in two solutions. I know these are identical because I copied the entire project from one solution and pasted in another and that added that pasted project to the solution. In one solution, the C++ Project references a C# Project. In the other solution, the C++ Project references the compiled DLL of the same C# Project. These are the steps that I performed to ensure that I am working with correct DLL. First, I cleaned both solutions so that no DLL's are available. Second, in the C++ Project that was referencing the DLL, I removed the reference to ensure I am referencing the new DLL. Third, I compiled the C# Project. Then, I took the freshly compiled DLL f ...Show All
Maeestro Using CTS in RS232 Comm
Trying to send data using a COM port to a device that uses CTS to control data flow. Using OpenFile and WriteFile. Setting the dcb.fOutxCtsFlow seems to have no effect on the output stream, the system sends out characters when CTS is not asserted. Thanks for any help, Bob but when i use GetCOMMModemSatus function, it always return 0, and the error code is 995. So could you pls tell me what kinds of cases will cause this function returns error Does it have relationship with BaudRate Thank you! Are you calling SetCommState() with the DCB you created There is another program I can run, executable only, to communicate with the same device and it works correctly. I have a ...Show All
Shady Brady help regarding MakeFile
Hi, I have a set of .c files and .h header files.There are also a couple of MakeFiles.I have a file called Makefile.mine which i have to use for compiling.How do i go about using it in Visual C++ 2005 express The situation is, i tried to create a Makefile project and it asks for Build command line , rebuild command , clean command and so on.. since im new to using these , im confused how to go about doing it.Please help me. Hi, Could you please give one complete example for using Makefile based projects like : .cpp file >> helloworld would do .mak file >> name of the make file and its contents Build/Re-Build and Output >> i want to get .exe ...Show All
javathehut .NET Applications + Single Instances
Is there a way in C++ to stop multiple instances of a programs from running Can you check somehow to see if an instance is already running and then not start anotherone Thanks, Michael Usually this is done with named mutex: using namespace System; using namespace System::Threading; int main( array <System::String ^> ^args) { bool createdNew; Mutex^ mutex = gcnew Mutex(true, "AMutexNameThatTriesToBeUnique", createdNew); if (!createdNew) { Console::WriteLine(L"I'm already running !"); return 0; } Console::WriteLine(L"Hello World"); Console::ReadLine(); return 0; } While VB.NET ...Show All
xaxik Application throwing a generic error.
I'm developing a TcpServer in C++/CLI. I have everything coded. Now the problem is that when I want to close the connection to a client, it throws a generic error. A NullReferenceException. I am storing each client in an array. Here is the code and God bless you if you can help me fix this. The for each loop where you're processing the close command : for each (Socket ^client in clientarr) is actually looping over all 100 elements in the array, most of which are null. That's because for each doesn't know anything about the validity of the values of the array elements, it just sees 100 handles that you've allocated, so then it blows up when you access the RemoteEndPoint property. I found that adding a check for null fixes the code: ...Show All
chamsoft what is the problem about following code?
const int & ref(const int &a){ return a; } int val(int a){ return a; } int a=1; const int &b = ref(val(a)); thanks. const int &c = val(a);//must be OK, C++ standard: the valid scope of a const & to a temp var is same as the scope of the const & but how is const int &b = ref(val(a)); What C++ standard says Is compiler bug or user bug see next example: auto_ptr<char> const &ref(auto_ptr<char> const& p) { return p; } { auto_ptr<char> const& ptr = auto_ptr<char>(new char(0)); ASSERT(*ptr == 0);//ok }// call ~auto_ptr and delete the char { ...Show All
alimuradjamali How to use LoadLibrary (win32 api) in C++/CLI without P/Invoke??
Hello All, I'm trying to call an unmanaged win32 api "LoadLibrary" from my C++/CLI based project. I'm using Visual Studio 2005. +++++++++++++++++++++ Project Settings: In C++ compiler command line, I've a "/clr" switch Also in the Linker command line, I've a reference to "user32.lib" +++++++++++++++++++++ In "Stdafx.h" I've added "#include <Windows.h>" The error I get is: error C2039: 'LoadLibrary' : is not a member of '`global namespace'' and (followed by) error C3861: 'LoadLibrary': identifier not found ++++++++++++++++++++ I'm not interested in using P/Invoke facility (DllImport attribute) to invoke this api. What am I missing in the pr ...Show All
Ashesman How do I include CInternetSession?
CInternetSession requires the "afxwin.h" header file to be included. If i put #include "afxwin.h" at the beginning of my program i get an error message saying that "afxwin.h" doesn't exist. If I do not type this it can't find any of the CInternetSession functions. What do I need to include/do in order to use CInternetSession This class actually seems to be located in "afxinet.h" header file, and you should use "< >" syntax: #include <afxinet.h> . The file belongs to MFC library, which probably is not delivered with any version of Visual Studio. You should be sure your Visual Studio contains files related to MFC (make a search for &qu ...Show All
Rick Casey fatal error C1902: Program database manager mismatch; please check your installation
Hi, I am having trouble getting my MSVC Express 2005 / Platform SDK environment (downloaded from Microsoft about two weeks ago) so that it can compile debug binaries. If I don't give cl the -Zi option, I can compile and link correctly, but with -Zi, I get the following: $ /cygdrive/e/users/cmiss/physiome_builds/trees/xpcellml_api/cygwin-wrapper cl -c -Zi -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -EHsc -TP -nologo -MD -D__WIN32__ -DXP_WIN -DXP_WIN32 -D__x86__ -I/cygdrive/e/users/cmiss/physiome_builds/trees/mozilla_trunk/obj-i686-pc-cygwin/stablexr/dist/include/xpcom/ -I/cygdrive/e/users/cmiss/physiome_builds/trees/mozilla_trunk/obj-i686-pc-cygwin/stablexr/dist/include/nspr/ -I/cygdrive/e/users/cmiss/physiome_builds/trees/mozilla_trunk/o ...Show All
