I am trying to improve my coding skills by making my code more structured and readable. I code the GUI (thanks edit). I have been reading through Firefox's open source code to improve but it uses GTK+ and not much Win32.
Where can I find an open source (professional) program that is coded in Win32?
One more thing: When should one write...
Hello all.
My first post here so be please be kind :)
I searched SO before posting but I couldn't find an answer (it's possible that my search wasn't the best though)
I'm starting to learn C++ and as an exercise decide to implement a simple LinkedList class (Below there is part of the code). I have a question regarding the way the cop...
I have a Visual Studio 2005 solution with several projects that build independently of each other. The main project statically links the other projects. I'm getting very strange STL vector corruption in one of those statically-linked libraries. For example, I declare a std::vector and then perform a sort( thatVector.begin(), thatVector.e...
I'm porting a cross-platform lib I use to Alchemy. One particular file has a block of code similar to this :
#if defined(WIN32)
// Do some Windows-specific stuff
#elif defined(__linux__)
// Do some linux-specific stuff
#endif
I now need to add Flash-specific code (NOP in some cases), but so far I've been unable to find what do...
Is there a common portable idiom in numerics code (I'm writing in D, but language-agnostic, C and C++ answers would be useful to me, too) to ensure that all stack-allocated doubles that are accessed frequently are aligned on 8-byte boundaries? I'm currently optimizing some numerics code where misaligned stack-allocated doubles (only ali...
I'm trying to create a method (using the A* algorithm) that solves a puzzle and returns the steps to that solution. The solution it's easy.. but I can't return the path to that.
I used a list of Nodes and then every time a push back a new Node I set the parent pointing to the Node which new came;
list<Node> opened;
list<Node> closed;
...
I learnt a lot about weak_ptr working with share_ptr to break cyclic reference. How does it work? How to use that? Can any body give me an example? I am totally lost here.
One more question, what's a strong pointer?
...
I have a problem with using a pointer to function in C++. Here is my example:
#include <iostream>
using namespace std;
class bar
{
public:
void (*funcP)();
};
class foo
{
public:
bar myBar;
void hello(){cout << "hello" << endl;};
};
void byebye()
{
cout << "bye" << endl;
}
int main()
{
foo testFoo;
testFoo...
Hi All,
We have a java application which run as server running on a remote windows system which is started though a batch script which includes some initialization configurations.
To avoid login into the system every time and starting / stopping the service I planned to add that batch script as a "Windows Service" and use it remotely ...
I'm learning C++ and came across those *.lib files that are obviously used by the linker. I had to set some additional dependencies for OpenGL.
What exactly are library files in this context used for?
What are their contents?
How are they generated?
Is there anything else worth knowing about them?
Or are they just nothing more than r...
(In short: main()'s WaitForSingleObject hangs in the program below).
I'm trying to write a piece of code that dispatches threads and waits for them to finish before it resumes. Instead of creating the threads every time, which is costly, I put them to sleep. The main thread creates X threads in CREATE_SUSPENDED state.
The synch is done...
I have a solution with Many dlls and two exe's. The exes are Dependant on the dlls when I make an internal change to any of the dlls one of my exes rebuilds and generates all its code every time. My assumption would be that it would only need to relink if no source file it depended on had changed. Could there be a setting I am missing...
Hi,
I am running into lots of problems with Unicode at the moment. As I understand it, TCHAR is defined to be either a wchar_t or a char depending on whether _UNICODE is defined somewhere, and there are various other functions to help with this. Apparently _T("x") should evaulate 'x' to either a wchar_t or a char depending on how stuff ...
I'm trying to develop a pretty simple (for now) wrapper class around int, and was hoping to overload the = operator to achieve something like the following:
class IntWrapper
{
...
private:
int val;
}
int main ( )
{
IntWrapper a;
int b;
a = 5; // uses overloaded = to implement setter
b = a; // uses overl...
How long is the typical overhead added by calling a .dll written in C++ from a C# application using the following syntax?
[DllImport("abc.dll", EntryPoint = "xcFoo", CallingConvention = CallingConvention.Cdecl)]
public extern static Result Foo(out IntPtr session,
[MarshalAs(UnmanagedType.FunctionPtr)]ObjectCallback callb...
I know that we can't overload operator with other meaning, we can't create new operators, and we can't overload without user-defined class. If I overload operators incorrectly? what errors will report? compiler errors or runtime error?
If I overload **, what would happen?
...
I'm trying to multithread something and i have my program set up such that i have a structure/class of variables that will be passed into each thread for processing.
In this class, there are variables that hold pointers to arrays some threads have common arrays from which they read data off of, instead of duplicating those arrays, point...
If I have something like
char name[10];
and I want to put the string s into name, where s = "joe"
how would I do that?
Also, can I make a function that takes strings as inputs, but treats those as char arrays?
...
What is the best way to present a clickable URL in a QTableView (or QTreeView, QListView, etc...)
Given a QStandardItemModel where some of the columns contain text with URLs I'd like them to become clickable and then handle the click by using QDesktopServices::openURL()
I was hoping there would be some easy way to leverage QLabel's tex...
I've written a custom hashing for my custom key in stdext::hash_map and would like to check whether the hasher is good. I'm using STL supplied with VS 2008. A typical check, as I know, is to check the uniformity of distribution among buckets.
How should I organize such a check correctly? A solution that comes to my mind is to modify ST...