|
thank you ,your advances would be good for me!
|
|
|
|
|
Hello!
I had an error in my project created with QT and C++
I created Server which gets data from AudioInput and gives it to UDP Socket, there is no problem, but in Client's project I had a problem, when I tried to write data to AudioOutput device after UDP Socket gets this data from net
in my project error was in this line "int l = audioSource->read(audioBuffer,input);" in
"qaudiooutput_win32_p.cpp"
and this is Call Stack at time debugging which shows this
QtMultimediad4.dll!QAudioOutputPrivate::deviceReady() Line 579 + 0x1c bytes C++
QtMultimediad4.dll!QAudioOutputPrivate::qt_static_metacall(QObject * _o=0x00b53308, QMetaObject::Call _c=InvokeMetaMethod, int _id=1, void * * _a=0x00b51d20) Line 52 + 0x8 bytes C++
what I did wrong
PLEASE HELP!!!!!
|
|
|
|
|
|
Could be that the audio device is being locked up by the other caller. You don't show the actual error code but the function where it stalls out would indicate that he's checking if the device is ready.
You should post the actual error output instead of the call stack. Also, this is likely a problem with how you're using Qt, so you may be better off asking for help in a Qt forum.
|
|
|
|
|
Could anyone please help me to find why call to sort() is crashing at run-time in following code block:
string s = "Annnitttesrrh.";
vector<char> vecChar(s.begin(), s.end());
sort(vecChar.begin(), vecChar.end(), greater_equal<char>());
Am i missing something very basic ?
|
|
|
|
|
Kumar Anitesh wrote: Am i missing something very basic ? Not that I can figure out. I tried the same code, but using greater as the predicate and it works fine. This needs an STL expert to look at it, but you posted in the managed C++ forum; try http://www.codeproject.com/Forums/4486/ATL-WTL-STL.aspx[^].
Veni, vidi, abiit domum
|
|
|
|
|
Hello,
I'm a bit confused about the difference between:
LRESULT CALLBACK WndProc(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam);
and
virtual void WndProc(Message %m);
I know that the first is to get message to menage event in win32, but so "WndProc(Message %m)" is the same thing when we are programming a Windows Form project?
The last question is: when is better to use NativeWindow methos and when is better to use win32 methods to menage events?
My project is a simple window form with a panel, on the Panel i call a window where I can menage OpenGL operations.
Could someone help me?
Thank you
|
|
|
|
|
The first version is the native unmanaged code version, and the second is the managed one[^]. As to which is better, that depends on the design and structure of your program.
Veni, vidi, abiit domum
|
|
|
|
|
Use a native window when you're working with native C/C++/WinAPI code and use the managed version when you're using managed code. Only reason to use native code when you have a managed project is if the managed version doesn't do something you need already (which is hardly ever the case).
|
|
|
|
|
Ok I need some help here. I have been through the MSDN sites and tried multiple types of sockets and streams.
What I am trying to do is this. I have a C++/CLI forms app using /clrsafe runtime.
What I need is socket so I can send a string like "^0!NO\r" through a raw TCP port. There is only a "one way connection here" the response will have to be on a listener stream but the system will not be making a socket connection with the program. I have completed this in Python script so those who know python this is how I did it.
Chost = '169.254.232.50'
Cport = 1555
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket Created'
cam = socket.socket()
try:
s.bind((host, port))
except socket.error , msg:
print 'Bind failed. Error Code : ' +str(msg[0]) + ' Message ' + msg[1]
sys.exit()
Any help would be great,
|
|
|
|
|
The code is much the same as you have above, although you would use connect rather than bind ; see this tutorial[^].
Veni, vidi, abiit domum
|
|
|
|
|
Hi, I actually have 2 problems. If i enter gcgc, it should give me 4 when counting G's and C's but it gives me 3 instead. Also, the program doesn't stop by itself (I have to press control C to get out). What is wrong with my code?
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
char input = ' ';
int count = 0;
char newinput = ' ';
int newcount = 0;
cout << "Enter the DNA strand:";
cin >> input;
while (input != '\n')
{cin.get(input);
switch (toupper(input))
{
case 'C':
count++;
break;
case 'G':
count++;
break;}}
cout << "There are " << count << " C's and G's in this DNA strand."<< endl;
while (input != '\n')
{cin.get(input);
switch (toupper(input))
{
case 'B':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin>>newinput;
cin.clear();
cin.ignore('\n');
break;
case 'D':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'E':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'F':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'H':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'I':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'J':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'K':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'L':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'M':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'N':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'O':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'P':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'Q':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'R':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'S':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'U':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'V':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'W':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'X':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'Y':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
case 'Z':
cout << "Invalid sequence! Please enter the correct nucleotide sequence:";
cin.clear();
cin.ignore('\n');
break;
}
}
while (newinput != '\n')
{ cin.get(newinput);
switch (toupper(newinput))
{ case 'C':
newcount++;
break;
case 'G':
newcount++;
break;
}
}
cout << "There are " << newcount << " C's and G's in this DNA strand." << endl;
return 0;
}
|
|
|
|
|
You could simplify this by removing all those redundant case blocks and replaing them with a single default: . You could then use your debugger to find out why it does not break out of the loop.
Use the best guess
|
|
|
|
|
I have a native dll with some code that I want to leverage from managed C# applications.
So I wrote a C++/CLI class library to implement an wrapper assembly.
This works well but it creates a maintenance issue.
In the C# client project, I added a reference to my wrapper assembly and whenever I build the client project, the assembly dll gets copied to the build target folder.
However the dependent native dll does not get copied.
So my question is, how do I include the native dll in the wrapper assembly dependency so that they are both copied when the client project is built.
|
|
|
|
|
AFAIK, you don't. What you could do is have a post-build step which copies the files over.
|
|
|
|
|
I'll second this. We have a post-build step copy the DLLs too.
John
|
|
|
|
|
Am getting 'An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in CallingExe.exe
Additional information: External component has thrown an exception.' error when i try to call a dll generated with C# in my MFC code.
Have successfully generated the .tlb file using RegAsm.exe and also installed it using gacutil. both these were successfull. Have attached my code for reference.
MFC Code:
#using <mscorlib.dll>
#import "C:\\Programing\\Projects\\Visual Basic\\native calls\\vchash\\ManagedDLL\\ManagedDLL\\bin\\Debug\\ManagedDLL.tlb" raw_interfaces_only
using namespace ManagedDLL;
void CCallingExeDlg::OnBnClickedOk()
{
HRESULT hr = CoInitialize(NULL);
ICalculatorPtr pICalc(__uuidof(ManagedClass));
}
C# Code:
using System;
using System.Runtime.InteropServices;
namespace ManagedDLL
{
[ComVisible(true)]
[Guid("1A9ECDD2-24FC-4f9b-97BF-BF170B16CB38")]
public interface ICalculator
{
int Add(int Number1, int Number2);
};
[ComVisible(true)]
[Guid("9CEFF09D-7140-451e-A85E-2341A7C978FA")]
public class ManagedClass : ICalculator
{
public int Add(int Number1, int Number2)
{
return Number1 + Number2;
}
}
}
Am getting error in 'ICalculatorPtr pICalc(__uuidof(ManagedClass));' line of MFC code
Am stuck with this from past two weeks.
Any help would be greatly appreciated.
Dhamu
|
|
|
|
|
You cannot directly use a managed dll from unmanaged code as far as I know. You need to take some other actions as detailed in some of these articles[^].
Use the best guess
|
|
|
|
|
I have a high configurable pc with MS-Office 2010 package, i have implemented one application(in c++/cli) which will write plenty of data in no'of excel sheet(single workbook)so after writing in 8 sheets suddenly it pop-ups one error message saying"Excel cannot complete this task with available resources Choose less data or close other applications". Task Manager tells me I have plenty of resources left. Does anyone have any ideas as to what might be happening and how to fix it?
Note: I can't reproduce it again since application will do lot of process(almost 4days) to generate 8 sheets
|
|
|
|
|
Given that it is 4 days to generate the 8 sheets, it is my guess that you have a memory leak or a resource/handle leak. I know you say that Task Manager says you have plenty of resources left, but this really sounds like a leak of some kind.
I would start by double checking the freeing of every resource you allocate. Make sure they are freed in a timely manner also.
|
|
|
|
|
Hi David, now i realized that i am not saving the excel file till completion of the report generation so what i am suspecting, each excel sheet will have maximum rows 1048576 that means
1048576 * 8 = 8388608 rows of data(this data is a huge) it holding on RAM. Now what i will do i will save the excel file for each 5 sheets completion and continue to generate report.
In this application i am also using number of Dictionary objects, so i will also take care to freed these objects as per you suggestion.
Thanks for you support
|
|
|
|
|
I have a set of project folders which are compilable using make files and as of now i am compiling using nmake at command prompt.. i want the entire folder structure to be in a project or a solution file has to be built so that i can compile like a regular Project and must be able to place breakpoint in VS6.0 pls help
PS: Code is in plain C and C++ and NO MFC Used ...
|
|
|
|
|
Shyam Kodase wrote: Code is in plain C and C++
Then you would be better off asking in the appropriate forum[^] since this forum is for mangaged C++.
|
|
|
|
|
Shyam Kodase wrote: Code is in plain C and C++ So why have you posted this in the Managed C++/CLI forum?
However, as to your question: The best way to do this would be to leave the existing folders intact until the new projects are all building successfully.
- Using Visual Studio, create a new empty project for the first existing project in your set. This will create a solution folder and a project folder underneath it.
- Copy the source files (via Windows Explorer) from the existing project into the new project folder.
- Using Visual Studio, add the files into the project (header, resource, source etc).
- Build the project and correct any errors.
- Add a new blank project to the solution and repeat the above process.
- Repeat for all remaining projects.
Use the best guess
|
|
|
|
|
I have managed c++ ref type class in DLL. In C# application, I am using the this managed DLL and referring the managed class as below:
CManaged * obj = new CManaged();
with help of pointer to instance, I am accessing the member methods of CManaged class.
Everything is working fine on VS 2010.
Question:
How C# (managed code) handle the pointers?
Is it depend on my Visual Studio version?
|
|
|
|