c++

Bitwise Manipulation or Bitwise Programming

I know the concepts of bit-wise operators, bit manipulation, 2's complement etc. But when it comes to solving something using bit manipulation it does not strike me. I takes me time to wrap my head around them. I thought it would help if I looked at some questions regarding bit operators/bit manipulation but it left me even more confus...

Calling unmanaged C++ Class DLL from C#

How can I call unmanaged C++ Class DLL from C#? ...

Hangs on CreateDialogIndirect in CWinThread derived class.

I'm new to multithreading. I created a class inherit from CWinThread called CMyUIThread, and also a dialog called CMyInfoDlg which has a text and a progress ctrl. I would to show modeless dialog in new created thread. Below is partial code: BOOL CMyUIThread::InitInstance() { // TODO: perform and per-thread initialization here // NOTE:...

EnableMenuItem Function Is not Working With the parameter MF_GRAYED

Have created a ATL COM project through which I am inserting Menu Items to The rightclick menu like this: STDMETHODIMP CSimpleShlExt::QueryContextMenu ( HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd, UINT uidLastCmd, UINT uFlags ) { gHMenu=hmenu; UINT uCmdID = uidFirstCmd; // If t...

C++ performance issue

Hi all, I am having a little dilemma with a C++ code. Its actually a performance issue. I am trying to traverse through two hash_maps which is causing a lot of slowness. Heres the hash map class code. Let me know if I am missing something from this. template<class Handle, class Object, class HashFunc, vector<Object *> (*initFunc)()> ...

QT Dependency Visualizer

I have a lot of classes which interact with other classes through signal&slot mechanism, composition, inheratance etc. I wonder, is there any tool which visualizes(such as:UML-like diagrams) dependencies between classes in source code especially for QT based codes? Thanks. ...

Marshal C++ int array to C#

I would like to marshal an array of ints from C++ to C#. I have an unmanaged C++ dll which contains: DLL_EXPORT int* fnwrapper_intarr() { int* test = new int[3]; test[0] = 1; test[1] = 2; test[2] = 3; return test; } with declaration in header extern "C" DLL_EXPORT int* fnwrapper_intarr(); I am then using pinvoke...

How to utilize SECURITY_DESCRIPTOR in InitializeObjectAttributes()

Could someone provide me an example of utilizing SECURITY_DESCRIPTOR in InitializeObjectAttributes()? I plan to use them with NtCreateKey(). I couldn't find any example on the Internet. Thanks in advance. ...

Windows C++ App crash

I have a Windows C++ app that crashes on user computers from time to time. I didnt write the app and it doesnt have its own logging. Is there a tool / utility I could use that is able to log some useful information when the application exits (e.g. the file and line number where the crash occurred)? The end user's component does not have ...

error while loading shared libraries wrong ELF class: ELFCLASS32

We have a daemon that is compiled using -m32 compiler option and in its execution time load /bin/sh of 64 bit application by forking to load a 64 ssh-agent. So the process goes in some loop from 32 bit mode to 64 bit mode. Recently we have seen that application throws error as mentioned in title. Below is the extract of strace that we ca...

Three exception-handling Versions, which one is preferable?

I'm implementing a Zip-Wrapper (zlib minizip) and asking myself how i should handle exceptions properly. I'm thinking of three versions. Which one would you prefer, or is there a version i didn't thought about? The task of the function Install is to get a Zip-File from a Web-Server, unpack its content and delete the downloaded Zip-File....

Code refactoring

I am about to starting to work on a project which involves refactoring and modifying existing code which is in c & c++. The code is a bloated one and is in huge volume. Ofcourse since the code needs to be modified an understanding of the code has to be developed and in a very short span of time since we have some pretty time pressed proj...

What prevents C++ from being a strict superset of C?

Possible Duplicate: C subset of C++ -> Where not ? examples ? I'm aware that C++ is not a strict superset of C. What language features prevent C++ from being a superset of C? ...

Solve Fibonacci Sequence Recursively returning void in function.

My professor has asked us to write a program that uses recursion to solve a fibonacci sequence. This is all pretty normal, but he's asked us to make our function return void. I've been working at this for a few days now and can't find a way to do this. I have: void fibonacci(double *n,double *x,double *y,double *result) { if(*n ...

How to access Windows shell context menu items?

Hi, In Windows Explorer, you right click on a file, a context menu shows up which contains built-in items like 'Send to...' and/or 3rd party actions such as 'zip file with Winzip'. My question are: How to obtain the full list of available menu items for a specific file? For each menu item, how to get the caption? How to invoke a speci...

How to reverse individual words?

I need to transform a string such as "my name is thomos" to "ym eman si somoht". What do I need to know in order to do that? ...

Rotate 2D rectangular array in-place

I have an non-square array like this: const int dim1 = 3, dim2 = 4; int array[12] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12}; and I need to convert it to: {3,6,9,12, 2,5,8,11, 1,4,7,10} that is, rotate/shuffle it counter-clockwise (or clockwise, the algorithm should be similiar)...

To convert the string "UK based project" to "project based UK" using only loops not string function

I have written the code which is too lengthy: main() { char strEnter[100]; char strGet[100]; cout<<"Enter any string:"; gets(strEnter); int counter=0; int length=strlen(steEnter)-1; while(length>=0) { if(strEnter[length]==' ') { for(int i=length+1;strEnter!=null;i++) ...

is it possible to change what the user types without pressing enter? this is a console program in C.

Is this possible? The idea is typing a password and it being translated to asterisks on the fly- pretty much like a password field on HTML. I've written this code, but it converts the input AFTER the user presses enter, not while he/she is typing. #include <stdio.h> #include <string.h> #include <iostream> int main() { char passwor...

Returning a unique_ptr from a class method C++0x

If my class SomeType has a method that returns a element from the map (using the key) say std::unique_ptr<OtherType> get_othertype(std::string name) { return otMap.find(name); } that would enure the caller would recieve a pointer to the one in the map rather than a copy? Is it ok to do this, or would it try and call the copy const...