|
George L. Jackson wrote: Feedback helps me to improve.
Nice
Russell
|
|
|
|
|
Hi everybody,
I've written a mfc application which uses dundas gauge controls (together with windows forms). Everything works fine in debug or release mode but when I try to install the software on a different machine (windows XP, freshly installed) the application don't even start. Actually the installation works fine but the software don't run. I've checked all dependencies with dependency walker and also included "DundasWinGauge.dll" in the setup project (VS2005 setup wizard). DotNet is installed on the target machine. If I exclude the dundas gauge control then the application also runs on the target machine.
Does anybody have an idea?
Best regards,
Frank.
|
|
|
|
|
How can I use the word string as a data type, like int?
C++ does not support it? ?
#define string char * ????? // some time it is wrong
Suppose that I have a header file for a template class: dummy.h
#ifndef DUMMY_H_
#define DUMMY_H_
// phototype
template<class t="">
class dummy
{
dummy();
public:
void read();
// void get_value(T&);
private:
T value;
}
// Implimentation
.......
template<class t="">
void dummy<t>::read()
{
cin>>value;
}
.......
#endif
// test
#define string char *
main()
{
dummy<string> name; // object name
name.read(); // -> an error occurs
.......
}
Why is that? if I replace string by int
dummy<int> name;
name.read() // NO PROBLEM
I knew my fault.... cin>>name can't be used for char * (pointer)
but I want to use string as a data type, so that I can declare: dummy<string> name;
Can you have me?
thanks a lot....
ubri
|
|
|
|
|
ubriela wrote: #define string char *
Besides the fact that you are posting this in the wrong forum
(this should be on the Visual C++/MFC board)...
What's the error you are getting? I can't read your code without
the angle brackets on your template code...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It seems you want to use of templates but can you write fully template code and does your question on the C++/CLI?
|
|
|
|
|
hey all. i was wondering if i could get a bit of advice. Im a final year robotics student and i've just had a new idea for my dissitation project, but im not sure if its viable. The part im unsure of would be a usb keyboard feeding text into a c++ application.
I have a basic understanding of c++, some asm programming via a 8051 processor and i've just ordered some usb interfacing books, to help me along with creating a driver and bus. I should be able to manage it for a pc, but could the same driver and software work on a pda running windows and usb otg ?(although i know otg bus is diffrent, but back compatible form usb)
As i said i haven't really researched into it yet, so it's just off the top of my head at the moment. Any advice or points to references would be great.
cheers.
Lucas.
|
|
|
|
|
You may want to look up at the list of message boards and find a more appropriate one
for your question. You may get more help that way
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi
iam using two different library in my application class
this two library using one struct with the same name,
when i try to include this two library header file in my application class
iam getting redefinition error
i dont have the source to include namespace in the library
how to include this two library file in my application class without this redefinition error
thanks and regards
shivapalanirajan krj.
iam a software engineer working for varisis technologies bangalore
|
|
|
|
|
Please post C/C++ questions that DON'T relate to Managed C++/CLI
on the visual C++/MFC board[^]
Without the source code you're screwed. Maybe you can wrap one of the header files
in another header file of your own, which wraps one of the headers in a different namespace.
I don't know if it would work or not...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am having problems accessing some of the methods of a COM component .
Method Signature in a com component as follows:
HRESULT Getvalues(int i, int j , VARIANT &varval);
When adding reference of our COM component to the .Net code . .NET has converted the method to as follows:
System: object^ GetValues(int i , int j );
There is a invalid variant exception while executing GetValues(int i , int j ) from .Net application(Mixed Mode C++ application in VS 2005)
How do determine the call to COM function was successfull?
In the old native code HRESULT inidcated that the function call was successful or not.
So what is equivalent of HRESULT in Managed Wrapper for COM component?
Thanks a lot for the help,
Arti
|
|
|
|
|
Hi
I have a C program that has three edit text boxes to enter the month, day and year. I also have an LTEXT field labeled Age. Is there a way that I can display the age after the month, day and year are entered. I have the program calculating the age but I cannot get it to display the age on the screen after the month day and year are entered.
Thanks
-- modified at 10:31 Monday 10th September, 2007
Marsha Eiter
|
|
|
|
|
If you're not using managed C++, then you're posting your question on the wrong board.
You should post on the Visual C++/MFC board.
eitwoman wrote: Is there a way to code the program that is a user enters the month, day or year instead of selecting it from the drop-down list that the system will automatically select the index of the month, day and year of the number that they entered?
Yes.
You could also look into using the Month Calendar Control[^].
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks I appreciate it but the user was pretty clear on wanting to be able to enter the data by hand.
I appreciate the suggestion though!
Marsha
Marsha Eiter
|
|
|
|
|
The SetWindowText() API can be used to set the text of the LTEXT control.
To convert a numeric age value to a string for display, you could use the CRT
sprintf_s() function.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks I appreciate the help. I will try this and let you know.
Marsha
Marsha Eiter
|
|
|
|
|
char alpha[10] = "abcdefg";
string beta = "abcdefg";
alpha[1]= '\0'; gives the following result : alpha = a
beta[1]='\0'; gives the following result : beta = a cdefg
How can i use '\0' in strings as i use them in an array? I mean iwant that '\0' replace 'bcdefg' in string not just 'b'.
Thanks
|
|
|
|
|
#include<stdio.h>
void main()
{
char string1[10]="abcdef";
char string2[10]="abcdef";
string1[1]='\0';
string2[1]='\0';
printf("%s\n%s",string1,string2);
}
result:
a
a
----
i don't think it is wrong
ubri
|
|
|
|
|
Unfortunately, he is trying to modify a std::string and not a char array string.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks for the tip
{
in a land with no bird, no spring. My first journey was a
return 0;
}
|
|
|
|
|
Apparently, you are printing the result with the following: std::cout << beta << std::endl . If you print it with std::cout << beta.c_str() << std::endl , you get the desired print out. However, if you actually want to remove the characters following 'a' you can do this:
#include <iostream>
#include <string>
int _tmain(int argc, _TCHAR* argv[])
{
std::string beta = "abcdefg";
beta.erase(beta.begin() + 1, beta.end());
std::cout << "Result #1: " << beta << std::endl;
std::cout << "Result #2: " << beta.c_str() << std::endl;
return 0;
}
Also, please post C++ questions in the C++ forum and not the C++/CLI forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi.
Thanks for the tip.
Pourang
{
in a land with no bird, no spring. My first journey was a
return 0;
}
|
|
|
|
|
You are little bit consfused with char[] and std :: string
Please Clear about that.
Best Regards,
Chetan Patel
|
|
|
|
|
Hi.
I got my answer but you're right. I'm reading the c++ Primer + and there are different chapters to cover String. I did not read the chapter which explains in details.
It sucks to be a beginner
{
in a land with no bird, no spring. My first journey was a
return 0;
}
|
|
|
|
|
Hi, I am using Visual Studio 2005 C++/CLI. I want to print via the print preview dialog. I set up the printPreviewDialog and created a document I could view with the printPreviewDialog. But when I used the print button to print what was being displayed only some of the document was printed. The bottom of the document was cut off. I thought that the print preview dialog showed what the printed output would look like (WYSIWYG) before you decided to print it. Isn't this the case?
Buck
|
|
|
|
|
Here is the code snippet of my application. background thread is a managed thread.
Code Snippet
public ref class Form1 : public System::Windows::Forms::Form
{
private:
Thread^ myThread; //Managed Thread Handle
IDiscovery* discObj // Pointer to unmanaged type
public :
static System::Void ThreadProc(System::Object^ pv)
{
System::IntPtr^ ptrDiscovery = cli::safe_cast<system::intptr^>(pv);
IDiscovery *discObj;
discObj = (IDiscovery *)ptrDiscovery->ToPointer();
//get the list from IDiscovery
discObj->discoverList(false);
}//END OF THREADPROC
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
System::IntPtr^ pV = gcnew System::IntPtr(static_cast<void*>(discObj));
myThread = gcnew Thread(gcnew ParameterizedThreadStart(Form1::ThreadProc));
myThread->Start(pV);
}//END OF FUNCTION
At times I am getting following exception:
An unhandled exception of type 'System.AccessViolationException'
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I am not sure whether this the right way to do it. Please suggest.
Thanks a lot,
Arti
|
|
|
|