c++

need your advice regarding this desktop animation application

i want to create an application that when running would make appear a circle ( radius and color configurable ) move from centre-down of my laptop screen to centre-up ( speed of motion configurable ). this animation should run in a loop as long as the program is running and i want to know is it also possible that when this circle is runni...

Trying to create a Math Input Panel in C#

How do I create a Math Input Panel in C#? I have tried to put it into a dll and call it but it just closes right away. #include <stdafx.h> #include <atlbase.h> #include "micaut.h" #include "micaut_i.c" extern "C" __declspec(dllexport) int run() { CComPtr<IMathInputControl> g_spMIC; // Math Input Control HRESULT hr = CoInitializ...

How to find whether system has the font I needed in MFC?

I want to write the following function bool IsFontExistInSystem(const CString& fontStyle) const { } Is there any API in windows to do this? Many Thanks! ...

How to Enable/Disable Jumbo Frames in NIC Card using VC++ [Programmatically]

Hi, I wanted to know how to enable or disable jumbo frames for Installed NIC Card Programmatically.. For Installed NIC Card..We can set in using GUI..But i wanted to do it Programmatically in VC++ Answers will be Highly Appreciated. Thanks in Advance. ...

sendto fails with a non administrator user with errorcode 10013

Hi! I found more source codes which are working like ping. My only problem with them is, that if i run the program with a non administrative user, then i get back errorcode 10013 which means : "An attempt was made to access a socket in a way forbidden by its access permissions." If i run the program with a user which is member of the ad...

operator= (T *r) in nested templates

Hi everybody. I have a problem concerning nested templates and the overriding of the assignment operator. Say i want to have a refcounting class template _reference. This _reference for now simply holds a pointer to the ref-counted object. The problem now is that this all works fine, as long as im doing this with simple classes or str...

link time error in vc++ when using confuse library

Hello to everyone, I am trying to use confuse library on windows. I get a link time error when confuse is compiled in vc++. how to resolve it. Please note that libConfuse is a configuration file parser library and written in C. 1>Linking... 1>main.obj : error LNK2019: unresolved external symbol __imp__cfg_opt_getnint referenced in fu...

OS API allocates members in struct. Free just the struct or every member first?

Let's say we have an array of PRINTER_INFO_2 like this: PRINTER_INFO_2* printers = (PRINTER_INFO_2*)malloc(sizeof(PRINTER_INFO_2) * 64); // room for 64 items Then we call EnumPrinters() to get a list of locally installed printers: EnumPrinters( PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)printers, ...); Here's the stru...

Calculate the first day of a calendar week [C++]

I need to calculate the date of the first day in a calendar week, e.g. Week 1 in 2009 -> Mon, 29.12.2008 (!) Week 44 in 2009 -> Mon, 26.10.2009 I have some ugly code for this, but I would prefer a nice C++ lib. Any suggestions? Thanks. ...

C-DLL from C++ source

I have a C-Wrapper for my C++ Framework. Since this should run on mac and windows I am using scons: env = Environment() env.Append(CPPPATH = ['./']) env.Append(LIBS = 'kernel32.lib') env.Append(LIBPATH = 'C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib') env.SharedLibrary(target='warpLib', source='warplib.cpp') Simple Versions of w...

Is there any safe strcmp?

I made a function like this: bool IsSameString(char* p1, char* p2) { return 0 == strcmp(p1, p2); } The problem is that sometimes, by mistake, arguments are passed which are not strings (meaning that p1 or p2 is not terminated with a null character). Then, strcmp continues comparing until it reaches non-accessible memory and cras...

AMD multi-core programming

I want to start to write applications(C++) that will utilize the additional cores to execute portions of the code that have a need to perform lots of calculations and whose computations are independent of each other. I have the following processor : x64 Family 15 Model 104 Stepping 2 Authentic AMD ~1900 Mhz running on Windows Vista Home...

Is type specifier required for const?

Is a type specifier required here? const c = 7; Bjarne Stroustrup's 'The C++ Programming Language' on page 80 says that this is illegal. However, I've been practicing some brainbench tests, and one of the questions states that the type defaults to int. Brainbench is usually correct, so I'm unsure of which reference is right, and I've ...

C++ linker issues

Hello there, I have this: a.cpp int localfunction () { return 1; } int local_symbol = localfunction(); b.cpp void thirdfunction () {}; main.cpp void main () { thirdfunction (); } When I compile this in a main executable everything works (even with optimizations), and the localfunction is executed at startup even if I don't ...

Access protected member of a class in a derived class

Hi ho, i have an old codebase here, where they used protected member variables. Whether or not this is a good idea can be discussed. However, the code must have compiled fine with gcc3. I have a derived template class Bar that uses protected member x from class template Foo like so template <class Something> class Foo { public: //...

Can I use a C style library built with VC6 directly in VC9 project?

We use an internal library(developed by some other team) built with VC6 compiler. This library mainly contains C Style APIs. We have a plan to migrate to Visual Studio 9 compiler. Should I request for the library to be built with VC9 compiler? A more generic question, On which points ( may be name mangling, optimization etc) a DLL buil...

C++ Win32 -- COM Method: equivalent C declaration

I've been told that every COM method callable from C++ code (take for instance IHTMLDocument2::write) has an equivalent C declaration, usable from C code... How do I find it? Thanks in advance! ...

Does changing vector size spoil iterators?

I found that this C++ code: vector<int> a; a.push_back(1); a.push_back(2); vector<int>::iterator it = a.begin(); a.push_back(4); cout << *it; print some big random number; but if you add a.push_back(3) between 3rd and 4th lines, it will print 1. Can you explain it to me? ...

Non Blocking Keyboard on WinCE accessing the virtual keyboard

Hello Guys, I am desperately looking for a solution that enables me to read keyboard events in a non blocking way. These Keyboard events are generated by a VIRTUAL KEYBOARD that comes with the WinCE device. I have a console application running in C++, where the user is asked to navigate via 'ESC', 'U' and other characters through the me...

Using Boost Python with Weak Ptrs?

Trying to set up a dependency in C++ with a parent-child relationship. The parent contains the child and the child has a weak pointer to the parent. I would also like to be able to derive from the parent in Python. However, when I do this, I get a weak pointer error connecting up this parent-child relationship. C++ code: #include <boo...